3.3 Capacity Planning, Latency SLAs & Cost Architecture
Key Takeaways
Size peak API-call rate and uncached input and actual output throughput; model fan-out, retries, burst and ramp limits matter independently of the daily mean.
Use bounded queues, deadlines, jittered retries only for transient failures, circuit breakers and tested graceful degradation.
Never force a single heavyweight Opus multi-agent architecture onto both sub-500 ms p95 autocomplete paths and 30-second async research workflows
Stream responses to minimize Time-to-First-Token (TTFT) for human readers, but buffer output whenever strict JSON Schema validation or DLP checks must succeed before client emission
Evaluate model selection, caching with model-specific rates, eligible asynchronous batches, relevant context, and output budgets; validate quality and deadline tradeoffs.
Capacity Planning, Latency SLAs & Cost Architecture
Even a well-secured Claude architecture fails in production if traffic spikes exhaust rate limits, retry storms compound transient throttling, or a heavyweight model stack blows past latency budgets and unit-cost targets.
Peak vs. Average Capacity Sizing
Enterprise AI traffic is rarely smooth. A system averaging 30 requests per minute across 24 hours could surge to 300 RPM during 9:00 AM regional logins, market opens, or scheduled batch triggers—a 10x peak-to-average ratio. Furthermore, a hypothetical workflow with one initial model call and four subsequent client-tool-result rounds uses five model calls per user request. Several tools can be requested in one model response.
For the direct Messages API, plan for these three distinct quota dimensions by model class, plus organization/workspace caps and ramp limits:
- RPM (Requests Per Minute): Total model API calls per minute, including multi-turn agent sub-calls and retry overhead.
- ITPM (Input Tokens Per Minute): On the Claude Messages API, uncached input tokens and cache writes count toward the default ITPM limit; cache-read tokens do not. Other surfaces can count differently, so check the specific model and API. Total context size is a separate constraint.
- OTPM (Output Tokens Per Minute): Actual generated output tokens per minute, including applicable thinking tokens. The direct Messages API counts actual output as it is generated, not the requested max_tokens cap.
Worked Capacity Calculation
Suppose an internal legal assistant peaks at 120 user queries per minute at 9:00 AM, averaging 2.5 model calls per query, 8,000 uncached input tokens, and 900 generated output tokens per call, before retries:
- Peak RPM:
120 x 2.5 = 300 RPM - Peak ITPM:
300 x 8,000 = 2,400,000 ITPM - Peak OTPM:
300 x 900 = 270,000 OTPM - With 30% burst headroom: Provision for 390 RPM, 3.12M ITPM, and 351K OTPM.
Had the team sized for the 24-hour average of 15 user queries per minute (37.5 RPM), the 37.5 RPM quota would be insufficient for the 300 RPM peak. Use observed peak token mix, burst variation, concurrency and the configured limits to determine actual headroom.
Queueing, Backpressure & Graceful Degradation
When downstream inference returns HTTP 429 (Rate Limit) or 529 (Overloaded), uncoordinated retries can amplify a short disruption into a much longer outage. Not every 429 is transient: a spend-cap error requires different handling, and rapidly ramping usage can be limited even below steady-state quotas.
- Bounded Queues & Load Shedding: Cap internal queue depth and maximum wait duration. When queue delay threatens the remaining SLA budget, shed or defer lower-priority requests according to policy, for example with HTTP
503and aRetry-Afterheader rather than holding dead connections. - Per-Call and End-to-End Timeouts: Enforce strict per-call HTTP timeouts (e.g., 15 seconds), per-tool execution timeouts (e.g., 5 seconds), and an overarching request deadline (e.g., 30 seconds). Propagate cancellation tokens down to abort orphaned tool or model calls.
- Jittered Exponential Backoff & Circuit Breakers: Never retry
429/529responses immediately in tight loops (retry storms). HonorRetry-After, apply exponential backoff with full jitter, cap interactive retries according to the remaining deadline (for example, one or two retries), and open a circuit breaker when error rates breach threshold. - Graceful Degradation: Under sustained saturation, pause background enrichment jobs, route non-critical classification to a tested compatible model where quality, security, residency and budget policies allow, or serve cached/deterministic responses instead of failing the primary user workflow.
Multi-Journey SLA Allocation & Streaming Trade-Offs
Architectural anti-pattern: Forcing a single heavyweight Claude Opus multi-agent stack onto every product experience. Different user journeys demand different patterns. The table lists illustrative business targets and candidate designs, not measured Claude performance guarantees:
| User Journey | Target Latency SLA | Recommended Model & Pattern | Delivery Mode |
|---|---|---|---|
| Inline Search / IDE Autocomplete | Sub-500 ms p95 end-to-end | Deterministic retrieval/autocomplete or fast model candidate; compact prompt, no tool loop | Streaming tokens immediately |
| Customer Support Copilot | Sub-2.5 s TTFT; under 8 s total | Benchmarked model, prompt-cached policy docs where supported, bounded tool lookups | Streaming text after tool phase |
| Deep Regulatory / Financial Research | 30 s – 120 s async job | Higher-reasoning candidate, bounded workflow if evaluation justifies it | Buffered + schema/DLP validated |
Streaming vs. Buffered Output
- Streaming (SSE) lets the client receive generated output before the entire response completes; it improves time to visible output relative to buffering, keeping interactive chat and drafting responsive while full generation completes.
- Buffered output (or a validated incremental delivery mechanism) is needed whenever downstream consumers require strict JSON Schema parsing, deterministic DLP/PII redaction, or compliance policy checks before any byte renders to the user. If every byte requires approval first, do not send unchecked tokens to the client.
Five Cost Architecture Levers
Production unit economics depend on intentional design, not negotiating token rates after launch:
- Model Tiering: Route high-volume triage, entity extraction, and guardrails to faster, lower-cost tiers (Haiku or Sonnet), using higher-capability models when measured quality or complexity justifies the cost; high-stakes cases may require human review, not just a larger model.
- Prompt Caching: Place static system instructions, large MCP tool definitions, and shared policy manuals in the stable prompt prefix. With eligible identical prefixes and a cache breakpoint, hits reduce prefix charges at the model-specific cache-read rate and can reduce processing time. Account for writes, TTL, and uncached content.
- Batch API (50% Discount): Offload non-interactive workloads—nightly catalog enrichment, bulk compliance scanning, and offline eval suites—to the asynchronous Batch API for a 50% discount on input and output token rates. Batch requests can expire after 24 hours if unfinished; no shorter completion SLA is guaranteed. Check eligibility (including data retention) and separate batch quotas.
- Context Trimming & Compaction: Summarize aged conversation turns, truncate verbose raw tool outputs (returning only matched snippets rather than 40 KB logs), and inject only task-relevant MCP tool schemas.
- Strict
max_tokensCaps & Output Discipline: Configure appropriatemax_tokensceilings per route and design compact JSON keys rather than paying output-token prices for conversational filler when downstream code parses structured fields. Validate that the output budget does not truncate required responses; actual output tokens, not the cap, determine OTPM usage.
Worked Cost Impact
Consider a hypothetical overnight batch job scoring 400,000 approved non-sensitive support records with an 8,000-token rubric prefix, 1,500 transcript tokens, and 300 output tokens. Moving from synchronous on-demand inference to the Batch API halves base input and output rates. Without caching, the job uses 400,000 × 9,500 = 3.8 billion input tokens and 400,000 × 300 = 120 million output tokens. At illustrative rates of $2 per million input and $10 per million output tokens, on-demand inference costs $8,800; batch pricing costs $4,400, excluding other charges. Caching can further reduce spend, but batch cache hits are best-effort. Split into batches within the 100,000-request and 256 MB size limits, monitor expiry and throughput, and leave time for retries. If the overnight deadline is binding, prove completion with measured capacity or use a different plan.
Official references
An internal knowledge portal averages 40 RPM over 24 hours, so engineering provisions 50 RPM quota and deploys unbounded in-memory queues with immediate retry loops. Every Monday at 9:00 AM, traffic spikes to 380 RPM, triggering 429 throttling and a 25-minute cascading outage. Which architectural change directly resolves both capacity and stability?
Size quotas for peak RPM, ITPM, and OTPM concurrency with headroom, and add bounded queues, jittered exponential backoff, and circuit breakers
Increase the client HTTP timeout from 15 seconds to 120 seconds so immediate retries have more time to succeed
Switch from buffered responses to SSE streaming without changing quota sizing or retry behavior
Add a second system prompt instructing the model to generate shorter responses on Monday mornings
A SaaS company runs one Opus multi-agent workflow (averaging 6.5 seconds) for both inline search-bar autocomplete (requiring sub-500 ms p95) and an asynchronous quarterly compliance report generator (45-second SLA). Search-bar abandonment spikes to 70%. How should the architect redesign the system?
Enable extended thinking on the Opus agent for autocomplete so answers become more accurate
Switch the quarterly compliance report to the Batch API while keeping Opus multi-agent loops on the search bar
Separate journey-specific workloads: benchmark a fast, compact, non-agent autocomplete path (including deterministic alternatives) and reserve deeper reasoning for reports where measured benefit and latency justify it.
Replace both paths with headless Claude Code containers behind an application load balancer
A healthcare billing portal streams raw model tokens directly to patient browsers to minimize Time-to-First-Token, but an audit discovers that partial unredacted insurance IDs occasionally appear on screen before post-generation filters catch them. What delivery change is required?
Increase max_tokens so the model finishes generating faster
Buffer the output through Output Guardrails and DLP/schema validation before sending the response to the client
Move the static system prompt to the end of the message array to improve streaming order
Retry any 429 response immediately without backoff to reduce partial frames
An e-commerce platform processes non-sensitive catalog enrichment jobs asynchronously, with a flexible deadline that accommodates batch expiry and retry handling. Each item has the same 10,000-token taxonomy prefix. Which combination should the team evaluate to reduce model charges while preserving validated output quality?
Enabling cross-region inference and removing max_tokens limits
Replacing structured JSON outputs with multi-paragraph prose explanations
Switching from buffered validation to client-side SSE streaming
Use the Message Batches API where eligible, cache the identical taxonomy prefix, and set a tested output cap sufficient for the required content.
Sections you finish are checked off in the contents.