Prism · Model Routing & Cost Accounting Blueprint
Layered gateway reference for multi-model routing, prompt cache accounting, and transparent per-feature token budgeting.
Problem Solved
Disparate model pricing and context sizes quickly obscure inference budgets without unified routing and token accounting.
Design Approach
Group single-turn and multi-step calls by task, track each token charge separately, and reconcile usage with the bill.
Model cost accounting for a knowledge assistant
An internal knowledge assistant is expected to handle 50,000 tasks a month. The team plans to support single-turn Q&A and multi-step tasks that retrieve information and verify a result. A single average for both workflows would make budget overruns hard to trace.
I would give every business task an ID and attach the generation after retrieval, follow-up calls, and fallbacks to it. Usage records would include the feature, model, input tokens, cache reads, output tokens, and outcome. Estimate each feature separately before aggregating the monthly budget.
Start with a single-turn baseline. At the site’s demonstration rates, 50,000 tasks cost $302.50/month. With a zero cache hit rate, the estimate rises to $362.50/month. The $60 difference follows from those assumptions. At launch, compare the provider’s reported cache reads with the actual bill.
Before routing simple questions to a smaller model, replay the same de-identified questions and compare answer accuracy, whether citations support the answer, fallback frequency, and cost per task. Increase the routing share only after quality meets the agreed standard.
Interactive System Architecture Diagram
Click diagram nodes or tabs below to inspect each module.
Connected Tools, Products & Articles
AI Cost Calculator
Real-time client-side estimator comparing token budgets, prompt cache savings, and monthly LLM spend across tiers.
How to Estimate LLM API Calling Costs
Reproduce a 50,000-task monthly estimate in the calculator, separating regular input, cache reads, and output.