Reference
Save tokens
Every token you don't send is credit you keep. A few habits cut spend without hurting output quality.
Right-size the model
Bigger isn't always better. Send model: "auto" and let Anajak Lab route to the smallest model that can nail the task, or pin a lighter model (claude-haiku-4-5, gpt-5.4-mini) for classification, extraction, and short replies. Reserve the top models for hard reasoning.
Cap the output
Output tokens usually cost more than input. Set max_tokens to the smallest value that fits the answer — the model stops early instead of rambling:
{
"model": "auto",
"max_tokens": 512,
"messages": [{ "role": "user", "content": "Summarize in one line." }]
}Trim the context
- Keep prompts lean. Drop boilerplate and redundant history; send only what the model needs for this turn.
- Summarize long threads. Replace old turns with a short running summary instead of resending the full transcript every request.
- Avoid restating instructions. One clear system message beats repeating rules in every user message.
Stream long responses
Set "stream": true to render tokens as they arrive. It doesn't lower the token count, but it lets you stop generation early once you have what you need — which does.
Watch your usage
Check remaining credit any time with GET /v1/usage. Poll it in dashboards or before large batch jobs so you never hit 402 quota_exhausted mid-run:
curl https://api.anajaklabs.dev/v1/usage \
-H "Authorization: Bearer sk-xxxxxxxxxxxx"