프롬프트 캐싱 절감액

Prompt caching savings

같은 접두어를 반복 읽을 때 일반 입력과 캐시 쓰기·읽기 비용의 차이를 계산합니다.

···
html
<div class="comparison caching"><header><b>REPEATED PREFIX · CACHE</b><span>200k tokens · one write</span></header><div class="controls"><label>Repeat reads <output id="repeat-label">4</output><input id="repeats" type="range" min="1" max="20" step="1" value="4" aria-label="Repeated cache reads"></label></div><div class="rows"><div class="row"><b>Claude Sonnet 5.5</b><div class="track"><i id="base-a"></i><i id="cache-a" class="overlay"></i></div><output id="saved-a"></output></div><div class="row"><b>gpt-6.1-sol</b><div class="track"><i id="base-b"></i><i id="cache-b" class="overlay"></i></div><output id="saved-b"></output></div><div class="row"><b>Groq gpt-oss-120b</b><div class="track"><i id="base-c"></i><i id="cache-c" class="overlay"></i></div><output id="saved-c"></output></div></div><p class="fine"><span class="key-base">■</span> no cache · <span class="key-cache">■</span> cached cost · labels show savings. Assumes every read hits in one cache window; output unchanged.<br>2026-10-06 공식 가격 기준 · 단순화(세금·지역 할증 제외)</p></div>
css
.comparison{width:min(96vw,850px);height:min(94vh,350px);padding:clamp(7px,1.8vmin,16px);border:1px solid var(--line);border-radius:14px;background:var(--surface);display:flex;flex-direction:column;gap:clamp(3px,1vmin,8px);font:600 clamp(9px,2vmin,13px)/1.1 system-ui,sans-serif}.comparison header{display:flex;justify-content:space-between;gap:5px}.comparison header b{color:var(--accent);font-size:clamp(11px,2.6vmin,17px)}.comparison header span,.comparison .fine{color:var(--muted)}.comparison .controls{display:flex;gap:8px}.comparison label{flex:1;display:flex;justify-content:space-between;flex-wrap:wrap;gap:2px}.comparison input{width:100%;margin:0;accent-color:var(--accent);height:13px}.comparison .rows{display:flex;flex-direction:column;justify-content:center;gap:clamp(4px,1.2vmin,9px);flex:1;min-height:0}.comparison .row{display:grid;grid-template-columns:clamp(65px,21vw,155px) 1fr clamp(40px,12vw,75px);align-items:center;gap:5px}.comparison .row b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.comparison .track{height:clamp(12px,3.2vmin,23px);border:1px solid var(--line);border-radius:4px;background:var(--bg);overflow:hidden;position:relative}.comparison .track i{display:block;height:100%;width:0;background:var(--accent);transition:width .35s}.comparison .track i.alt{background:var(--accent-2)}.comparison .track i.warm{background:var(--accent-3)}.comparison .row output{text-align:right;white-space:nowrap}.comparison .fine{font-size:clamp(8px,1.5vmin,11px);line-height:1.1;margin:0}.caching .track i{position:absolute;left:0;top:0;background:color-mix(in srgb,var(--accent-3) 55%,var(--surface))}.caching .track i.overlay{background:var(--accent-2);height:58%;top:42%}.key-base{color:var(--accent-3)}.key-cache{color:var(--accent-2)}@media (min-width:600px){.price-card,.price-scene,.limit-card,.compute-card,.credit-card,.plan-card,.credit-ledger,.claude-card,.comparison{width:min(96vw,1080px);font-size:15px}.fine,.note,.comparison .fine{font-size:11px}.comparison header b{font-size:18px}}
js
const slider=document.getElementById('repeats');let timer;let n=0;function draw(){const reads=Number(slider.value),prefix=.2;document.getElementById('repeat-label').textContent=String(reads);const rates=[[2,2.5,.2],[2,2.5,.1],[.15,.15,.075]];const base=rates.map(r=>(reads+1)*prefix*r[0]);const cached=rates.map(r=>prefix*r[1]+reads*prefix*r[2]);['a','b','c'].forEach((id,i)=>{document.getElementById('base-'+id).style.width=(base[i]/8.4*100)+'%';document.getElementById('cache-'+id).style.width=(cached[i]/8.4*100)+'%';document.getElementById('saved-'+id).textContent='−$'+(base[i]-cached[i]).toFixed(2)})}draw();timer=setInterval(()=>{n=(n+1)%4;slider.value=String([2,5,10,18][n]);draw()},1100);slider.addEventListener('input',()=>{clearInterval(timer);draw()})

긴 시스템 프롬프트나 문서를 여러 요청이 공유하면 접두어를 캐시해 다시 읽을 수 있습니다. 절감액은 캐시 쓰기 비용을 먼저 내고 낮은 읽기 단가로 몇 번 재사용하느냐에 달렸습니다.

2026-10 기준 100만 입력 토큰당 Claude Sonnet 5.5는 일반 $2·5분 캐시 쓰기 $2.50·읽기 $0.20, gpt-6.1-sol은 일반 $2·캐시 쓰기 $2.50·읽기 $0.10, Groq gpt-oss-120b는 일반 $0.15·자동 캐시 쓰기 추가 비용 없음·적중 입력 $0.075입니다. 데모는 접두어 20만 토큰을 한 번 쓰고 같은 캐시 기간 안에서 모두 적중한다고 가정합니다.

실제 적중에는 모델별 최소 접두어·캐시 유지 시간·요청 라우팅 조건이 있습니다. 캐시가 빗나가면 일반 입력 요금으로 돌아가므로 예상 적중률로 다시 계산해야 합니다.

언제 쓰나

동일한 긴 접두어를 여러 요청에서 재사용할 때 씁니다. 반복이 적으면 캐시 쓰기 비용 때문에 절감액이 작거나 음수가 될 수 있습니다.

페이지로 열기 ↗