Skip to main content

Get better results for far less cost. TokenStretcher decomposes complex work, routes tasks intelligently, and enforces hard prepaid budgets so you never blow past limits.

Project description

TokenStretcher

Higher quality results for far less cost.

Most people throw entire complex tasks at a powerful model in one giant prompt. This wastes massive context on irrelevant details, produces unfocused output, and makes it easy to blow past budgets.

TokenStretcher works differently.

It breaks complex work into focused subtasks, routes each piece to the right model, executes in parallel where it makes sense, and synthesizes a superior final result — while using dramatically fewer tokens overall.

Typical real-world outcome on hard tasks: 30–60% lower cost with better, more reliable results than a single massive prompt.


Why Giant Prompts Are Wasteful

  • 70%+ of the tokens often go to context that doesn't matter for the current part of the work.
  • One model is forced to be a jack-of-all-trades.
  • Output quality suffers from lack of focus.
  • Costs are unpredictable and easy to overrun.

With TokenStretcher

  • Prepaid only, hard caps — You preload funds. The system enforces your budget in real time. No surprise bills, ever.
  • Focused work — Each part of the task gets only the context and expertise it needs.
  • Better results — Specialists handle what they're good at. You get sharper, more production-grade output.
  • Full visibility — Every run gives you a clear report so you can see exactly what you got for the cost.

You stay in control. The system stays efficient.


Real Results on Complex Tasks

Here are outcomes from recent production-grade tasks (measured against strong single-prompt baselines using the same underlying models):

EvalForge — Complete LLM Evaluation & Prompt Optimization Platform

  • Requirements: evaluation engine with multiple dimensions + caching/routing, prompt optimizer with Pareto analysis, analytics (kappa, cost curves, exports), background jobs, auth/billing integration, FastAPI + HTMX UI, SDK + CLI, Docker, full tests, demo.
  • Result: 52% token reduction, "excellent" quality rating, clean modular production code delivered across specialized components.

Personal Finance Dashboard — Full end-to-end system

  • Requirements: CoinGecko price data, 30/90-day metrics (volatility, Sharpe, correlations, trends), FastAPI + JWT auth, Redis-backed background jobs, interactive HTMX frontend, CSV/PDF export, pytest suite with golden data, Docker Compose, comprehensive README.
  • Result: 9%+ token savings (significant improvement vs earlier versions), fully working runnable system with real calculations, auth, jobs, and frontend.

On the right tasks (new features, large refactors, multi-domain systems with research + code + tests + infra), teams routinely see 30–60%+ effective cost reduction while getting more focused, higher-quality deliverables.


Quick Start

CLI

pip install tokenstretcher

tokenstretcher "Build a production FastAPI service with JWT auth, user CRUD, and rate limiting"

tokenstretcher --plan-only "your task here"

tokenstretcher --json "your task here"

Python API

from tokenstretcher import run

result = await run(
    "Create a complete, secure FastAPI authentication system with refresh tokens and roles"
)

print(result.final_output)
print(result.savings.summary())

Built for Agentic Tools

TokenStretcher is designed to be called as a tool by other AI coding environments (Grok Build, OpenCode, Cursor, Aider, Continue.dev, etc.).

Every run returns structured results and clear savings data so the calling agent can decide intelligently when decomposition is worth it.


Prepay Model — Zero Surprise Bills

  1. Add funds to your wallet.
  2. Run tasks.
  3. Every call is tracked against your prepaid balance in real time.
  4. If balance is too low, it simply stops — no overages.

This is the safest possible way to use powerful models at scale, whether you're a human or an autonomous agent.


Installation

pip install tokenstretcher

Why It Matters

Most AI usage today is extremely wasteful.

TokenStretcher gives you a practical way to get better work while using far fewer tokens and staying within hard budget limits.

Prepaid. Hard-capped. Focused. Effective.

That’s the entire point.


License

TokenStretcher is released under the Business Source License (BSL 1.1).

Free for individuals and internal use. Commercial resale or hosting as a paid service requires a separate license after the change date.

See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tokenstretcher-1.3.1.tar.gz (50.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tokenstretcher-1.3.1-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file tokenstretcher-1.3.1.tar.gz.

File metadata

  • Download URL: tokenstretcher-1.3.1.tar.gz
  • Upload date:
  • Size: 50.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.5

File hashes

Hashes for tokenstretcher-1.3.1.tar.gz
Algorithm Hash digest
SHA256 8602a0f7ea0328bd8965751fa1bf53bd525580fdcbec3fa333f89e612f61013f
MD5 bcb7daed7e9d35e43ecae0eea88d1659
BLAKE2b-256 b92fb30bde08c5c57e1a5b30a2303e2312a753448e3a278291e6d481456828e7

See more details on using hashes here.

File details

Details for the file tokenstretcher-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: tokenstretcher-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.5

File hashes

Hashes for tokenstretcher-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1025251506003c94e1e1fff8b0b06839b78fe18321e40926dbcc9c48a444180e
MD5 02cd11af91ad212482bcfd0840bdf2c6
BLAKE2b-256 3516da4d94e47ed913df984ebfed7bd4810df1a34b13dd533e75771264bd9b1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page