# Cache

How prompt caching works, what it costs, and how to get more cheap tokens.

A long prompt that starts the same way again and again, such as a conversation history or project files in a coding tool, can be read from the provider's cache. Tokens read from cache are billed at the cache price, far below the normal input price.

## Price

Every model has three prices per 1 million tokens: input, cache and output. The cache price is on the Models page in the console and in the price table on the home page. All are in rupiah.

## Seeing cache tokens

| Endpoint | Field in `usage` |
|---|---|
| `/v1/chat/completions` | `prompt_tokens_details.cached_tokens` |
| `/v1/responses` | `input_tokens_details.cached_tokens` |
| `/v1/messages` | `cache_read_input_tokens` (read) and `cache_creation_input_tokens` (write) |

The [Usage](https://sivcloud.com/en/docs/console/usage/) page shows the cache percentage of every request and a chart of cache tokens per day.

## Getting more cache

- Put the fixed part first in the prompt (system instructions, documents) and the changing part last. The cache works on an identical beginning.
- Use one API key per application. Requests from one API key for one model are pinned to one provider while that provider is healthy, 3600 seconds by default, so the same beginning meets the same cache.
- A cache lives for a limited time on the provider's side. A long pause between requests can clear it. A cache hit is more likely when the same prompt beginning is repeated soon after.

## Cache in plans

Each plan allowance decides whether cache tokens count: in full, in part or not at all. See [Plans](https://sivcloud.com/en/docs/console/subscriptions/).
