Does Unlid support prompt caching, and how are cached tokens billed?
Yes, on models that list a cached-input price. Caching is automatic: you send nothing special, and when the start of a request (system prompt, tool definitions, earlier messages) repeats a recent request, the repeated part is billed at the cheaper cached-input price instead of the normal input price.
How it is billed
Each request costs (prompt − cached) × input + cached × cached input + completion × output, using the token counts the inference host reports. The cached count is in the response's usage.prompt_tokens_details.cached_tokens. A model without a cached-input price bills every prompt token at the input price.
Models with a cached-input price
How to get more cache hits
- Keep the beginning of the request identical between calls: same system prompt, same tool list in the same order, and only append new messages at the end.
- Put anything that changes per request (dates, user names, retrieved documents) after the stable part.
- Anthropic-style
cache_controlmarkers are accepted and ignored: caching does not depend on them.
Cache hits depend on the inference host keeping the prefix warm, so they are likely for an active agent session and not guaranteed for a request after a long pause.
Related questions
- Which uncensored models support tool calling (function calling)?
- Which payment methods does Unlid accept, and what is the minimum top-up?
Something not covered? Ask in the support chat at the bottom right, or see the FAQ and the API docs.