> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trynito.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt Caching

> Provider cache markers passed through on routes that support them.

A long, stable prefix (a system prompt, a document, a tool set) is processed on every call. Prompt caching lets the provider remember it. On Nito this is a passthrough: you mark cacheable content, Nito preserves the marker on routes that advertise cache support and reports the provider's accounting in `usage`. Nito keeps no cache of its own. On routes without cache support the markers are dropped; explicit cache-retention requests the gateway cannot enforce are rejected.

## Marking Content

Attach `cache_control` to a `text`, image, or file content part. Put stable content first, the variable part last.

```bash wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl https://app.trynito.ai/v1/chat/completions \
  -H "Authorization: Bearer $NITO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "messages": [
      {
        "role": "system",
        "content": [
          {
            "type": "text",
            "text": "You are a support assistant. <long, stable instructions and policy text here>",
            "cache_control": {"type": "ephemeral"}
          }
        ]
      },
      {"role": "user", "content": "How do I reset my password?"}
    ]
  }'
```

`prompt_cache_key` is forwarded as the provider's cache affinity key where the route supports it.

## Accounting

When the provider reports it, cache accounting appears in `usage`, for example `cached_tokens` under the prompt-token details. The first call writes the prefix; later calls that hit it read it at the provider's reduced rate.

## Scope

Nito never returns a stored response for an identical request. Every request runs the model. Deduplicate identical requests in your own application layer.

## Related

<CardGroup cols={3}>
  <Card title="Chat Completions" icon="message" href="/api/features/chat-completions">
    The endpoint.
  </Card>

  <Card title="Safe Retries" icon="rotate" href="/api/features/safe-retries">
    Retry without paying twice.
  </Card>

  <Card title="Cost Control" icon="coins" href="/api/features/best-practices/cost-control">
    Spend guidance.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.