A New Cost Equation for the Era of Coding Agents
Coding agents (Claude Code, OpenAI Codex CLI, etc.) operate not in a single prompt-response loop but on a task basis. When a developer makes a change request, the agent repeatedly reads files, edits code, and runs tests to complete the task. The number of model calls required for a single task can vary from a few to dozens. What developers pay for is not the 'number of calls' but the 'completed tasks'.
The total task cost cannot be determined solely by the price per token. The total cost depends on how many turns the model takes, how much history is resent at each turn, and how often the task is retried or left incomplete. Costs are incurred even for failed attempts.
Therefore, when evaluating routing strategies, the Cost per Solved Task metric should be used. This is the total execution cost divided by the number of successful executions that passed the tests.
NVIDIA NeMo Switchyard: Standardizing the Routing Layer
NVIDIA NeMo Switchyard is an open-source library that helps AI agents decide which model to send each request to. Users define the available model pool and routing strategies. Currently, it offers two strategies through LiteLLM integration.
| Strategy | Number of Candidate Models | Operating Principle | Use Case |
|---|---|---|---|
| Stage Routing | Exactly 2 | Reads results from recent tool activity and request history to choose between two candidates | Complexity-based dynamic routing |
| Random Routing | 2 or more | Random selection from a weighted pool | Traffic splitting, A/B comparison |
Stage routing does not call a separate judging model (Judge Model). The agent must send the entire conversation history and analyze tool usage patterns to select either a Capable Model or an Efficient Model. Classifier-based Task/Composite routing requires intermediate model calls and is not supported in the current integration.
NVIDIA documents switchyard-server 0.3.0 as a demo and evaluation component, stating that settings and APIs may change between releases. This sample is an experimental integration and is not intended for production use.
Architecture: A Complete Gateway within a Private VPC
The sample is deployed using AWS CDK, and the main components are as follows.
- Coding Agent → ALB (WAF, IP Allowlist) → ECS Fargate (LiteLLM + Switchyard Plugin) → Bedrock Runtime VPC Endpoint → Claude Opus 5.5 / Nemotron 3 Super 120B
- Network: VPC spanning 2 AZs, ECS tasks placed in a private subnet, outbound restricted via a single NAT gateway
- Security: AWS WAF (IP reputation, blocking malicious input, rate limiting by IP), ALB path allowlist (only allowing /v1/chat/completions, /v1/models, /health/liveliness), blocking management UI, API documentation, and key management paths
- Authentication: AWS Secrets Manager generates gateway keys, adding `sk-` prefix upon container startup
- Observability: CloudWatch log group (`/<stack-name>/litellm`, 30-day retention), metric collection via Container Insights
- Model Calls: Uses Bedrock Converse/ConverseStream API, obtains credentials via the task's IAM role, keeping traffic within the AWS network through VPC endpoints
- Response Headers: Actual response model name indicated in `x-litellm-model-name`, the body `model` field retains `switchyard`
Validation Environment and Benchmark Methodology
The sample was tested with the following model pairs in the US East (N. Virginia) region.
| Model | Role | Notes |
|---|---|---|
| Claude Opus 5.5 | High-performance model (Capable) | Anthropic on Bedrock |
| Nemotron 3 Super 120B | High-efficiency model (Efficient) | NVIDIA on Bedrock |
In other regions, model availability and tool calling support must be verified separately. The benchmark runner measures cost per solved task for both the routing model group and the single model baseline group to quantify routing effectiveness.
Deployment Prerequisites and Operational Considerations
- Non-production AWS account, Bedrock model access required
- AWS CLI v2, explicit region settings, CDK bootstrap completed account
- Node.js 20+, npm, Docker with BuildKit, Python 3.11+
- Own hostname + Route 53 public hosted zone or ACM certificate for the deployment region (simple HTTP testing is unnecessary)
- Must deploy and validate in a non-production account first. Consult with security, legal, and compliance teams before applying to production.
So What: Tangible Value for Development Organizations
1. A New Axis of Cost Optimization: Provides a framework to measure and improve task completion unit economics beyond simple token price comparisons 2. Reduced Vendor Dependency: Abstracts multiple models into a single OpenAI-compatible endpoint through the LiteLLM gateway 3. Data Governance: Inference traffic does not traverse the public internet via VPC endpoints 4. Establishing an Experimental Culture: Native support for A/B testing at the infrastructure level through weighted splits in Random routing
However, currently, Stage routing is limited to 2 models, and advanced strategies based on Classifier are not supported. Since switchyard-server is an evaluation version (0.3.0), sufficient validation and monitoring systems must be established before production adoption.