<leantokn>

API Reference

One endpoint. Stable contract.

Authentication

Authorization: Bearer ltk_...

Generate keys in the dashboard. All keys begin with ltk_.

POST /v1/trim

curl -X POST https://api.leantokn.com/v1/trim \
  -H "Authorization: Bearer ltk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"<h1>Hello</h1><p>World</p>","type":"html"}'

Parameters

inputstringRequired. The content to trim.
typestringRequired. "html" "prompt"
intensitystringOnly applies to type "prompt". Ignored otherwise.

Response

{
  "result":  "...",
  "type":    "html",
  "stats": {
    "input_tokens":    12847,
    "output_tokens":   1923,
    "tokens_saved":    10924,
    "savings_percent": 85,
    "duration_ms":     12
  }
}

Errors

400unsupported_typetype is not one of the supported values
400invalid_requestmissing/invalid prompt or type, bad JSON, or invalid intensity
401invalid_api_keymissing, malformed, or revoked API key
413payload_too_largeprompt exceeds 5 MB
500internal_errorunexpected server error

Rate limit: 10 req/min on free tier. Exceeded → 429 with Retry-After.