Skip to main content

TokenPatch

Bounded, auditable AI code patch execution for existing coding agents.

tokenpatch.com · Quickstart · Install · Demo evidence

tokenpatch lets Codex, Cursor, Claude Code, CLI agents, and MCP clients keep their configured strong model in charge, then route bounded implementation patches to a cheaper executor such as DeepSeek V4 Pro.

The metric is not just request cost. tokenpatch focuses on cost per applied AI coding patch.

What is TokenPatch?

TokenPatch is an open-source execution layer for small, well-defined AI coding changes. It does not replace your primary coding agent. The primary agent plans and reviews; TokenPatch executes an eligible patch with explicit file boundaries, a recovery checkpoint, patch validation, and task-level cost records.

TokenPatch is best suited to narrow, testable work where allowed files and acceptance criteria can be stated before execution. It is not a generic model proxy, a full observability platform, or a substitute for engineering review.

Canonical product definition: tokenpatch.com/what-is-tokenpatch.

tokenpatch report snapshot

Quick Start

The first public release is BYOK-first. Bring your own DeepSeek API key.

pip install git+https://github.com/Leoyen1/tokenpatch.git
tokenpatch bootstrap

Set executor credentials in your app's MCP environment settings, shell, or ~/.tokenpatch/config.toml:

MMDEV_EXECUTOR_PROVIDER=deepseek_byok
DEEPSEEK_API_KEY=your-deepseek-key
DEEPSEEK_BASE_URL=https://api.deepseek.com
DEEPSEEK_EXECUTOR_MODEL=deepseek-v4-pro

Then ask inside Codex, Claude Code, Cursor, or another coding agent:

tp: change the page title. Only modify index.html.

Check the result:

tokenpatch metrics
tokenpatch report

What You Get

  • Keep using Codex, Claude Code, Cursor, or your own agent.
  • Route bounded implementation work to a lower-cost executor.
  • Check allowed_files before applying patches.
  • Create local recovery checkpoints before AI edits.
  • Report actual executor cost, all-strong baseline estimate, savings ratio, and cost per applied patch.
  • Keep GPT/Claude keys in your existing coding app; tokenpatch only needs executor credentials for App Mode.

Example Report Signal

Task: change page title, only modify index.html
All-strong estimate: $0.42
tokenpatch actual: $0.08
Saved: 81%
Patch applied: yes
Tests: passed

The numbers above are an illustrative demo snapshot, not a universal guarantee. Real savings depend on task size, retries, model pricing, cache behavior, and review strategy.

How It Works

Strong model plans and reviews
        |
        v
tokenpatch creates a bounded executor task
        |
        v
DeepSeek V4 Pro writes the patch
        |
        v
tokenpatch checks allowed_files, applies the patch, and reports cost

Works With

  • Codex App and Codex CLI
  • Claude Code
  • Cursor
  • VS Code / Cline / other MCP-capable agents
  • Terminal workflows and CI

You can ask in any language. The docs, UI labels, metrics, and structured reports are English-first.

TokenPatch and Aider

Aider is an interactive terminal pair programmer. TokenPatch is a bounded execution layer that sits alongside a primary coding agent. Choose Aider for an evolving coding conversation; choose TokenPatch when the requirement and allowed files are already known and you want checkpointed execution plus cost evidence. The tools can also be used together.

See the sourced comparison: TokenPatch vs Aider.

BYOK First, Hosted Credits Later

The open-source client works today with your own DeepSeek API key.

Hosted tokenpatch.com credits are planned later for users who cannot easily get, recharge, or manage a DeepSeek key directly. The hosted path is optional and private beta first. tokenpatch should not be described as an official DeepSeek reseller or as endorsed by DeepSeek.

Docs

Common Commands

tokenpatch bootstrap
tokenpatch do "Implement a small change" --allowed-file path/to/file
tp do "Implement a small change" --allowed-file path/to/file
tokenpatch metrics
tokenpatch report

Advanced commands such as plan, run, validate, review, checkpoint, memory, web, and mcp are documented in the Quickstart and Install Guide.

Compatibility note: legacy mmdev internals remain for older scripts, but the public project name is tokenpatch.

Development

git clone https://github.com/Leoyen1/tokenpatch
cd tokenpatch
python -m pip install -e ".[test,web]"
python -m pytest -q

CI runs unit tests and example tests through GitHub Actions.

Release files for tokenpatch 0.1.1

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

Source distribution (sdist)

Source distribution for tokenpatch 0.1.1
File Size Uploaded
tokenpatch-0.1.1.tar.gz 90.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tokenpatch 0.1.1
File Interpreter ABI Platform
tokenpatch-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 174.1 kB

Release files / tokenpatch-0.1.1.tar.gz

Download URL tokenpatch-0.1.1.tar.gz
Size 90.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c4f321ef530aeca48b7336818cf08a29f3b4e302f74cad360fa8d578db289bca
BLAKE2b-256 checksum
How to use checksums
a8b4c4999e5a1078f945c6841f04fe157388e863100957d23c56556497ffca6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Release files / tokenpatch-0.1.1-py3-none-any.whl

Download URL tokenpatch-0.1.1-py3-none-any.whl
Size 83.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c0d70637ce46e463ac87345f962a9d3c0223f433751af74ebb2daea83ddf3b6
BLAKE2b-256 checksum
How to use checksums
1b13185483d913f49e006aa6ba3a81beb878764c1e9229d2a854a91c1a1f2428
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

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