Developer
API & MCP
Clean prompts programmatically — in your agents, pipelines, and coding tools. Removes filler, hedging, and redundancy while keeping every requirement: same result, fewer input tokens. Two ways to save: a pre-cleaner that cleans your prompt before your agent sees it, and a plug-and-play MCP (plus a REST endpoint) for cleaning inside agents and pipelines.
Your API keys
Create a free account (the free tier includes API access), generate a key — shown once — then use it below.
API keys are tied to your account. Sign in or create a free account to generate one — the free tier includes API access.
Pre-cleaner — clean in the chat box, before you send
To actually cut your input tokens, the cleaned text has to replace the raw one before you hit send. This hotkey does exactly that: type your messy prompt straight into any chat box — Claude Code, Codex, ChatGPT desktop — press Ctrl+Shift+K, and it is replaced in place with the cleaned version. No browser tab, no copy-paste, and the raw prompt is never sent. (For one-off prompts, the playground does the same in the browser.)
~/.atc/key file (preferred) or the ATC_API_KEY environment variable — never hardcode it.1. Set your API key
# Store your key once in ~/.atc/key (read first, no restart needed):
New-Item -ItemType Directory -Force "$HOME\.atc" | Out-Null
Set-Content "$HOME\.atc\key" "atc_YOUR_KEY" -NoNewline -Encoding asciiThe ~/.atc/key file is read first and needs no restart — set it once. An ATC_API_KEY env var also works as a fallback.
2. Download & run the hotkey
Save the script, then run it from PowerShell. Leave the window open (minimized is fine) — it listens for the hotkey in the background.
↓ Download clean-before-send.ps1# keep this window open (minimize it)
powershell -NoProfile -ExecutionPolicy Bypass -File clean-before-send.ps13. Use it
Ctrl+Shift+K— in a GUI chat box (Claude Code / Codex desktop, web chats): type your messy prompt, press it, and the box is replaced with the cleaned version. Review, then send.Ctrl+Shift+J— for terminals (Codex CLI): copy your messy text, press it, then paste the cleaned text back.Ctrl+Shift+M— cycle mode:plain-clean→caveman→structured-clean.Ctrl+Shift+L— cycle the cleaner model.Ctrl+Shift+Q— quit.
The window shows the current mode + cleaner and reprints them on each change. ATC_MODE / ATC_MODEL just set the starting values (defaults plain-clean / gemini-2.5-flash) — change them live with Ctrl+Shift+M / L, no relaunch.
No target-model option here — a target only changes the token-count estimate shown in the playground UI; it does not affect the clean itself, and the hotkey has no display to show it against. Pick a target in the playground when you want that readout.
/clean command? A Claude Code /clean slash command is possible, but whatever you type after it is still recorded as your prompt for that turn — so it does not actually keep the raw tokens out of the model. The in-place hotkey above is what delivers real input-token savings.Connect the MCP
Remote MCP over Streamable HTTP at https://aitokencleaner.com/api/mcp — nothing to install. It exposes the clean_prompt tool plus an /atc_clean slash command, so your agent cleans long prompts before sending them anywhere.
Works with Claude Code, Cursor, and any MCP client that accepts an Authorization header. Browser sign-in (OAuth) is coming soon.
Connect in 3 steps
1. Create an API key
Use the panel above — copy it once and keep it safe.
2. Add the server to your client
Claude Code (CLI)
Run these commands in your terminal. The MCP connects via the claude CLI — no npm install needed.
1. Create an API key above (if you haven’t already)
Copy it once — shown only once.
2. Add the server to Claude Code
claude mcp add token-cleaner --transport http https://aitokencleaner.com/api/mcp --header "Authorization: Bearer atc_YOUR_KEY"3. Verify it’s connected
claude mcp listLook for ✓ Connected next to token-cleaner.
4. Use it in your Claude Code chat
Ask Claude Code to clean a prompt — it calls the clean_prompt tool automatically. Or type the /atc_clean slash command yourself. Either way the MCP cleans your input and returns the leaner version with stats.
Cursor / other clients (mcp.json)
{
"mcpServers": {
"token-cleaner": {
"url": "https://aitokencleaner.com/api/mcp",
"headers": { "Authorization": "Bearer atc_YOUR_KEY" }
}
}
}3. Use it
Ask in chat — tell the agent to clean a prompt; it calls clean_prompt and returns the cleaned text with token stats:
Clean this with token-cleaner: "could you please write me a really nice short calm poem about the sea, nothing too long, something relaxing"Or the slash command — /atc_clean (shown as /mcp__token-cleaner__atc_clean in Claude Code) cleans your prompt and continues with the leaner version automatically:
/atc_clean write a professional but warm email to my manager asking for Friday off for a personal appointmentTroubleshooting
“Failed to connect” in Claude Code? A stale entry in another scope (local / project) can shadow your key. Remove it from every scope, then add it once:
claude mcp remove token-cleaner -s local
claude mcp remove token-cleaner -s project
claude mcp remove token-cleaner -s userThen run claude mcp list (should show none) and re-add with a fresh key. If you rotate your key, remove & re-add the server so it picks up the new one.
Browser sign-in (OAuth)
Coming soonOne-click login with no key to paste is on the way. For now, use the API-key method above.
Tool parameters: text (required) · mode · sub_format · model · target_model · concise — same semantics as the REST API below.
How auth works: your tool sends your atc_ key as the Authorization header on every call, so each clean is tied to and billed on your account. Revoke a key anytime above.
REST API
POST https://aitokencleaner.com/api/v1/clean with your key as a Bearer token.
curl -X POST https://aitokencleaner.com/api/v1/clean \
-H "Authorization: Bearer atc_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "could you please write me a really nice short poem about the sea, nothing too long please, maybe something calm",
"mode": "plain-clean",
"target_model": "gemini-2.5-flash"
}'Response
{
"cleaned": "Write a short, calm poem about the sea.",
"mode": "plain-clean",
"model": "gemini-2.5-flash",
"stats": {
"original_tokens": 28,
"cleaned_tokens": 10,
"savings_percent": 64,
"estimated_usd_saved": 0.0000054,
"target_model": "gemini-2.5-flash"
},
"usage": { "credits_charged": 0, "cleans_today": 1, "daily_limit": 100 }
}Parameters
| Field | Type | Notes |
|---|---|---|
| prompt | string | Required. The prompt to clean (2,000 chars free / 10,000 Pro). |
| mode | string | plain-clean (default) · caveman · structured-clean |
| sub_format | string | For structured-clean: json (default) or xml. |
| model | string | Cleaner model (default gemini-2.5-flash) — see the table below. |
| target_model | string | Where the cleaned prompt will be used — tunes token math and the $-saved estimate. |
| concise | boolean | Appends a directive so the target AI answers concisely. Not applied to structured-clean. |
Cleaner models & credits
| Model id | Name | Tier | Credits / clean (paid) |
|---|---|---|---|
| gemini-3.5-flash | Gemini 3.5 Flash | Standard | 1 |
| gemini-2.5-flashdefault | Gemini 2.5 Flash | Standard | 1 |
| mistral-large-latest | Mistral Large 3 | Standard | 1 |
| open-mixtral-8x22b | Mixtral 8x22B | Standard | 1 |
| ministral-8b-latest | Ministral 8B | Standard | 1 |
| ministral-14b-latest | Ministral 14B | Standard | 1 |
| sarvam-30b | Sarvam 30B | Standard | 1 |
| llama-3.3-70b-versatile | Llama 3.3 70B | Standard | 1 |
Latency note: gemini-3.5-flash currently responds noticeably slower (~10s+) than the other cleaners — its internal reasoning can’t be fully disabled yet. For latency-sensitive use (the hotkey, agent loops), prefer the default gemini-2.5-flash or llama-3.3-70b-versatile.
Limits & pricing
- Free accounts: 100 cleans per rolling 24 hours — one shared pool across the pre-cleaner hotkey, REST API, and MCP (they all use the same key). Separate from your 4 web-playground cleans. 2,000 chars per prompt, standard models.
- Paid API usage — credit packs: buy API credits in packs of 50–250 (no subscription needed, they never expire, 250 balance cap) — 1 credit per standard clean, 3 per premium; no daily cap; 10,000 chars per prompt. Buy credits.
- Separate from the app: the $7.99/mo Pro subscription covers the web playground only — its monthly credits don’t apply here, and API credits don’t work in the playground.
- Rate limit: 10 requests/min free, 30/min with API credits (per account).