Skip to content

Split View: LLM API 비용을 실제로 줄이는 법 — "캐싱 90% 할인"이 청구서에서는 왜 25%인가

|

LLM API 비용을 실제로 줄이는 법 — "캐싱 90% 할인"이 청구서에서는 왜 25%인가

들어가며 — 할인율은 청구서 절감률이 아니다

"프롬프트 캐싱을 켜면 90% 싸진다"는 문장은 LLM 비용 글의 단골입니다. 절반만 맞습니다. 캐시 읽기 단가가 기본 입력 단가의 10분의 1인 건 사실이지만, 그건 캐시 읽기라는 한 줄 항목의 할인율입니다. 청구서 전체가 그만큼 줄어들려면 당신이 쓰는 돈 전부가 캐시 가능한 입력 토큰이어야 합니다. 실제로는 그렇지 않습니다.

먼저 답부터 말하겠습니다. 할인은 그 항목이 청구서에서 차지하는 비중만큼만 총액을 줄입니다. Anthropic이 자기 가격 문서에 직접 올려 둔 계산 예제를 보면, Claude Opus 4.8로 입력 5만 토큰 · 출력 1만 5천 토큰을 쓰는 1시간짜리 세션의 비용은 0.705달러입니다. 여기서 입력 5만 중 4만 토큰이 캐시 읽기로 바뀌면 총액은 0.525달러가 됩니다. 입력 비용은 0.25달러에서 0.07달러로 72% 깎였는데, 총액은 25.5%만 줄었습니다. 출력 토큰이 이미 비용의 대부분을 먹고 있었기 때문입니다.

그래서 이 글은 할인율을 나열하지 않습니다. 대신 청구서를 계산합니다. 캐싱이 왜 작동하는지(트랜스포머 내부의 KV 캐시 이야기)는 LLM 캐싱의 원리 편에서, 서빙 엔진이 이걸 어떻게 굴리는지는 Prefill·Decode 분리와 goodput 편에서 이미 다뤘습니다. 여기서는 철저히 API를 사다 쓰는 쪽의 경제학만 봅니다.

이 글의 숫자에 대하여 — 가격은 자주 바뀝니다

LLM 비용 글이 빠르게 썩는 이유는 가격이 자주 바뀌기 때문입니다. 그래서 규칙을 먼저 못 박겠습니다.

  • 이 글의 모든 가격은 2026년 7월 17일에 각 공급자의 공식 가격표 페이지에서 직접 가져왔습니다. 2차 출처, 요약, 기억에서 가져온 숫자는 하나도 없습니다.
  • 가격은 예고 없이 바뀝니다. 이 글에도 그 증거가 있습니다 — Claude Sonnet 5의 도입 가격은 2026년 8월 31일까지만 유효하고 9월 1일부터 오릅니다. OpenAI의 캐시 쓰기 요금은 GPT-5.6 세대에서 새로 생겼습니다(그 이전 모델은 무료였습니다). 둘 다 "예전에 맞던 문장"이 지금은 틀린 사례입니다.
  • 당신이 이 글을 읽는 시점에 이 숫자들이 여전히 맞는지는 보장할 수 없습니다. 결제에 영향을 주는 결정을 내리기 전에 반드시 각 공급자 가격표를 직접 여십시오. 링크는 맨 아래 참고 자료에 있습니다.

바뀌지 않는 건 가격이 아니라 계산 구조입니다. 이 글이 실제로 가르치려는 건 그 구조입니다.

내 청구서는 어디서 나오는가 — 출력 토큰이 지배한다

무엇을 최적화할지 정하기 전에, 돈이 어디로 새는지부터 봐야 합니다. LLM API 청구서는 거의 항상 세 항목으로 쪼개집니다 — 캐시되지 않은 입력, 캐시 읽기, 그리고 출력.

여기서 대부분의 사람이 놓치는 사실이 있습니다. 출력 토큰 단가는 입력 단가의 몇 배입니다. 2026년 7월 17일 기준 Anthropic 가격표에서 가져온 숫자입니다.

모델                    입력(100만 토큰당)   출력(100만 토큰당)   출력/입력 배수
Claude Opus 4.8             5달러              25달러              5배
Claude Sonnet 5 (도입가)     2달러              10달러              5배
Claude Haiku 4.5            1달러               5달러              5배
Claude Fable 5             10달러              50달러              5배

Claude 계열은 일관되게 5배입니다. OpenAI 쪽은 배수가 더 큽니다 — 2026년 7월 17일 기준 가격표에서 gpt-5.6-sol은 짧은 컨텍스트 기준 입력 5달러 / 출력 30달러로 6배, gpt-5.6-luna는 1달러 / 6달러로 역시 6배입니다.

이게 왜 중요한가. Anthropic 문서의 계산 예제를 그대로 가져오면 이렇습니다(Opus 4.8, 입력 5만 · 출력 1만 5천 토큰).

항목        토큰 수     비중        비용        비용 비중
입력        50,000     76.9%     0.25달러      40%
출력        15,000     23.1%     0.375달러     60%
합계        65,000                0.625달러

출력은 토큰 개수로는 23.1%에 불과한데, 비용으로는 60%를 차지합니다. 토큰 수를 보고 "입력이 문제네"라고 판단하면 정확히 거꾸로 짚는 겁니다.

그래서 첫 번째 실천 규칙은 최적화가 아니라 측정입니다. Anthropic API는 응답의 usageinput_tokens, output_tokens, cache_creation_input_tokens, cache_read_input_tokens를 돌려주고, OpenAI는 cached_tokens(캐시 읽기)와 GPT-5.6 이후 세대에서 cache_write_tokens(캐시 쓰기)를 돌려줍니다. 이 네 숫자에 각각 단가를 곱해 항목별 금액을 뽑기 전까지는, 어떤 최적화도 추측입니다.

프롬프트 캐싱은 실제로 얼마를 줄이는가

이제 서두의 계산을 끝까지 해 봅시다. Anthropic 가격 문서의 Managed Agents 항목에는 캐싱 전후를 나란히 놓은 표가 있습니다. 아래는 그 문서의 숫자를 그대로 옮기고, 검산한 것입니다.

[캐싱 없음] Opus 4.8, 입력 5만 / 출력 1만 5천, 1시간 세션
  입력       50,000 x 5달러  / 100만 = 0.25달러
  출력       15,000 x 25달러 / 100만 = 0.375달러
  세션 런타임 1.0시간 x 0.08달러       = 0.08달러
  합계                                = 0.705달러

[캐싱 적용] 입력 5만 중 4만이 캐시 읽기
  미캐시 입력 10,000 x 5달러 / 100만       = 0.05달러
  캐시 읽기   40,000 x 5달러 x 0.1 / 100만 = 0.02달러
  출력       15,000 x 25달러 / 100만       = 0.375달러
  세션 런타임 1.0시간 x 0.08달러            = 0.08달러
  합계                                     = 0.525달러

