Skip to content
/
Suscribirse Subscribe

Detrás del telón hay sistemas, no magia. Arquitectura de software, IA y computación de bajo nivel para las trincheras de producción.

Behind the curtain there are systems, not magic. Software architecture, AI, and systems engineering from the production trenches.

Estimate true per-run and monthly LLM API bills (Gemini, Claude, GPT) factoring the output token multiplier, real Prompt / Context Caching savings, and the quadratic context replay tax of multi-turn agent loops.

1,000 tokens ≈ 750 English words
Hidden reasoning tokens bill at output rate
Typically 75%–90% off cached prefix hits
Cost per Workflow
--
--
Monthly Bill (30d)
--
--
Tokens / Workflow
--
--
Output Cost Share
--
--
--

Mathematical Formula: Multi-Turn Replay & Prompt Caching

Stateless LLM HTTP APIs require replaying conversation history on every tool step, turning naive linear budgets into quadratic T input costs:

1) Turn-k input: In_k = S_sys + U_init + (k − 1) × (0.35 × U_init + O_output)
2) Total input over T turns: In_total = Σ_{k=1..T} In_k
3) Discounted cached reads: In_cache = Cacheable_Prefix × (%Hit / 100)
4) Net cost per run: Cost = [(In_total − In_cache) × P_in + In_cache × P_in × (1 − %Disc) + (T × O_output) × P_out] / 10⁶

Public rate-card references: Google Gemini API Pricing and Anthropic Claude Pricing.

Real Impact of Prompt Caching on an 8-Turn Coding Agent

Cache Configuration Prefix Strategy Cost / Run ($3/$15) Monthly Spend (400/day)
0% Cache Hit (unstable prefix) No shared prompt prefix ~$0.51 ~$6,120 / mo
80% Cache Hit (90% read discount) Static tool defs + pinned instructions ~$0.22 ~$2,640 / mo

LLM Token Economics FAQ

Why do "thinking" models inflate bills even when visible answers are short?

Hidden chain-of-thought reasoning tokens are billed at the expensive output rate (3×–8× higher than input tokens), not the input rate.

What silently breaks Prompt Caching in production?

Placing dynamic timestamps, per-request UUIDs, or unsorted JSON tool schemas near the top of your system prompt busts exact prefix matching and forces full-price re-prefill.

When does moving off cloud APIs onto owned GPUs pay off?

Feed your monthly bill estimate directly into our AI API vs. Self-Hosted GPU Calculator or verify model RAM fit in the Local LLM VRAM Calculator.

Suscribirse Subscribe