LLM Gateway Selection Guide: Model Coverage, Pricing, and Caching
Evaluate a unified model gateway by its capability coverage, pricing structure, caching behavior, and operational reliability—not just its headline rates. This guide explains how to build a capability matrix, estimate usage costs, assess fallback and observability, and validate a gateway before production deployment.
1. The Real Problem: Too Few Options, Not the Wrong Choice
For many teams, the first challenge in model selection is not poor judgment but a limited candidate pool. When the integration layer connects to only one or two providers, selection becomes a choice among a handful of models. Business requirements end up constrained by the available integrations.
Real workloads typically require several capabilities in parallel:
- General reasoning and knowledge Q&A: reliability and instruction following.
- Code generation and completion: long context and repository-level understanding.
- Long-document processing: context-window capacity and retrieval consistency.
- Multimodal understanding: native vision rather than a separate vision pipeline.
- Video and image generation: separate endpoints and billing units.
Each additional provider brings another round of engineering work: account setup and eligibility checks, API keys and authentication, SDK or protocol adaptation, error-code and rate-limit alignment, monitoring, and billing reconciliation. Individually, these tasks may be manageable. Across multiple providers, they become a recurring maintenance burden.
The first priority when evaluating a unified gateway should therefore be model-pool breadth and capability coverage, not price. Coverage determines the upper limit of what the team can support.
2. Turn the Model Pool into a Verifiable Capability Matrix
“Supports many models” is not a useful claim unless it can be verified. Start with a business-defined capability matrix, then compare each requirement against the gateway’s actual callable model catalog.
# capability_matrix.yamlbusiness: order-assistantrequirements:- capability: text_reasoningmin_context: 32kmust_have: [json_mode, function_calling]- capability: code_generationmin_context: 64kmust_have: [repo_level_completion]- capability: long_contextmin_context: 128k- capability: multimodal_ocr # Native vision, not an external pipelinemust_have: [native_vision]- capability: video_generationunit: secondproviders_status:text_reasoning: coveredcode_generation: coveredlong_context: coveredmultimodal_ocr: partial # Requires an external pipelinevideo_generation: gap # Requires a separate integration
The matrix makes hidden costs visible. Every gap or partial can mean an additional integration path, authentication setup, monitoring configuration, and billing-reconciliation process. These costs do not appear on a price sheet, but they continue to consume engineering time.
Add two engineering requirements:
- Protocol consistency: Prefer gateways that expose a unified OpenAI-compatible interface, so application teams can maintain a single client.
- Capability discoverability: The gateway should expose a queryable model catalog and capability tags, rather than requiring teams to synchronize documentation manually.
A basic startup check can block deployment when required capabilities are missing:
# Validate capability coverage at startup; block deployment if anything is missingdef preflight(matrix, catalog):missing = [r for r in matrix.requirementsif r.capability not in catalog.capabilities]if missing:raise RuntimeError(f"Capability gaps: {[m.capability for m in missing]}")
3. Pricing Structure Matters More Than Headline Rates
Price comparisons often focus on a single question: which provider has the lowest unit price? Actual bills depend on the pricing structure, which typically includes four variables.
Official Prices and Channel Discounts
Gateways may price services as the provider’s published rate multiplied by a channel discount factor. The source pricing context includes factors ranging from 0.1 to 0.7—equivalent to paying 10–70% of the published rate—with some arrangements available to smaller customers without large minimum purchases.
Treat these as terms to verify, not as globally available offers. The important question is whether the discount changes with usage tiers, rather than what discount is advertised today.
Peak and Off-Peak Pricing
Some models pass through the provider’s time-of-use pricing, with significantly lower rates during off-peak periods. Batch workloads such as offline summarization, log analysis, and bulk labeling should be scheduled accordingly.
Separate Cache-Hit Pricing
Cached-input prices vary by model, and some models offer configurable cache TTL tiers. Cache-hit input tokens can cost only a few percent of the regular input rate.
For repetitive workloads—fixed system prompts, repeated questions about long documents, or shared RAG prefixes—caching can reduce costs by an order of magnitude.
Different Billing Units
Text is commonly priced per million tokens, video per second, and images per image. Comparing these rates as if they used the same unit produces misleading results.
A reusable cost model is:
Monthly cost = Σ(uncached input tokens × P_in × d+ output tokens × P_out × d)+ Σ(cache-hit tokens × P_cache × d)+ Σ(video seconds × P_sec × d)d = channel discount factorToken rates must be normalized to the same unit as token usage.
The following example uses hypothetical prices solely to illustrate the calculation:
def estimate(monthly, discount=0.4):# monthly: usage dictionary; all prices are hypothetical examplestext = monthly.get("in_tok", 0) * 8 / 1e6 + monthly.get("out_tok", 0) * 24 / 1e6cache = monthly.get("cache_tok", 0) * 0.08 / 1e6video = monthly.get("video_sec", 0) * 0.2return (text + cache + video) * discount
Here, in_tok represents input tokens billed at the regular rate, while cache_tok represents cache-hit tokens billed separately.
For long-document, fixed-prefix, and repetitive batch workloads, cache-hit rate often has a greater effect on the bill than the discount factor itself. During evaluation, confirm:
- Whether caching applies automatically.
- Whether requests require explicit cache markers.
- Whether TTL is configurable.
- Whether cache-hit metrics are available in monitoring.
4. Reliability and Compliance: The Second Constraint
Model coverage determines whether a workload is possible. Reliability determines whether it is ready for production.
Check the following areas:
- Normalized error semantics: Providers use different errors for rate limits, timeouts, and content blocking. A gateway should normalize these into retryable and non-retryable categories so applications can use one backoff strategy.
- Retries and fallback: Automatic fallback becomes possible when multiple models cover the same capability. The capability matrix should include at least two candidates for capabilities that need redundancy.
- Observability: Request volume, token consumption, cache-hit rate, time to first token, and failure rate should be inspectable by model.
- Compliance: Verify that the model pool has completed the registrations or compliance reviews required for the intended deployment jurisdiction. For deployments in China, this includes relevant local filing requirements; those approvals should not be treated as evidence of compliance elsewhere.
A simplified retry-and-fallback pattern is:
for attempt in range(3):try:return client.chat(**payload)except RetryableError:time.sleep(2 ** attempt)except FatalError:return fallback_model.chat(**payload) # Fallback with equivalent capability
5. Deployment Checklist
- Validate the capability matrix. The number of gaps determines how many separate integration paths remain necessary.
- Confirm protocol compatibility. Check whether the application can retain a single client.
- Request the complete pricing structure. Include discount tiers, peak/off-peak rates, cache prices and TTL options, and video billing rules.
- Run a two-week limited-traffic rollout using real requests. Measure cache-hit rates and differences between estimated and actual bills.
- Connect monitoring and alerts. Include token costs in everyday operational dashboards.
- Reuse existing cloud infrastructure where applicable. If the business already runs on Baidu AI Cloud, consider consolidating model calls through the gateway and reusing existing logging, monitoring, alerts, and message queues for asynchronous batch processing and off-peak scheduling. Verify availability in the relevant deployment environment.
A mature selection process shifts the discussion from “Which model should we use?” to “Which capability does this workload require, and what is its cost budget?” That is the value a unified gateway and a capability matrix should deliver.
