Skip to main content

Sponge 🧽

PyPI version CI Python 3.12+ License: MIT

Same model. Same quality. 1/10 the tokens.

Sponge is an architecture-level cost compression harness for LLM agents. It doesn't switch you to cheaper models or bolt on caching as an afterthought. Every layer — task decomposition, context loading, sub-agent results, memory — is designed from first principles to slash token consumption. Same model quality, dramatically lower cost.


Quick Start

pip install sponge-ai[deepseek]       # or [anthropic] or [openai] or [openrouter]
export SPONGE_DEEPSEEK_API_KEY=sk-...  # or SPONGE_ANTHROPIC_API_KEY etc.
sponge run "explain the CAP theorem in one sentence"

How It Saves Tokens

Layer What It Does Cost
Plugin Routing File ops, code search, shell commands → handled locally $0
Exact Cache Identical tasks return cached result (SHA256 match) $0
Semantic Cache Similar tasks match via Jaccard similarity $0
Self-Tuning Detects waste (TTL too short, budget too loose) → proposes fixes 5-20%
Context Compression Old conversation turns summarized, not re-sent 2-5×
Task Decomposition Complex tasks split into focused sub-tasks 5-10×
LLM Call Only when nothing else works Full price

Commands

sponge run "task"          # Execute a task
  --model, -m MODEL        # Override the model
  --json                   # JSON output
  --auto-approve           # Allow write/delete/shell operations

sponge benchmark           # Run benchmark fixtures against a real provider
  --fixture, -f NAME       # Run a single fixture
  --output, -o FILE.json   # Save results

sponge cost session        # Cost breakdown for latest session
sponge cost total --days 30 # Total cost over N days
sponge cost stats          # Overall efficiency statistics

sponge tune report         # Detect optimization opportunities
sponge tune apply ID       # Activate a tuning proposal
sponge tune review         # Evaluate active experiments

sponge session start       # Start a multi-turn conversation
sponge session chat "msg"  # Send a message
sponge session resume ID   # Resume a saved session
sponge session list        # List all sessions

sponge memory add "rule"   # Add project convention
sponge memory list         # List all conventions
sponge memory remove N     # Remove a convention

sponge config show         # Show current configuration
sponge config set KEY=VAL  # Change a setting

sponge --version           # Show version

Supported Providers

Provider Install Env Var
Anthropic (Claude) [anthropic] SPONGE_ANTHROPIC_API_KEY
OpenAI (GPT-4o) [openai] SPONGE_OPENAI_API_KEY
DeepSeek (V4) [deepseek] SPONGE_DEEPSEEK_API_KEY
OpenRouter (200+ models) [openrouter] SPONGE_OPENROUTER_API_KEY

Switch via SPONGE_PROVIDER env var or sponge config set provider=deepseek.


Project Memory

Create .sponge/memory.toml in your project root (or use sponge memory add):

[memory]
rules = [
    "Never modify tests/fixtures/ without asking",
    "Use httpx instead of requests",
]

These are injected into every LLM call as system instructions.


Cost Transparency

Every LLM call is logged to ~/.sponge/telemetry/fingerprints.db:

sponge cost stats
# Sponge Efficiency Stats
#   Total calls:      42
#   Cache hits:       23 (55%)
#   Plugin calls:     8 ($0)
#   LLM calls:        11
#   Total cost:       $0.002347
#   Naive cost:       $0.005120
#   Total saved:      $0.002773 (54.2%)

Development

git clone https://github.com/ihgoa501-stack/sponge.git
cd sponge
pip install -e ".[dev]"
pytest                  # 157 tests, zero API calls required
ruff check src/         # lint
mypy src/sponge/        # type check

License

MIT

Metadata

Release files for sponge-ai 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sponge-ai 0.2.0
File Size Uploaded Provenance Actions
sponge_ai-0.2.0.tar.gz 91.6 kB Without provenance Details for sponge_ai-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sponge-ai 0.2.0
File Interpreter ABI Platform Actions
sponge_ai-0.2.0-py3-none-any.whl Python 3 none any Details for sponge_ai-0.2.0-py3-none-any.whl

Total release size: 182.6 kB

Release files / sponge_ai-0.2.0.tar.gz

Download URL sponge_ai-0.2.0.tar.gz
Size 91.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ac4b4028bb109d7250b8ec25d1bef05e236f564ac0d984e7657209470b95e635
BLAKE2b-256 checksum
How to use checksums
8ab8a05a1b783437fa2e51ab1f8858bdf59efcc7c25b5b45ae61f8537dc49d08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / sponge_ai-0.2.0-py3-none-any.whl

Download URL sponge_ai-0.2.0-py3-none-any.whl
Size 91.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
984efc211e72a128ae3695f78555d50de03a28e27513835383e085bf1544ba0e
BLAKE2b-256 checksum
How to use checksums
f49c73f082ce371633e2a1a36caf60995f3f2da79bc3b90c5db79d56b807b655
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for sponge-ai 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page