Token Optimizer
Compress prompts via a plain REST endpoint.
POST /api/v1/compress-prompt compresses a prompt to use fewer tokens while preserving every instruction and constraint, verified against a real tokenizer — not an estimate.
Request
bash
curl -X POST https://cuelara.com/api/v1/compress-prompt \-H "Content-Type: application/json" \-H "Authorization: Bearer YOUR_TOKEN_HERE" \-d '{"text": "Could you please help me write a Python script that...","level": "Aggressive (Max Savings)"}'
The Authorization header is optional — omit it to call anonymously (lower rate limit). Get a token from /dashboard/mcp.
Body
text(string, required) — the prompt to compress.level(string, optional) —"Low (Safest)","Medium (Balanced)"(default), or"Aggressive (Max Savings)".preserveFormatting(string, optional) —"Yes"(default) or"No".
Response
json
{"compressed": "Compress this prompt. Keep all instructions and constraints intact.","originalTokens": 61,"compressedTokens": 12,"savedPercent": 80}
Errors
json
400 invalid body, 401 invalid token, 429 rate limit, 502/503/504 upstream AI failure.
Limits
Anonymous calls share the same free daily limit as the website's Token Optimizer, keyed by IP. Signed-in calls use your own account's plan limits instead. See the API overview for auth and CORS details.