← Blog
AI & LLM·2 TEMMUZ 2026JUL 2, 2026·7 DK OKUMA7 MIN READ

LLM maliyet mühendisliği: token bütçeleri, cache ve model routingLLM cost engineering: token budgets, caching and model routing

LLM faturası bir doğa olayı değil, mühendislik çıktısıdır. Paranın çoğu modelin zekâsına değil, her istekte yeniden gönderilen bağlama, sessiz retry'lara ve basit işler yapan pahalı modellere gider. Reçete üç mekanizma: sabit önekli prompt cache, ucuzdan pahalıya model routing ve özellik başına token bütçesi. Doğru kurulduğunda fatura sürpriz olmaktan çıkar, birim maliyete dönüşür.

An LLM bill isn't weather — it's an engineering output. Most of the money goes not to model intelligence but to context resent on every request, silent retries, and expensive models doing simple work. The recipe is three mechanisms: prompt caching on a stable prefix, cheap-first model routing, and per-feature token budgets. Set up right, the invoice stops being a surprise and becomes a unit cost.

Naylalabs · MühendislikEngineering

01Para gerçekte nereye gidiyorWhere the money actually goes

Üretimdeki bir yapay zekâ özelliğinin faturasını kalem kalem açtığımızda tablo genellikle aynıdır: maliyetin büyük kısmı modelin ürettiği cevaptan değil, ona tekrar tekrar gönderilen girdiden gelir.

Open up the line items of an AI feature in production and the picture is usually the same: most of the cost comes not from the answers the model produces, but from the input you send it again and again.

LLM maliyeti bir fiyat sorunu değil, mimari sorunudur.
LLM cost isn't a pricing problem. It's an architecture problem.

02Prompt cache: önek disipliniPrompt caching: prefix discipline

Prompt cache tek kurala dayanır: önek eşleşmesi. Sağlayıcı, isteğin başından itibaren byte byte aynı olan bölümü cache'ten okur; öneğin herhangi bir yerindeki tek bir değişiklik, o noktadan sonraki her şeyi geçersiz kılar. Bu yüzden cache bir parametre değil, bir sıralama disiplinidir.

Prompt caching rests on one rule: prefix matching. The provider serves from cache whatever is byte-for-byte identical from the start of the request; a single change anywhere in the prefix invalidates everything after it. Which is why caching is a matter of ordering discipline, not a parameter.

03Model routing ve bağlam diyetiModel routing and the context diet

Her isteğin en güçlü modeli hak ettiği varsayımı, faturadaki en pahalı varsayımdır. Routing'in kuralı basit: önce küçük ve ucuz model; belirli sinyallerde yükselt. Bu kaliteden feragat değildir — doğru işi doğru kapasiteye vermektir.

The assumption that every request deserves the strongest model is the most expensive assumption on the bill. The routing rule is simple: cheap and small first; escalate on signals.

04Bütçeler ve birim ekonomiBudgets and unit economics

Aylık fatura bir yönetim aracı değildir; çok geç gelir ve hangi özelliğin yaktığını söylemez. Doğru birim, istek / kullanıcı / özellik başına maliyettir. Her LLM özelliğine kendi token bütçesini verin ve eşiğe alarm bağlayın — kesinti değil, uyarı: önce görün, sonra karar verin. Bütçe aşımı çoğu zaman bir hata değil, keşfedilmemiş bir bağlam sızıntısıdır.

The monthly invoice is not a management tool; it arrives too late and doesn't say which feature is burning. The right unit is cost per request / user / feature. Give every LLM feature its own token budget and wire an alert to the threshold — an alert, not a cutoff: see it first, then decide.

maliyet.yaml — taslak / sketch
# özellik başına / per feature
feature: "destek-cevap / support-answer"
route:
  default: small          # sınıflandır, çıkar, özetle / classify, extract, summarize
  escalate_if: [low_confidence, multi_step, critical_flow]
budget:
  per_request_tokens: 8000
  alert_at: "80%"        # kesme değil, uyarı / alert, don't cut
cache_prefix: [system, tools]  # değişkenler sona / volatile goes last
batch_lane: [gecelik_ozet, reindex]

Son kalem, zamana toleranslı işler: gecelik özetler, yeniden indeksleme, toplu etiketleme gerçek zamanlı hattan çıkıp batch/async hatta gider. Sağlayıcılar batch işleri belirgin indirimle fiyatlar; kullanıcı beklemiyorsa siz de tam tarife ödemeyin.

The last item is latency-tolerant work: nightly summaries, reindexing and bulk labeling move off the real-time path into a batch/async lane. Providers price batch work at a significant discount; if no user is waiting, don't pay the full rate either.

Kısa liste. Kuruluma giderken: sabit önek + cache ✓ · küçük model önce, sinyalle yükseltme ✓ · özellik başına token bütçesi ve alarm ✓ · istek başına maliyet metriği ✓ · batch hattı ✓. Bu beşi varsa fatura sürpriz değil, tasarım kararıdır.Before go-live: stable prefix + cache ✓ · small model first, escalate on signals ✓ · per-feature token budget with alerts ✓ · cost-per-request metric ✓ · a batch lane ✓. With these five, the bill is a design decision, not a surprise.
LLM CostPrompt CachingModel RoutingToken Budget