Get startedAPI referenceGoing to productionExplore models

Routing & reliability

Prompt caching

Prompt caching depends on the selected model and provider. Repeated prompts do not guarantee a cache hit, and cache read and cache write tokens can have different prices.

Design reusable prefixes

Place stable system instructions, tool definitions, and reference material before changing user content. Keep ordering consistent and check the selected model documentation for cache requirements.

Read the usage breakdown

Chat Completions
{
  "usage": {
    "prompt_tokens": 1200,
    "completion_tokens": 80,
    "total_tokens": 1280,
    "prompt_tokens_details": {
      "cached_tokens": 1024
    }
  }
}

Inspect response usage and the console usage ledger. Token counts in this example are illustrative. Cache availability, token reporting, and retention vary by route; a price of zero alone does not prove cache support.

Copied