Developers

Beta

Clean prompts programmatically — in your agents, pipelines, and coding tools. Removes filler, hedging, and redundancy while keeping every requirement: same result, fewer input tokens. One REST endpoint, plus a plug-and-play MCP for Claude Code, Cursor, and any MCP-capable agent.

Quickstart

  1. Create a free account (the free tier includes API access).
  2. Generate an API key below — shown once, keep it secret.
  3. Call the API, or connect the MCP to your tool.

API keys are tied to your account. Sign in or create a free account to generate one — the free tier includes API access.

Connect the MCP

Remote MCP over Streamable HTTP at https://aitokencleaner.com/api/mcp — nothing to install. It exposes one tool, clean_prompt, your agent can call before sending long prompts anywhere.

Claude Code

claude mcp add token-cleaner --transport http https://aitokencleaner.com/api/mcp \
  --header "Authorization: Bearer atc_YOUR_KEY"

Cursor / other MCP clients (mcp.json)

{
  "mcpServers": {
    "token-cleaner": {
      "url": "https://aitokencleaner.com/api/mcp",
      "headers": { "Authorization": "Bearer atc_YOUR_KEY" }
    }
  }
}

Tool parameters: text (required), mode, sub_format, model, target_model, concise — same semantics as the REST API below.

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

FieldTypeNotes
promptstringRequired. The prompt to clean (2,000 chars free / 10,000 Pro).
modestringplain-clean (default) · caveman · structured-clean
sub_formatstringFor structured-clean: json (default) or xml.
modelstringCleaner model (default gemini-2.5-flash) — see the table below.
target_modelstringWhere the cleaned prompt will be used — tunes token math and the $-saved estimate.
concisebooleanAppends a directive so the target AI answers concisely (cuts output tokens too). Not applied to structured-clean.

Errors

JSON { error, code } with standard statuses: 400 (validation), 401 (missing_key / invalid_key), 403 (premium_required / insufficient_credits), 422 (moderation_blocked), 429 (rate_limited / daily_limit, with Retry-After), 502 (clean_failed).

Cleaner models & credits

Model idNameTierCredits / clean (Pro)
gemini-2.5-flashdefaultGemini 2.5 FlashStandard1
mistral-large-latestMistral Large 3Standard1
open-mixtral-8x22bMixtral 8x22BStandard1
ministral-8b-latestMinistral 8BStandard1
ministral-14b-latestMinistral 14BStandard1
sarvam-30bSarvam 30BStandard1
llama-3.3-70b-versatileLlama 3.3 70BStandard1

Limits & pricing (beta)

  • Free accounts: 100 API/MCP cleans per rolling 24 hours (separate from your 4 web-playground cleans), 2,000 chars per prompt, standard models.
  • Pro: credit-based — 1 credit per standard clean, 3 per premium; 10,000 chars per prompt; higher rate limits. See plans.
  • Rate limit: 10 requests/min free, 30/min Pro (per key).
  • Beta note: these limits are deliberately generous while the API is in beta — final API pricing is being finalized and will be announced here. $-saved figures use public list prices (June 2026) for the target_model.