When calc_price(...) receives an Azure provider API URL for an Azure AI
Foundry marketplace model, provider matching resolves to the Azure provider.
Some marketplace models are present in genai-prices under their origin
providers, but not under the Azure provider model list or alias set. Because the
provider is already resolved to Azure from the request URL, the lookup fails
instead of falling back to the origin provider pricing entry.
This affects downstream instrumentation that passes the actual provider URL
from the model request. Token usage is available, but cost calculation fails and
no queryable cost can be attached by downstream observability tools.
Minimal Repro
from datetime import UTC, datetime
from genai_prices import Usage, calc_price
usage = Usage(input_tokens=1000, output_tokens=1000)
timestamp = datetime.now(UTC)
azure_url = "https://example.openai.azure.com"
# Control case: an Azure-served model that prices through the Azure provider.
print(
calc_price(
usage,
"gpt-5.4",
provider_api_url=azure_url,
genai_request_timestamp=timestamp,
).total_price
)
# Marketplace model served through Azure AI Foundry.
# This fails because the Azure provider lookup cannot find the model.
print(
calc_price(
usage,
"Kimi-K2.6-1",
provider_api_url=azure_url,
genai_request_timestamp=timestamp,
).total_price
)
# The same model can price when provider matching is not forced to Azure,
# because it resolves through the origin provider.
print(
calc_price(
usage,
"Kimi-K2.6-1",
genai_request_timestamp=timestamp,
).total_price
)
# Another marketplace example with the same provider-resolution shape.
print(
calc_price(
usage,
"grok-4.3",
provider_api_url=azure_url,
genai_request_timestamp=timestamp,
).total_price
)
print(
calc_price(
usage,
"grok-4.3",
genai_request_timestamp=timestamp,
).total_price
)
# Another marketplace example that can price without the Azure URL but fails
# once provider matching resolves to Azure.
print(
calc_price(
usage,
"DeepSeek-V4-Pro",
provider_api_url=azure_url,
genai_request_timestamp=timestamp,
).total_price
)
print(
calc_price(
usage,
"DeepSeek-V4-Pro",
genai_request_timestamp=timestamp,
).total_price
)
Actual Behavior
calc_price(...) raises LookupError when the Azure provider URL is supplied
for Azure AI Foundry marketplace model names such as:
Kimi-K2.5
Kimi-K2.6-1
Kimi-K2.7-Code
grok-4.3
DeepSeek-V4-Pro
The same model names can price without the Azure provider URL because they
resolve under origin providers such as MoonshotAI, xAI, or DeepSeek.
Expected Behavior
genai-prices should have a documented and supported way to price Azure AI
Foundry marketplace models when the actual request provider URL is Azure.
Possible approaches:
- Add Azure provider aliases/pricing entries for Azure AI Foundry marketplace
models.
- Support provider-specific aliases that map Azure marketplace deployment names
to origin-provider pricing entries when that is correct.
- Document that callers must pass a different provider identifier for these
models, if Azure pricing should not be inferred from the Azure endpoint.
- Return a clearer error that explains the provider/model mismatch and the
recommended caller behavior.
Environment
genai-prices==0.0.69
- Also reproduced after calling
UpdatePrices().wait_prices_updated_sync(...)
against the current upstream pricing snapshot.
When
calc_price(...)receives an Azure provider API URL for an Azure AIFoundry marketplace model, provider matching resolves to the Azure provider.
Some marketplace models are present in
genai-pricesunder their originproviders, but not under the Azure provider model list or alias set. Because the
provider is already resolved to Azure from the request URL, the lookup fails
instead of falling back to the origin provider pricing entry.
This affects downstream instrumentation that passes the actual provider URL
from the model request. Token usage is available, but cost calculation fails and
no queryable cost can be attached by downstream observability tools.
Minimal Repro
Actual Behavior
calc_price(...)raisesLookupErrorwhen the Azure provider URL is suppliedfor Azure AI Foundry marketplace model names such as:
Kimi-K2.5Kimi-K2.6-1Kimi-K2.7-Codegrok-4.3DeepSeek-V4-ProThe same model names can price without the Azure provider URL because they
resolve under origin providers such as MoonshotAI, xAI, or DeepSeek.
Expected Behavior
genai-pricesshould have a documented and supported way to price Azure AIFoundry marketplace models when the actual request provider URL is Azure.
Possible approaches:
models.
to origin-provider pricing entries when that is correct.
models, if Azure pricing should not be inferred from the Azure endpoint.
recommended caller behavior.
Environment
genai-prices==0.0.69UpdatePrices().wait_prices_updated_sync(...)against the current upstream pricing snapshot.