절감액 = 0.705 - 0.525 = 0.18달러
절감률 = 0.18 / 0.705 = 25.5%

캐시 읽기 단가는 분명히 기본 입력의 10%(즉 "90% 할인")입니다. 그런데 총액은 25.5%만 줄었습니다.

세 가지를 짚어야 합니다.

첫째, 세션 런타임 0.08달러는 Managed Agents 전용 항목입니다. 일반 Messages API에는 이 줄이 없습니다. 그러니 토큰 비용만 따로 떼서 보면 0.625달러에서 0.445달러로, 절감률은 28.8%입니다. 어느 쪽으로 계산하든 90%와는 거리가 멉니다.

둘째, 이 예제는 캐시가 이미 데워진 상태를 가정합니다. 캐시 쓰기 비용이 계산에 없습니다. 첫 요청에서는 쓰기 요금을 더 내므로 실제 첫 호출은 오히려 비쌉니다. 이 손익분기는 바로 다음 절에서 계산합니다.

셋째, 그리고 이게 진짜 결론인데 — 캐싱 후 출력이 토큰 비용에서 차지하는 비중은 0.375 / 0.445 = 84.3%로 올라갑니다. 캐싱은 입력 항목을 지워서 출력의 지배력을 오히려 더 키웁니다. 캐싱을 제대로 켠 순간, 다음 레버는 무조건 출력입니다.

캐싱은 몇 번 읽어야 본전인가

캐싱이 공짜가 아닌 이유는 쓰기 요금 때문입니다. 2026년 7월 17일 기준, Anthropic 문서가 밝힌 배수는 기본 입력 단가 대비 이렇습니다.

캐시 작업            배수              유효 기간
5분 캐시 쓰기     기본 입력의 1.25배     5분
1시간 캐시 쓰기    기본 입력의 2배       1시간
캐시 읽기(히트)    기본 입력의 0.1배     직전 쓰기와 동일

같은 프리픽스를 N번 보낸다고 할 때, 캐시 없이 내는 돈은 N(기본 입력 단가를 1로 둔 상대값)이고, 캐시를 쓰면 쓰기 1회 + 읽기 (N-1)회입니다. 계산해 보면 이렇습니다.

5분 캐시 (쓰기 1.25배)
  N=1: 캐시 없음 1.00  vs  캐시 1.25          -> 캐시가 손해
  N=2: 캐시 없음 2.00  vs  1.25 + 0.10 = 1.35 -> 캐시가 이득
1시간 캐시 (쓰기 2배)
  N=2: 캐시 없음 2.00  vs  2.00 + 0.10 = 2.10 -> 아직 손해
  N=3: 캐시 없음 3.00  vs  2.00 + 0.20 = 2.20 -> 캐시가 이득

즉 5분 캐시는 읽기 1회부터, 1시간 캐시는 읽기 2회부터 본전을 넘습니다. Anthropic 문서가 말하는 손익분기와 정확히 일치하고, 위 산식으로 직접 검산됩니다.

실무적으로 중요한 건 이 지점입니다. 5분 안에 같은 프리픽스가 두 번 이상 오지 않는 트래픽이라면 캐싱은 비용을 늘립니다. 하루에 몇 번 들어오는 저빈도 엔드포인트에 캐싱을 켜 두고 "왜 안 싸지지?"라고 묻는 경우가 여기에 해당합니다. 다만 Anthropic은 5분 캐시의 경우 캐시가 사용될 때마다 추가 비용 없이 유효 기간이 갱신된다고 밝히고 있어서, 트래픽이 꾸준히 흐르는 동안은 5분이 계속 연장됩니다.

OpenAI 쪽은 세대에 따라 규칙이 다릅니다. OpenAI 문서에 따르면 GPT-5.6 이전 모델은 캐시 쓰기에 추가 요금이 없고, GPT-5.6 세대부터는 캐시 쓰기가 미캐시 입력 단가의 1.25배입니다. "OpenAI는 캐시 쓰기가 공짜"라는 오래된 상식이 최신 세대에서 깨진 겁니다. 캐시 읽기는 gpt-5.6-sol 기준 입력 5달러 대비 0.5달러로 정확히 10%입니다. 결과적으로 최신 세대에서는 두 회사의 캐시 가격 구조(쓰기 1.25배 / 읽기 0.1배)가 사실상 같아졌습니다.

캐싱이 아예 안 걸리는 경우

가장 허무한 실패는 캐싱을 켰는데 아무 일도 일어나지 않는 경우입니다. 프롬프트가 최소 길이에 못 미치면 캐시가 그냥 안 걸립니다.

Anthropic 문서 기준(2026년 7월 17일), Claude API에서 최소 캐시 가능 프롬프트 길이는 모델마다 다릅니다.

Claude Fable 5, Mythos 5                       512 토큰
Claude Mythos Preview, Opus 4.7              2,048 토큰
Claude Opus 4.6, Opus 4.5                    4,096 토큰
Claude Haiku 4.5                             4,096 토큰
Claude Opus 4.8, Sonnet 5, Sonnet 4.6,
  Sonnet 4.5                                 1,024 토큰

문서는 여기에 결정적인 단서를 붙입니다 — 최소 길이에 못 미치는 프롬프트는 cache_control을 붙여도 캐싱 없이 처리되며, 오류가 나지 않습니다. 조용히 실패한다는 뜻입니다. 캐시가 걸렸는지 확인하려면 응답의 cache_creation_input_tokenscache_read_input_tokens를 보고, 둘 다 0이면 안 걸린 겁니다.

주의할 점이 하나 더 있습니다. 이 최소값은 플랫폼마다 다를 수 있습니다. Anthropic 문서는 Amazon Bedrock에서 Fable 5와 Mythos 5의 최소 길이가 1,024 토큰이라고 따로 명시합니다. Bedrock의 모델별 최소값·실패 동작·필드 이름은 AWS 문서를 봐야 합니다.

OpenAI는 구조가 더 단순합니다 — 문서상 1,024 토큰 이상인 프롬프트에 자동으로 캐싱이 적용되고, 캐시 히트는 정확한 프리픽스 일치에서만 발생합니다. 1,024 토큰 미만 요청은 cached_tokens가 0으로 나옵니다.

여기서 두 회사가 공통으로 강조하는 설계 규칙이 나옵니다. 고정된 내용(시스템 프롬프트, 예시, 도구 정의)을 앞에, 변하는 내용(사용자 입력)을 뒤에 두십시오. 캐시는 프리픽스 일치로만 걸리므로, 맨 앞에 타임스탬프 한 줄을 넣는 순간 그 뒤 전부가 캐시에서 빠집니다. 이미지와 도구 정의도 요청 간에 동일해야 합니다.

