Automatic model routing can make AI applications more resilient, but resilience can come with an operational cost.
When an application uses Microsoft Foundry Model Router, a request can be routed to an appropriate model automatically. If the selected model cannot complete the request, the router can attempt another eligible model. From the application's perspective, the request may still succeed.
The problem is that a successful response can hide additional model attempts.
For teams running AI applications at scale, those additional attempts matter because model selection affects more than availability. It can influence latency, token consumption, throughput, and ultimately the application's AI spend.
This article explains how to think about the cost of automatic fallback, what telemetry should be collected, and how to build a practical cost model around Model Router traffic.
Why Fallback Can Affect AI Cost
Consider a simple request:
Application
|
v
Model Router
|
v
Model A
|
v
Response
The application makes one request and one model handles it.
Now consider a fallback:
Application
|
v
Model Router
|
v
Model A
|
| Failure
v
Model B
|
v
Response
The user still receives one response, but the request followed a different execution path.
Depending on the failure point and service behavior, the additional attempt can introduce additional latency and potentially additional usage.
That is why teams should not estimate AI cost simply as:
Total API Requests × Average Cost
A more useful model accounts for the requests that require fallback.
The Basic Cost Model
A simplified monthly cost calculation can start with:
Base Cost
= Successful Requests × Average Cost Per Request
Then add the cost associated with fallback attempts:
Fallback Cost
= Fallback Attempts × Average Cost Per Attempt
Therefore:
Estimated Total Cost
= Base Cost + Fallback Cost
This is only a model for analysis. Actual billing depends on the service, model, token usage, and applicable pricing rules.
The important point is to measure fallback traffic separately rather than assuming every request has identical cost characteristics.
Why Request Count Alone Is Not Enough
Suppose an application processes 1 million requests in a month.
Two environments may have exactly the same request count:
Environment | Requests | Fallback Rate |
|---|---|---|
Environment A | 1,000,000 | 0.1% |
Environment B | 1,000,000 | 3.0% |
The second environment has significantly more requests that require additional routing attempts.
Now add token usage.
If fallback requests are also associated with longer prompts or larger responses, the cost difference can become even more significant.
Therefore, cost analysis should consider at least:
Request count
Input tokens
Output tokens
Serving model
Attempt count
Fallback rate
Model-specific pricing
Failed-attempt behavior
Total request latency
Tracking the Serving Model
The first piece of information to capture is the model that ultimately served the request.
For example:
response = client.chat.completions.create(
model=deployment,
messages=[
{
"role": "user",
"content": "Explain dependency injection in ASP.NET Core."
}
]
)
print(response.model)
The model information can be added to application telemetry:
telemetry = {
"serving_model": response.model
}
Once requests are aggregated, teams can determine how much traffic is being handled by each model.
For example:
Model A 58%
Model B 27%
Model C 15%
This distribution can be useful when comparing expected and actual AI spend.
Tracking Fallback Attempts
Serving-model information alone does not tell the complete story.
Suppose the final serving model is Model B.
There are two possible scenarios:
Scenario 1
Router
|
v
Model B
|
v
Success
and:
Scenario 2
Router
|
v
Model A
|
| Failure
v
Model B
|
v
Success
Both requests can ultimately report Model B as the serving model.
The second request, however, followed a fallback path.
This is why routing metadata and attempt information are valuable when analyzing Model Router costs.
A normalized internal event might look like this:
routing_event = {
"serving_model": "Model B",
"fallback": True,
"attempt_count": 2
}
The exact metadata structure should be handled according to the current Model Router response contract rather than hard-coded assumptions.
Calculate Fallback Rate
A simple fallback-rate calculation is:
Fallback Rate
= Requests With Fallback
÷ Total Requests
× 100
For example:
Total requests: 500,000
Fallback requests: 2,500
Fallback rate:
2,500 / 500,000 × 100
= 0.5%
A fallback rate of 0.5% means that 1 out of every 200 requests experienced fallback.
The percentage alone does not tell you whether the impact is acceptable. The next step is to determine how much traffic and token usage those fallback requests represent.
Calculate Additional Attempt Volume
Suppose an application receives:
1,000,000 requests
and:
Fallback rate = 1%
That gives:
Fallback requests
= 1,000,000 × 0.01
= 10,000
If each of those requests causes one additional model attempt:
Additional attempts = 10,000
The application therefore has:
1,010,000 total model attempts
This does not automatically mean that the application will be billed for exactly 1,010,000 billable model requests. Billing depends on how the underlying service accounts for failed attempts and usage.
The calculation is instead useful as an operational upper-level model for understanding additional execution.
Token Usage Changes the Calculation
Request count is only one part of AI cost.
Consider:
Input tokens: 2,000
Output tokens: 500
If a fallback causes another model invocation that processes the request, additional token consumption may become relevant.
A more detailed analytical model is:
Estimated Token Cost
=
Input Token Cost
+
Output Token Cost
+
Fallback Attempt Token Cost
For multiple models, calculate usage separately:
Model A
Input tokens: 2,000,000
Output tokens: 500,000
Model B
Input tokens: 700,000
Output tokens: 180,000
This allows teams to compare actual model usage instead of relying on total request counts.
A Practical Cost Telemetry Record
For production applications, one telemetry record per request can provide enough information for later aggregation.
For example:
cost_event = {
"request_id": request_id,
"serving_model": response.model,
"fallback": False,
"attempt_count": 1,
"input_tokens": 0,
"output_tokens": 0,
"latency_ms": 0
}
The token fields should be populated from the usage information returned by the API when available.
A fallback request could produce:
cost_event = {
"request_id": request_id,
"serving_model": "Model B",
"fallback": True,
"attempt_count": 2,
"input_tokens": 2100,
"output_tokens": 620,
"latency_ms": 1450
}
This event can then be sent to the application's existing logging or observability platform.
Compare Normal and Fallback Requests
One of the most useful analyses is to compare normal requests with fallback requests.
Metric | Normal Request | Fallback Request |
|---|---|---|
Requests | 990,000 | 10,000 |
Attempts | 1 | 2+ |
Average latency | 700 ms | 1,350 ms |
Input tokens | 1,800 | 2,000 |
Output tokens | 450 | 520 |
Serving model | Model A | Model B |
This comparison helps answer an important question:
Is automatic fallback providing enough reliability benefit to justify its additional operational cost?
For most production systems, the answer should not be based on cost alone.
A fallback mechanism can be valuable even when it increases the number of model attempts because avoiding a failed user request may be more important than minimizing every individual model call.
Cost per Successful Request
Another useful metric is:
Cost per Successful Request
=
Total Model Cost
÷ Successful Application Requests
This is more representative than:
Cost per API Attempt
because the business ultimately cares about successfully completed user operations.
For example:
Total AI cost: ₹50,000
Successful requests: 500,000
Cost per successful request:
₹50,000 / 500,000
= ₹0.10
If fallback increases total cost but significantly reduces failed user requests, the higher cost may still represent better economics for the application.
Measure the Cost of Reliability
This leads to a broader metric:
Reliability Cost
=
Additional Cost From Fallback
÷ Additional Successful Requests
For example, suppose fallback adds ₹2,000 in model usage but prevents 4,000 requests from failing.
₹2,000 / 4,000
= ₹0.50
The application is effectively spending ₹0.50 of additional model cost for each additional successful request saved through fallback.
That number can be compared with the business value of completing the request.
This approach is often more useful than simply declaring fallback "expensive."
Model-Specific Cost Analysis
Different models can have different pricing and performance characteristics.
Therefore, aggregate cost by serving model:
Model A
Requests: 700,000
Token usage: ...
Estimated cost: ...
Model B
Requests: 250,000
Token usage: ...
Estimated cost: ...
Model C
Requests: 50,000
Token usage: ...
Estimated cost: ...
Then separately identify fallback traffic:
Fallback traffic
A → B
A → C
B → C
This can reveal patterns that are hidden in overall averages.
For example, if most fallback traffic follows:
Model A → Model C
and Model C has substantially higher per-token pricing, a relatively small fallback rate could have a disproportionate effect on cost.
Cost and Latency Are Connected
Fallback can affect more than the bill.
Consider a normal request:
Router: 20 ms
Model A: 650 ms
Total: 670 ms
Now compare a fallback:
Router: 20 ms
Model A: failed
Model B: 1,300 ms
Total: ~1,320 ms
The fallback request is almost twice as slow.
If fallback happens frequently, the application may experience a noticeable increase in tail latency.
Therefore, a Model Router dashboard should ideally correlate:
Fallback Rate
|
+---- Cost
|
+---- P95 Latency
|
+---- Error Rate
|
+---- Model Distribution
This provides a more complete picture of the impact.
Building a Simple Monthly Cost Estimate
Suppose a workload has:
Monthly requests: 2,000,000
Fallback rate: 0.8%
Average normal cost: ₹0.08
Average fallback attempt: ₹0.05
First calculate fallback requests:
2,000,000 × 0.008
= 16,000
Estimated base cost:
2,000,000 × ₹0.08
= ₹160,000
Estimated additional fallback-attempt cost:
16,000 × ₹0.05
= ₹800
Estimated analytical total:
₹160,000 + ₹800
= ₹160,800
Again, this is a planning model, not a billing calculation. Actual charges must be determined from the applicable service and model pricing rules.
The value of the calculation is that it gives the engineering team a way to quantify the impact of fallback.
When Fallback Cost Becomes Significant
Fallback deserves closer attention when one or more of these conditions are true:
Traffic volume is very high.
The fallback rate is increasing.
Fallback models are substantially more expensive.
Requests contain large prompts.
Responses contain large amounts of generated content.
Fallback requests have significantly higher latency.
The same model repeatedly becomes unavailable.
The application has strict cost targets.
For a low-volume application, a small amount of fallback overhead may be irrelevant.
For a high-volume AI platform, even a fraction of a percent can represent a meaningful number of additional attempts.
Common Mistakes in Cost Analysis
Counting Every Successful Request as One Model Attempt
A successful application request can involve multiple routing attempts.
Track attempt information when available.
Using Only Request Counts
Two requests can have dramatically different token usage.
Include input and output tokens in cost analysis.
Ignoring the Serving Model
Model Router can change the distribution of traffic across eligible models.
Monitor which models actually serve requests.
Assuming Every Fallback Is a Billing Event
Do not assume that an unsuccessful attempt is automatically billed in a particular way.
Use the applicable service billing documentation and actual usage data.
Looking Only at Monthly Totals
Monthly totals can hide short periods of abnormal fallback behavior.
Analyze fallback rate over time to identify incidents and configuration changes.
Optimizing Cost Without Measuring Reliability
Reducing fallback may lower model usage while increasing failed user requests.
Cost optimization should be evaluated alongside availability and user experience.
Recommended Production Dashboard
A practical dashboard for Model Router could contain:
Model Router Cost & Reliability
Total Requests 2.0M
Successful Requests 1.99M
Fallback Requests 16K
Fallback Rate 0.8%
Total Token Usage ...
Estimated Model Cost ...
Average Routing Latency 20 ms
P95 Request Latency 1.6 s
Error Rate 0.2%
Top Serving Models
---------------------------
Model A 62%
Model B 25%
Model C 13%
Fallback Paths
---------------------------
A → B 70%
A → C 20%
B → C 10%
The dashboard should allow engineers to filter these metrics by application, environment, time period, and model where possible.
Best Practices
For production Model Router deployments, consider these practices:
Track fallback rate continuously.
Record the final serving model.
Track attempt counts when routing metadata is available.
Capture input and output token usage.
Separate normal and fallback requests during cost analysis.
Calculate cost by model rather than using only one global average.
Monitor p95 and p99 latency alongside cost.
Investigate sudden increases in fallback rate.
Use only approved models in the fallback pool.
Treat cost estimates as analytical models until they are reconciled with actual billing data.
Evaluate fallback using reliability and user experience, not cost alone.
Review routing behavior after changing models or router configuration.
Conclusion
Microsoft Foundry Model Router can simplify model selection and improve application resilience by automatically routing requests across eligible models. But automatic fallback changes the execution path of a request, and that can affect cost, latency, and model usage.
The right way to analyze this behavior is not to ask only, "How many API requests did we make?"
Instead, ask:
How many model attempts were made?
Which model served each request?
How often did fallback occur?
How many tokens were processed?
What did fallback add to latency?
What did it add to overall model cost?
How many otherwise failed requests became successful?
With request-level routing telemetry, teams can answer these questions using actual production data.
The goal is not necessarily to eliminate fallback. The goal is to understand its economics and make sure the reliability benefits justify the additional execution cost.
For large-scale AI applications, that visibility turns Model Router from a simple model-selection feature into a measurable part of the application's reliability, performance, and cost strategy.

Join the conversation! Your thoughts help the community grow.