Guide · Cost
Lower LLM API Costs with Caching, Batch Jobs, and Output Caps
Start with a week of representative requests grouped by product workflow: support classification, document extraction, coding assistance, research, or content generation. Record input, cached input, output, retries, tool calls, model, latency, and whether the result passed review.
Evidence key: Observed — the revision date the editorial source publishes for this article.
Source: ModelScale guide /articles/reduce-llm-api-costs-caching-batch-output-limits (reviewed 2026-09-17). Provider links in the reference should be checked before purchase.
1. Build a cost baseline by workload
Calculate cost per successful task. Unit prices alone cannot reveal that a smaller model retries twice or that a verbose workflow adds expensive output no user reads. Keep interactive and offline workloads separate because their latency requirements lead to different optimizations.
- Choose three to five high-volume workflows.
- Capture at least a representative sample for each model and route.
- Mark success using a test, reviewer decision, or product outcome.
- Rank opportunities by total monthly cost, not by the largest percentage discount.
2. Move non-urgent work to batch processing
OpenAI and Anthropic publish discounted batch processing for work that does not need an immediate response. Good candidates include nightly classification, evaluation runs, catalog enrichment, and document backfills. User-facing chat, live coding, and synchronous validation usually belong on real-time endpoints.
Design batch jobs to be restartable. Store a stable request ID, validate outputs before publishing them, and retry only failed items. A discount disappears quickly if a malformed batch must be rerun in full.
- Batch only workloads that can tolerate the documented completion window.
- Split very large jobs into auditable chunks.
- Validate schemas and model availability before upload.
- Reconcile batch output IDs to the original records before downstream use.
Official references OpenAI Batch API ↗ Anthropic pricing and batch discount ↗
3. Cache repeated context—after measuring reuse
Prompt caching is valuable when a large, stable prefix appears across many requests: a system policy, tool schema, codebase briefing, or reference document. Put stable material first and changing user input later so the provider has a reusable prefix. Then monitor cache reads and the effective cost per request.