Batch API의 50%는 진짜인가

진짜입니다. 그리고 세 공급자 모두 같은 숫자입니다. 2026년 7월 17일 기준으로 각 회사 문서에서 확인한 내용입니다.

  • Anthropic: Message Batches API는 "모든 사용량이 표준 API 가격의 50%로 과금"됩니다. 입력과 출력 양쪽 다입니다.
  • OpenAI: Batch API는 동기 API 대비 "50% 비용 할인"입니다. 가격표에서 gpt-5.6-sol 짧은 컨텍스트 기준 입력 5달러 → 2.5달러, 출력 30달러 → 15달러로 검산됩니다.
  • Google: Vertex AI 가격 페이지는 "Gemini 모델은 배치 모드에서 50% 할인"이라고 명시하고, Gemini 3.1 Pro Preview 기준 입력 2달러 → 1달러, 출력 12달러 → 6달러로 검산됩니다.

캐싱과 달리 배치 할인은 입력과 출력 양쪽에 다 걸립니다. 그래서 출력이 지배하는 청구서에서는 배치가 캐싱보다 총액을 크게 줄입니다. 앞의 Opus 4.8 예제(토큰 비용 0.625달러)를 배치로 돌리면 0.3125달러로 정확히 절반이 됩니다. 캐싱의 28.8%와 비교해 보십시오.

물론 공짜는 아닙니다. 대가는 시간과 확실성입니다.

Anthropic: 문서는 "대부분의 배치가 1시간 안에 완료된다"고 하면서도, 결과는 "모든 메시지가 완료됐을 때 또는 24시간 후 중 먼저 오는 시점"에 접근할 수 있고 24시간 안에 처리가 끝나지 않으면 배치가 만료된다고 명시합니다. 중요한 단서가 붙어 있습니다 — 수요와 요청량에 따라 처리가 느려질 수 있고, 그 경우 24시간 후 만료되는 요청이 더 많아질 수 있습니다. 다만 만료된 요청은 과금되지 않습니다.

OpenAI: 완료 창(completion_window)은 현재 24h만 설정 가능하고, 배치 상태에 expired("24시간 창 안에 완료하지 못함")가 존재합니다.

정리하면 배치는 "50% 할인"이 아니라 "50% 할인 + 24시간 만료 리스크"라는 패키지입니다. 사용자가 기다리는 요청에는 못 씁니다. 야간 리포트 생성, 문서 일괄 분류, 임베딩 재색인, 평가셋 돌리기 — 이런 작업에는 거의 언제나 이득입니다.

배치를 못 쓰는 워크로드라면 — Flex

여기에 잘 알려지지 않은 선택지가 하나 있습니다. OpenAI의 Flex 처리는 동기 호출인데 배치 가격을 받습니다. OpenAI 문서의 표현 그대로, Flex의 토큰은 "Batch API 요율로 과금"되며 프롬프트 캐싱 할인이 추가로 붙습니다. 가격표에서도 gpt-5.6-sol의 Flex 요율(입력 2.5달러 / 출력 15달러)은 Batch 요율과 완전히 동일합니다.

24시간짜리 배치 파일 워크플로를 만들지 않고 service_tierflex로 주기만 하면 되므로, 배치로 옮기기 애매한 비대화형 작업에 잘 맞습니다.

대가는 명확히 문서화돼 있습니다. Flex는 "더 느린 응답 시간과 간헐적인 리소스 부족"을 감수하는 대신 싼 것이고, 현재 베타이며 지원 모델이 제한적입니다. 리소스가 부족하면 429 Resource Unavailable이 돌아오는데, 문서는 이 경우 과금되지 않는다고 명시합니다. SDK 기본 타임아웃이 10분이라 긴 작업에서는 타임아웃을 늘려야 하고, OpenAI는 실패 시 지수 백오프로 재시도하거나 service_tierauto로 바꿔 표준 처리로 재시도하는 두 가지 전략을 제시합니다.

한 줄 요약: 비대화형인데 24시간은 못 기다리는 작업이면 Flex가 정확히 그 틈을 메웁니다.

싼 모델로 바꾸면 그만큼 싸지는가 — 토크나이저 함정

모델 라우팅의 논리는 단순합니다. 쉬운 요청은 싼 모델로, 어려운 요청만 비싼 모델로. 가격 사다리는 2026년 7월 17일 기준 이렇습니다.

Anthropic (100만 토큰당, 입력 / 출력)
  Claude Fable 5              10달러 / 50달러
  Claude Opus 4.8              5달러 / 25달러
  Claude Sonnet 5 (도입가)      2달러 / 10달러   <- 2026-08-31까지
  Claude Sonnet 5 (9/1부터)     3달러 / 15달러
  Claude Haiku 4.5             1달러 /  5달러

OpenAI (100만 토큰당, 짧은 컨텍스트 기준, 입력 / 출력)
  gpt-5.6-sol                  5달러 / 30달러
  gpt-5.6-terra              2.5달러 / 15달러
  gpt-5.6-luna                 1달러 /  6달러

Haiku 4.5(1달러/5달러)와 Opus 4.8(5달러/25달러)은 정확히 5배 차이입니다. 쉬운 요청의 80%를 Haiku로 내리면 그만큼 큰 절감이 나옵니다 — 라우팅이 실제로 값을 하는 이유입니다.

그런데 여기 함정이 있습니다. per-token 가격은 토크나이저가 같을 때만 비교 가능합니다. Anthropic 가격 문서에는 이런 각주가 붙어 있습니다 — Claude Opus 4.7 이후 Opus 모델, Fable 5, Mythos 5, Mythos Preview, Sonnet 5는 새 토크나이저를 쓰며, 이 토크나이저는 같은 텍스트에 대해 약 30% 더 많은 토큰을 만듭니다. (문서는 "정확한 증가폭은 콘텐츠와 워크로드 형태에 따라 다르다"고 덧붙입니다. Sonnet 4.6과 그 이전 모델은 이전 토크나이저를 씁니다.)

이게 가격 비교를 어떻게 뒤집는지 계산해 봅시다. 문서의 "약 30%"를 그대로 1.3배로 놓고, 같은 텍스트 T를 처리한다고 하면.

Sonnet 4.6 (3달러, 구 토크나이저) vs Sonnet 5 도입가 (2달러, 신 토크나이저)
  단순 단가 비교:  (3-2)/3           = 33.3% 저렴
  같은 텍스트 기준: 3T vs 2 x 1.3T = 2.6T
                  (3-2.6)/3         = 13.3% 저렴   <- 실제

Sonnet 5가 9월 1일 3달러로 오르면
  같은 텍스트 기준: 3T vs 3 x 1.3T = 3.9T
                  -> Sonnet 4.6보다 30% 더 비쌈

