SwiftRelay

← All sprint notes

First Lap: Put a Price on Cached Tokens

Cost per lapEN

A cached token is reused input, not a free answer

When you send a prompt to an AI model, the service processes input tokens: small pieces of text representing your instructions, documents, and conversation. The model then generates output tokens for its answer. Those two categories can have different prices.

Prompt caching adds another billing category. If the service can reuse processing for an eligible portion of your input, those tokens may be billed at a cached-input rate instead of the ordinary input rate. A cached token is therefore worth the difference between those rates, subject to any cache-related charges.

Caching reuses prompt processing, not a saved answer. The model still generates a response to your current request, and output tokens remain billable under the applicable pricing.

Put a price on one repeated document

Imagine a support assistant that receives the same product handbook with every question. The handbook contains 20,000 tokens. A customer question comes after it, so the beginning of the request stays identical while the ending changes.

Use these fictional rates for a simple calculation: ordinary input costs $2 per million tokens, while cached input costs $0.50 per million. These are teaching numbers, not a SwiftRelay price quote.

  • Processing the handbook as ordinary input costs $0.04 per request.
  • Processing the same 20,000 tokens as cached input costs $0.01 per eligible repeat.
  • The saving is $0.03 per cache hit, before any additional cache charges.
  • Across 100 eligible repeats, that difference adds up to $3.

The initial request may be billed differently because it establishes the cache. Some providers charge separately for cache creation or storage. Your new question and the generated answer also cost money, so the figures above describe only the repeated handbook.

Keep the reusable material at the beginning

Many prompt-caching systems work with a matching prefix: an unchanged sequence of tokens at the start of a request. A familiar document appearing somewhere in a prompt does not automatically qualify.

Place stable instructions, reference material, and tool definitions first. Put the changing question afterward. Avoid inserting a fresh timestamp or random identifier before the reusable section, because that can break the match.

Eligibility still depends on the provider and model. Minimum prompt lengths, expiration windows, explicit cache settings, and matching rules can differ. A short repeated greeting may earn no caching discount at all. Changing models also should not be treated as preserving an existing cache.

Read the usage report before counting savings

A request succeeding does not prove that caching happened. Check the usage details exposed by your provider, relay, or client. Look for cached-input or cache-read tokens, plus any cache-write charges. Field names and visibility vary.

Do not assume cached tokens are extra tokens. In some reports, cached tokens are a subset of total input tokens. Adding both figures together would overcount usage. Check the reporting format before building your own cost calculator.

For a useful test, send a realistic request, repeat it with only the final question changed, and inspect both usage records. Compare the actual charge for the full request, including output, rather than multiplying every input token by the cheapest advertised rate.

Make caching part of your first SwiftRelay run

SwiftRelay is a practical option for pay-as-you-go access to multiple model families through one relay, including use with Claude Code, Codex, Gemini CLI, and OpenAI-compatible SDKs. Billing is per token, making request-level usage a useful place to start checking costs.

Sign up for SwiftRelay to use the small gift credit available to new accounts, then test a repeated prompt with your chosen model. Check its current pricing and cache support rather than assuming every model applies the same discount.

The takeaway: a cached token is worth a discount on eligible repeated input, not a discount on your entire conversation. Stable prompts, repeated requests, and verified usage are what turn that discount into real savings.

Keep reading

Back for another lap?Log in