Opus 4.1 (15달러, 구) vs Opus 4.8 (5달러, 신)
  단순 단가 비교:  (15-5)/15         = 66.7% 저렴
  같은 텍스트 기준: 15T vs 5 x 1.3T = 6.5T
                  (15-6.5)/15       = 56.7% 저렴  <- 실제

정직하게 덧붙여야 할 것들이 있습니다. 이 계산은 입력 텍스트가 동일하다는 가정 위의 산수이지 벤치마크가 아닙니다. Anthropic 문서는 새 토크나이저가 "광범위한 작업에서 향상된 성능에 기여한다"고 설명하므로, 토큰이 늘어난 만큼 그냥 손해라고 읽으면 안 됩니다. 더 좋은 모델은 같은 일을 더 짧은 출력으로 끝낼 수도 있고, 재시도가 줄 수도 있습니다. 그리고 "약 30%"는 영어 기준 근사치일 가능성이 높습니다 — 한국어처럼 토큰화 특성이 다른 언어에서 실제로 몇 %인지는 공개된 수치가 없습니다. 당신의 실제 프롬프트를 각 모델의 토큰 카운팅 API에 넣어 직접 세어 보는 것 말고는 방법이 없습니다.

여기서 나오는 규칙은 이겁니다. 모델을 바꿀 때는 단가표가 아니라 "내 실제 프롬프트의 토큰 수 x 단가"를 비교하십시오. 세대가 다른 모델 사이에서 단가만 비교하는 건 단위가 다른 두 수를 빼는 것과 같습니다.

롱 컨텍스트 할증 — 아무도 예산에 안 넣는 것

컨텍스트를 길게 쓰면 토큰이 늘어나서 비싸진다는 건 다 압니다. 그런데 공급자에 따라 단가 자체가 올라간다는 건 훨씬 덜 알려져 있습니다. 여기서 세 회사가 갈립니다. 각 숫자는 해당 회사 자신의 가격표에서 가져온 것입니다(2026년 7월 17일 기준).

OpenAI 가격표는 gpt-5.6 계열의 요율을 "Short context"와 "Long context" 두 벌로 나눠 싣습니다.

gpt-5.6-sol    짧은 컨텍스트  5달러 / 30달러
               긴 컨텍스트   10달러 / 45달러    -> 입력 2배, 출력 1.5배
gpt-5.6-terra  짧은 컨텍스트  2.5달러 / 15달러
               긴 컨텍스트    5달러 / 22.5달러  -> 입력 2배, 출력 1.5배
gpt-5.6-luna   짧은 컨텍스트  1달러 / 6달러
               긴 컨텍스트    2달러 / 9달러     -> 입력 2배, 출력 1.5배

세 모델 모두 정확히 입력 2배, 출력 1.5배입니다. 다만 gpt-5.6 계열에서 "긴 컨텍스트"가 몇 토큰부터인지는 가격표 페이지에 나와 있지 않습니다. 같은 페이지가 구세대 모델 행에는 gpt-5.5 (<272K context length)처럼 경계를 표기하는데, gpt-5.6 계열에는 그 표기가 없습니다. 그래서 여기서 임계값을 지어내지 않겠습니다 — 반드시 직접 확인하십시오.

Google의 Vertex AI 가격 페이지는 임계값을 명시합니다. Gemini 3.1 Pro Preview는 입력 2달러 / 출력 12달러인데, 200K 입력 토큰을 넘으면 4달러 / 18달러가 됩니다(역시 입력 2배, 출력 1.5배). 그리고 이 페이지의 각주에는 아플 수 있는 문장이 하나 있습니다 — 쿼리 입력 컨텍스트가 200K 토큰을 넘으면 입력과 출력을 포함한 모든 토큰이 롱 컨텍스트 요율로 과금됩니다. 임계값을 1토큰 넘기면 그 요청 전체의 단가가 바뀐다는 뜻입니다.

Anthropic은 반대로 갑니다. 가격 문서는 Fable 5, Mythos 5, Mythos Preview, Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 5, Sonnet 4.6이 100만 토큰 컨텍스트 전체를 표준 가격에 포함한다고 명시하고, 괄호로 못을 박습니다 — "90만 토큰 요청은 9천 토큰 요청과 동일한 토큰당 요율로 과금됩니다." 프롬프트 캐싱과 배치 할인도 전체 컨텍스트 구간에 표준 요율로 적용됩니다.

이건 벤치마크 비교가 아니라 가격 구조의 비교입니다. 세 회사의 성능을 견주는 공통 벤치마크는 여기 없고, 각자 자기 가격표에서 가져온 과금 규칙만 나란히 둔 것입니다. 실무적 함의는 분명합니다. RAG처럼 컨텍스트가 들쭉날쭉한 워크로드라면, 임계값을 넘나드는 요청이 예산을 조용히 무너뜨릴 수 있습니다. 임계값이 있는 공급자에서는 컨텍스트 길이 분포를 모니터링하고, 임계값 바로 아래로 자르는 것만으로 큰 절감이 나오기도 합니다.

가장 큰 레버는 출력 토큰이다

앞의 계산이 계속 같은 곳을 가리켰습니다. 출력은 단가가 5~6배이고, 캐싱을 켜면 토큰 비용의 84%까지 올라갑니다. 그런데 출력은 대부분의 비용 글에서 맨 마지막에 한 문단으로 다뤄집니다. 순서가 거꾸로입니다.

출력 토큰을 줄이는 방법은 재미없을 만큼 단순합니다.

  • max_tokens를 실제 필요한 값으로 설정하십시오. 상한선이지 목표치가 아니지만, 폭주를 막는 마지막 방어선입니다.
  • 출력 형식을 강제하십시오. 분류 작업에서 레이블 하나만 필요한데 모델이 세 문단의 설명을 붙이고 있다면, 그 설명 전부가 5배 단가로 청구됩니다. 구조화된 출력(JSON 스키마)은 정확도 도구이기 전에 비용 도구입니다.
  • "단계별로 설명해 줘"의 가격을 인지하십시오. 추론 과정을 길게 뽑는 프롬프트는 그만큼 출력 토큰을 씁니다. 최종 답만 필요한 자동화 파이프라인에서는 그냥 낭비입니다. (참고로 Google의 Vertex 가격표는 출력 항목을 아예 "Text output (response and reasoning)"이라고 적어 둡니다 — 추론 토큰도 출력으로 과금된다는 뜻입니다.)
  • 재시도를 세십시오. 실패한 호출도 생성된 출력 토큰만큼 돈이 나갑니다. 파싱 실패로 3번 재시도하는 파이프라인은 출력 비용이 4배입니다.

입력 쪽에도 공짜 절감이 하나 있습니다. Anthropic 가격 문서는 도구 사용 시 자동으로 붙는 시스템 프롬프트의 토큰 수를 모델별로 공개합니다 — Opus 4.8은 auto/none 기준 290 토큰, Opus 4.7은 675 토큰입니다. 여기에 도구 정의 자체의 토큰이 더해집니다(예: bash 도구는 Opus 4.7·4.8에서 325 토큰). 안 쓰는 도구를 매 요청에 실어 보내고 있다면 그건 매번 내는 세금입니다. 도구 정의는 프리픽스 앞쪽에 있으므로 캐싱으로 덮을 수 있다는 점도 같이 기억하십시오.

그래서 무엇부터 해야 하는가

순서가 있습니다. 위에서부터 하십시오.

1단계 — 계산부터. 최근 하루치 usage 필드를 긁어서 항목별(미캐시 입력 / 캐시 읽기 / 캐시 쓰기 / 출력) 금액을 뽑으십시오. 출력이 60% 이상이면 캐싱 튜닝은 우선순위가 아닙니다.

2단계 — 배치나 Flex로 옮길 수 있는 트래픽을 찾으십시오. 사용자가 실시간으로 기다리지 않는 요청이 있다면 입력·출력 양쪽에 50%가 걸립니다. 단일 레버로는 가장 큽니다. 24시간을 기다릴 수 있으면 Batch, 아니면 (OpenAI에서) Flex.

3단계 — 출력을 조이십시오. 형식 강제, max_tokens, 불필요한 추론 제거, 재시도 감소. 단가 5~6배 항목이라 효과가 그대로 곱해집니다.

4단계 — 그 다음에 캐싱. 5분 안에 같은 프리픽스가 2회 이상 재사용되는 트래픽에만 켜십시오. 고정 자산을 앞에, 변동 데이터를 뒤에. 최소 토큰 수를 넘겼는지 usage 필드로 확인하십시오(조용히 실패합니다).

5단계 — 라우팅. 쉬운 요청을 싼 모델로 내리되, 반드시 "내 프롬프트의 실제 토큰 수 x 단가"로 비교하십시오. 세대가 다르면 단가표 비교는 무의미합니다.

6단계 — 컨텍스트 길이 분포를 보십시오. 임계값이 있는 공급자를 쓴다면 롱 컨텍스트 할증이 예산을 갉아먹고 있을 수 있습니다.

언제 이걸 하지 말아야 하는가

정직해질 부분입니다. 이 글의 대부분은 당신에게 필요 없을 수도 있습니다.

  • 청구서가 월 몇십 달러라면 아무것도 하지 마십시오. 캐시 브레이크포인트를 설계하고 배치 파이프라인을 만드는 엔지니어 시간이 절감액보다 훨씬 비쌉니다. LLM 비용 최적화는 청구서가 엔지니어 인건비와 같은 자릿수가 됐을 때 시작하는 일입니다.
  • 트래픽이 저빈도면 캐싱은 손해입니다. 앞의 손익분기 계산이 그대로 답입니다.
  • 품질이 아직 안 잡혔으면 라우팅하지 마십시오. 싼 모델로 내렸다가 정확도가 떨어져 재시도·사람 개입이 늘면 총비용은 오히려 오릅니다. 평가셋 없이 하는 라우팅은 비용 최적화가 아니라 품질 도박입니다.
  • 사용자가 기다리는 경로에 배치를 쓰지 마십시오. 당연해 보이지만, "50%"라는 숫자에 홀려 대화형 엔드포인트를 배치로 옮기려는 시도를 실제로 봅니다.
  • 캐싱과 배치를 겹쳐 쓸 때는 곱해집니다. Anthropic 문서는 캐싱 배수가 배치 할인을 포함한 다른 가격 수정자와 "곱해서 적용된다(stack)"고 명시합니다. 좋은 소식이지만, 그래서 예상 비용 계산이 헷갈립니다 — 단순히 90%와 50%를 더해서 140% 할인이 되지 않습니다. 반대로 Fast mode는 배치와 함께 쓸 수 없고, Managed Agents 세션에는 배치 할인·Fast mode·데이터 레지던시 배수가 적용되지 않습니다.

마치며

한 문장으로 줄이면 이렇습니다. 할인율은 그 항목이 청구서에서 차지하는 비중만큼만 총액을 줄입니다.

캐시 읽기가 입력 단가의 10%인 건 사실입니다. 그리고 그게 총액을 25.5%밖에 못 줄이는 것도 — Anthropic 자신의 계산 예제에서 — 사실입니다. 둘은 모순이 아닙니다. 출력 토큰이 이미 비용의 60%를 먹고 있었을 뿐입니다. 이 구조를 이해하면 "90% 절감" 같은 제목에 더 이상 흔들리지 않게 됩니다. 그런 제목은 항목의 할인율을 청구서의 절감률인 것처럼 쓴 겁니다.

그러니 순서는 언제나 같습니다 — 청구서를 항목별로 쪼개고, 가장 큰 항목부터 건드리고, 각 레버의 대가(24시간 만료, 리소스 부족, 캐시 쓰기 요금, 품질 저하)를 명시적으로 계산하십시오. 그리고 이 글의 숫자를 포함해 모든 가격은 오늘(2026년 7월 17일) 기준이며 자주 바뀝니다. 아래 링크를 열어 직접 확인하는 것으로 시작하십시오. 바뀌지 않는 건 가격이 아니라 산수입니다.

참고 자료

How to Actually Cut Your LLM API Bill — Why "90% Off From Caching" Is 25% on the Invoice

Introduction — A Discount Rate Is Not an Invoice Cut

"Turn on prompt caching and you save 90%" is a staple of LLM cost articles. It is half true. It is a fact that a cache read costs one-tenth of the base input price — but that is the discount on a single line item, the cache read. For the whole invoice to drop by that much, every dollar you spend would have to be cacheable input tokens. In reality it is not.

Let me give the answer first. A discount reduces the total only in proportion to that line item's share of the invoice. In the worked example Anthropic itself publishes in its pricing docs, a one-hour session on Claude Opus 4.8 using 50,000 input tokens and 15,000 output tokens costs $0.705. If 40,000 of those 50,000 input tokens turn into cache reads, the total becomes $0.525. The input cost is cut 72%, from $0.25 to $0.07 — but the total drops only 25.5%. That is because output tokens were already eating most of the cost.

So this post does not list discount rates. It computes the invoice instead. Why caching works in the first place (the KV-cache story inside the transformer) is already covered in How LLM Caching Works, and how the serving engine actually runs it is covered in Prefill/Decode Disaggregation and Goodput. Here we look strictly at the economics of buying the API from the outside.

About the Numbers in This Post — Prices Change Often

LLM cost articles rot fast because prices change often. So let me nail down the ground rules first.

  • Every price in this post was pulled directly from each provider's official pricing page on July 17, 2026. Not a single number comes from a secondary source, a summary, or memory.
  • Prices change without notice. This post even contains the evidence — Claude Sonnet 5's introductory price is valid only through August 31, 2026, and rises on September 1. OpenAI's cache-write charge is new in the GPT-5.6 generation (earlier models were free). Both are cases where "a sentence that used to be correct" is now wrong.
  • I cannot guarantee these numbers are still correct at the moment you read this. Before making any decision that affects your bill, open each provider's price sheet yourself. The links are in the references at the bottom.

What does not change is not the prices but the structure of the arithmetic. That structure is what this post is really trying to teach.

Where Your Invoice Comes From — Output Tokens Dominate

Before deciding what to optimize, you have to see where the money is leaking. An LLM API invoice almost always breaks into three line items — uncached input, cache reads, and output.

Here is the fact most people miss. The output token price is several times the input price. These numbers come from Anthropic's price sheet as of July 17, 2026.

Model                     Input (per 1M)   Output (per 1M)   Output/Input
Claude Opus 4.8           $5               $25               5x
Claude Sonnet 5 (intro)   $2               $10               5x
Claude Haiku 4.5          $1               $5                5x
Claude Fable 5            $10              $50               5x

The Claude family is a consistent 5x. On the OpenAI side the multiple is larger — on the price sheet as of July 17, 2026, gpt-5.6-sol is $5 input / $30 output at short context, a 6x ratio, and gpt-5.6-luna is $1 / $6, again 6x.

Why does this matter? Take the worked example from Anthropic's docs verbatim (Opus 4.8, 50,000 input and 15,000 output tokens).

Line item   Tokens    Share    Cost      Cost share
Input       50,000    76.9%    $0.25     40%
Output      15,000    23.1%    $0.375    60%
Total       65,000             $0.625

Output is only 23.1% of the tokens but 60% of the cost. If you look at the token counts and conclude "input is the problem," you have it exactly backwards.

So the first practical rule is not optimization but measurement. The Anthropic API returns input_tokens, output_tokens, cache_creation_input_tokens, and cache_read_input_tokens in the response usage, and OpenAI returns cached_tokens (cache reads) and, from the GPT-5.6 generation on, cache_write_tokens (cache writes). Until you multiply each of these four numbers by its unit price to get a per-line-item amount, every optimization is a guess.

How Much Does Prompt Caching Actually Save?

Now let us finish the calculation from the opening. The Managed Agents section of Anthropic's pricing docs has a table placing before-and-after caching side by side. Below I transcribe that document's numbers and check the arithmetic.

[No caching] Opus 4.8, 50K input / 15K output, 1-hour session
  Input            50,000 x $5  / 1M = $0.25
  Output           15,000 x $25 / 1M = $0.375
  Session runtime  1.0 hr x $0.08     = $0.08
  Total                               = $0.705

[With caching] 40K of the 50K input is cache reads
  Uncached input  10,000 x $5 / 1M        = $0.05
  Cache reads     40,000 x $5 x 0.1 / 1M  = $0.02
  Output          15,000 x $25 / 1M       = $0.375
  Session runtime  1.0 hr x $0.08         = $0.08
  Total                                   = $0.525

Savings      = 0.705 - 0.525 = $0.18
Savings rate = 0.18 / 0.705 = 25.5%

The cache-read price is plainly 10% of the base input (i.e. "90% off"). And yet the total dropped only 25.5%.

Three things are worth pointing out.

First, the $0.08 session runtime is a Managed Agents-only line item. The plain Messages API does not have this row. So if you isolate the token cost alone, it goes from $0.625 to $0.445, a 28.8% cut. Either way, it is nowhere near 90%.

Second, this example assumes the cache is already warm. There is no cache-write cost in the calculation. On the first request you pay the write charge on top, so the actual first call is more expensive. We compute that break-even in the very next section.

Third — and this is the real conclusion — after caching, output's share of the token cost climbs to 0.375 / 0.445 = 84.3%. By erasing the input line item, caching actually increases output's dominance. The moment you turn caching on properly, the next lever is always output.

How Many Reads Until Caching Pays Off?

Caching is not free because of the write charge. As of July 17, 2026, the multipliers Anthropic's docs state, relative to the base input price, are these.

Cache operation      Multiplier         Lifetime
5-min cache write    1.25x base input   5 min
1-hour cache write   2x base input      1 hour
Cache read (hit)     0.1x base input    same as the preceding write

Say you send the same prefix N times. Without caching you pay N (a relative value setting the base input price to 1); with caching you pay 1 write + (N-1) reads. Working it out.

5-min cache (write 1.25x)
  N=1: no cache 1.00  vs  cache 1.25          -> cache loses
  N=2: no cache 2.00  vs  1.25 + 0.10 = 1.35  -> cache wins
1-hour cache (write 2x)
  N=2: no cache 2.00  vs  2.00 + 0.10 = 2.10  -> still a loss
  N=3: no cache 3.00  vs  2.00 + 0.20 = 2.20  -> cache wins

In other words, the 5-minute cache clears break-even from the first read, and the 1-hour cache from the second read. This matches exactly the break-even Anthropic's docs state, and it checks out directly with the arithmetic above.

The practically important point is this. If your traffic does not bring the same prefix back at least twice within 5 minutes, caching increases your cost. This is exactly the case of turning caching on for a low-frequency endpoint that gets a few hits a day and then asking "why isn't this getting cheaper?" That said, Anthropic states that for the 5-minute cache the lifetime is refreshed at no extra cost each time the cache is used, so as long as traffic keeps flowing the 5 minutes keep extending.

On the OpenAI side the rules differ by generation. Per OpenAI's docs, models before GPT-5.6 have no extra charge for cache writes, and from the GPT-5.6 generation on a cache write costs 1.25x the uncached input price. The old received wisdom that "OpenAI cache writes are free" breaks in the latest generation. A cache read is $0.5 against gpt-5.6-sol's $5 input — exactly 10%. As a result, in the latest generation the two companies' cache pricing structures (write 1.25x / read 0.1x) have become essentially the same.

When Caching Doesn't Kick In at All

The most deflating failure is turning caching on and having nothing happen at all. If the prompt falls short of the minimum length, the cache simply does not engage.

Per Anthropic's docs (July 17, 2026), the minimum cacheable prompt length in the Claude API varies by model.

Claude Fable 5, Mythos 5                       512 tokens
Claude Mythos Preview, Opus 4.7              2,048 tokens
Claude Opus 4.6, Opus 4.5                    4,096 tokens
Claude Haiku 4.5                             4,096 tokens
Claude Opus 4.8, Sonnet 5, Sonnet 4.6,
  Sonnet 4.5                                 1,024 tokens

The docs attach a crucial caveat here — a prompt below the minimum length is processed without caching even if you attach cache_control, and no error is raised. Meaning it fails silently. To check whether the cache engaged, look at cache_creation_input_tokens and cache_read_input_tokens in the response; if both are 0, it did not.

One more caution. This minimum can differ by platform. Anthropic's docs separately note that on Amazon Bedrock the minimum length for Fable 5 and Mythos 5 is 1,024 tokens. For Bedrock's per-model minimums, failure behavior, and field names, you have to consult the AWS docs.

OpenAI is simpler in structure — per the docs, caching applies automatically to prompts of 1,024 tokens or more, and a cache hit occurs only on an exact prefix match. Requests under 1,024 tokens come back with cached_tokens at 0.

From this comes a design rule both companies emphasize. Put the fixed content (system prompt, examples, tool definitions) first, and the changing content (user input) last. Because the cache engages only on a prefix match, the moment you put a single timestamp line at the very front, everything after it falls out of the cache. Images and tool definitions must be identical across requests too.

Is the Batch API's 50% Real?

It is. And all three providers share the same number. Here is what I confirmed in each company's docs as of July 17, 2026.

  • Anthropic: the Message Batches API bills "all usage at 50% of the standard API price." Both input and output.
  • OpenAI: the Batch API is "a 50% cost discount" versus the synchronous API. On the price sheet this checks out for gpt-5.6-sol at short context — input $5$2.5, output $30$15.
  • Google: the Vertex AI pricing page states "Gemini models get a 50% discount in batch mode," and this checks out for Gemini 3.1 Pro Preview — input $2$1, output $12$6.

Unlike caching, the batch discount applies to both input and output. So on an output-dominated invoice, batch cuts the total far more than caching does. Run the earlier Opus 4.8 example (token cost $0.625) through batch and it becomes $0.3125, exactly half. Compare that with caching's 28.8%.

Of course it is not free. The price is time and certainty.

Anthropic: the docs say "most batches complete within 1 hour," but also that results become accessible "when all messages are complete or after 24 hours, whichever comes first," and specify that a batch expires if processing does not finish within 24 hours. An important caveat is attached — processing can slow depending on demand and request volume, in which case more requests may expire after 24 hours. Expired requests, however, are not billed.

OpenAI: the completion window (completion_window) can currently be set only to 24h, and the batch statuses include expired ("did not complete within the 24-hour window").

In short, batch is not "50% off" but a package of "50% off + 24-hour-expiry risk." You cannot use it for a request a user is waiting on. Nightly report generation, bulk document classification, embedding re-indexing, running an eval set — for work like this it is almost always a win.

For Workloads That Can't Use Batch — Flex

There is a lesser-known option here. OpenAI's Flex processing is a synchronous call at batch prices. In OpenAI's own words, Flex tokens are "billed at the Batch API rate," with the prompt-caching discount applied on top. On the price sheet, too, gpt-5.6-sol's Flex rate (input $2.5 / output $15) is exactly identical to the Batch rate.

Since you just set service_tier to flex instead of building a 24-hour batch-file workflow, it fits non-interactive work that is awkward to move to batch.

The cost is clearly documented. Flex is cheap in exchange for accepting "slower response times and occasional resource unavailability," and it is currently in beta with limited model support. When resources are unavailable you get back 429 Resource Unavailable, and the docs specify that in this case you are not billed. The SDK's default timeout is 10 minutes, so for long jobs you have to raise the timeout, and OpenAI offers two strategies on failure — retry with exponential backoff, or switch service_tier to auto and retry with standard processing.

One-line summary: for non-interactive work that still cannot wait 24 hours, Flex fills exactly that gap.

Does Switching to a Cheaper Model Save That Much? — The Tokenizer Trap

The logic of model routing is simple. Easy requests to a cheap model, only hard requests to an expensive one. The price ladder as of July 17, 2026 is this.

Anthropic (per 1M tokens, input / output)
  Claude Fable 5              $10 / $50
  Claude Opus 4.8              $5 / $25
  Claude Sonnet 5 (intro)      $2 / $10   <- through 2026-08-31
  Claude Sonnet 5 (from 9/1)   $3 / $15
  Claude Haiku 4.5             $1 /  $5

OpenAI (per 1M tokens, short context, input / output)
  gpt-5.6-sol                  $5 / $30
  gpt-5.6-terra              $2.5 / $15
  gpt-5.6-luna                 $1 /  $6

Haiku 4.5 ($1/$5) and Opus 4.8 ($5/$25) are exactly a 5x gap. Push 80% of your easy requests down to Haiku and you get a correspondingly large saving — the reason routing genuinely earns its keep.

But here is the trap. Per-token prices are comparable only when the tokenizer is the same. Anthropic's pricing docs carry this footnote — Opus models from Claude Opus 4.7 on, plus Fable 5, Mythos 5, Mythos Preview, and Sonnet 5, use a new tokenizer, and this tokenizer produces about 30% more tokens for the same text. (The docs add that "the exact increase depends on the content and the shape of the workload." Sonnet 4.6 and earlier models use the previous tokenizer.)

Let us compute how this flips a price comparison. Take the docs' "about 30%" at face value as 1.3x, and suppose you process the same text T.

Sonnet 4.6 ($3, old tokenizer) vs Sonnet 5 intro ($2, new tokenizer)
  Naive per-unit compare: (3-2)/3          = 33.3% cheaper
  Same-text basis:        3T vs 2 x 1.3T = 2.6T
                          (3-2.6)/3        = 13.3% cheaper   <- actual

If Sonnet 5 rises to $3 on September 1
  Same-text basis:        3T vs 3 x 1.3T = 3.9T
                          -> 30% more expensive than Sonnet 4.6

Opus 4.1 ($15, old) vs Opus 4.8 ($5, new)
  Naive per-unit compare: (15-5)/15        = 66.7% cheaper
  Same-text basis:        15T vs 5 x 1.3T = 6.5T
                          (15-6.5)/15      = 56.7% cheaper  <- actual

Some honest caveats belong here. This calculation is arithmetic resting on the assumption that the input text is identical, not a benchmark. Anthropic's docs explain that the new tokenizer "contributes to improved performance across a broad range of tasks," so you should not read the extra tokens as pure loss. A better model may finish the same job with a shorter output, or need fewer retries. And "about 30%" is most likely an English-based approximation — for a language with different tokenization characteristics, like Korean, there is no published figure for what the actual percentage is. There is no way around feeding your real prompts into each model's token-counting API and counting them yourself.

The rule that falls out is this. When switching models, compare not the rate card but "my real prompt's token count x unit price." Comparing unit prices alone across models from different generations is like subtracting two numbers in different units.

The Long-Context Surcharge — What Nobody Budgets For

Everyone knows that a long context costs more because there are more tokens. Far less known is that with some providers the unit price itself goes up. This is where the three companies split. Each figure comes from that company's own price sheet (as of July 17, 2026).

OpenAI's price sheet lists gpt-5.6-family rates in two sets, "Short context" and "Long context."

gpt-5.6-sol    short context   $5 / $30
               long context   $10 / $45     -> input 2x, output 1.5x
gpt-5.6-terra  short context  $2.5 / $15
               long context    $5 / $22.5   -> input 2x, output 1.5x
gpt-5.6-luna   short context   $1 / $6
               long context    $2 / $9      -> input 2x, output 1.5x

All three models are exactly input 2x, output 1.5x. But the price-sheet page does not say from how many tokens "long context" begins for the gpt-5.6 family. The same page marks the boundary on older-generation model rows, as in gpt-5.5 (<272K context length), but there is no such marking for the gpt-5.6 family. So I will not invent a threshold here — check it yourself.

Google's Vertex AI pricing page does state the threshold. Gemini 3.1 Pro Preview is $2 input / $12 output, but past 200K input tokens it becomes $4 / $18 (again input 2x, output 1.5x). And a footnote on this page has a sentence that can hurt — once the query input context exceeds 200K tokens, all tokens, input and output included, are billed at the long-context rate. Meaning if you cross the threshold by a single token, the unit price for that entire request changes.

Anthropic goes the other way. The pricing docs state that Fable 5, Mythos 5, Mythos Preview, Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 5, and Sonnet 4.6 include the full 1M-token context at the standard price, and nail it down in parentheses — "a 900K-token request is billed at the same per-token rate as a 9K-token request." Prompt caching and the batch discount also apply at the standard rate across the entire context range.

This is not a benchmark comparison but a comparison of pricing structures. There is no common benchmark pitting the three companies' performance against each other here — only the billing rules each pulled from its own price sheet, set side by side. The practical implication is clear. On a workload with jagged context lengths, like RAG, requests that cross the threshold can quietly wreck your budget. With a provider that has a threshold, monitoring your context-length distribution — and trimming to just under the threshold — can by itself produce a large saving.

The Biggest Lever Is Output Tokens

The calculations so far kept pointing at the same place. Output is priced 5-6x higher and, once caching is on, climbs to 84% of the token cost. Yet output gets handled in a single paragraph at the very end of most cost articles. The order is backwards.

The ways to cut output tokens are almost boringly simple.

  • Set max_tokens to what you actually need. It is a ceiling, not a target, but it is the last line of defense against a runaway.
  • Force the output format. If a classification task needs a single label but the model is attaching three paragraphs of explanation, all of that explanation is billed at the 5x rate. Structured output (a JSON schema) is a cost tool before it is an accuracy tool.
  • Be aware of the price of "explain step by step." A prompt that draws out a long chain of reasoning spends output tokens to match. In an automation pipeline that needs only the final answer, it is simply waste. (For reference, Google's Vertex price sheet labels the output line item outright as "Text output (response and reasoning)" — meaning reasoning tokens are billed as output too.)
  • Count your retries. A failed call still costs you the output tokens it generated. A pipeline that retries 3 times on a parse failure has 4x the output cost.

There is one free saving on the input side too. Anthropic's pricing docs publish, per model, the token count of the system prompt that is automatically added when you use tools — for Opus 4.8 it is 290 tokens with auto/none, and for Opus 4.7 it is 675 tokens. On top of that come the tokens of the tool definitions themselves (e.g. the bash tool is 325 tokens on Opus 4.7 and 4.8). If you are shipping unused tools on every request, that is a tax you pay every time. Remember too that tool definitions sit near the front of the prefix, so caching can cover them.

So Where Do You Start?

There is an order. Work it from the top.

Step 1 — Calculate first. Scrape a recent day's usage fields and break out the amounts per line item (uncached input / cache reads / cache writes / output). If output is 60% or more, caching tuning is not the priority.

Step 2 — Find traffic you can move to Batch or Flex. If some requests are not being waited on in real time, 50% applies to both input and output. As a single lever, it is the biggest. If you can wait 24 hours, Batch; if not, Flex (on OpenAI).

Step 3 — Tighten output. Force the format, max_tokens, remove unnecessary reasoning, reduce retries. It is a 5-6x-priced line item, so the effect multiplies straight through.

Step 4 — Then caching. Turn it on only for traffic where the same prefix is reused 2 or more times within 5 minutes. Fixed assets first, changing data last. Confirm you cleared the minimum token count with the usage fields (it fails silently).

Step 5 — Routing. Push easy requests down to a cheaper model, but always compare on "my prompt's real token count x unit price." Across generations, comparing rate cards is meaningless.

Step 6 — Look at your context-length distribution. If you use a provider with a threshold, a long-context surcharge may be eating into your budget.

When You Should Not Do Any of This

This is the part to be honest about. Most of this post may not apply to you.

  • If your bill is a few tens of dollars a month, do nothing. The engineering time to design cache breakpoints and build batch pipelines costs far more than the savings. LLM cost optimization is something you start when the bill reaches the same order of magnitude as an engineer's salary.
  • If traffic is low-frequency, caching is a loss. The break-even calculation above is your answer, unchanged.
  • If quality is not nailed down yet, do not route. Push down to a cheap model, accuracy drops, retries and human intervention rise, and total cost goes up instead. Routing without an eval set is not cost optimization but a gamble on quality.
  • Do not use batch on a path a user is waiting on. It sounds obvious, but I do see attempts to move an interactive endpoint to batch, mesmerized by that "50%" number.
  • When you stack caching and batch, they multiply. Anthropic's docs state that the caching multipliers "stack" (apply multiplicatively) with other price modifiers, including the batch discount. That is good news, but it makes estimating costs confusing — you do not simply add 90% and 50% to get 140% off. Conversely, Fast mode cannot be used together with batch, and Managed Agents sessions do not get the batch discount, Fast mode, or the data-residency multiplier.

Closing

Reduced to one sentence: a discount rate reduces the total only in proportion to that line item's share of the invoice.

That a cache read is 10% of the input price is true. And that it cuts the total by only 25.5% — in Anthropic's own worked example — is also true. The two are not a contradiction. Output tokens were simply already eating 60% of the cost. Once you understand this structure, a headline like "90% savings" no longer moves you. Such a headline uses a line item's discount rate as if it were the invoice's reduction rate.

So the order is always the same — break the invoice into line items, touch the biggest item first, and explicitly compute the price of each lever (24-hour expiry, resource unavailability, the cache-write charge, quality degradation). And, including the numbers in this post, every price is as of today (July 17, 2026) and changes often. Start by opening the links below and checking for yourself. What does not change is not the prices but the arithmetic.

References