-
[BE] fix: register fireworks_ai as a canonical provider so Fireworks model prices load (#7554)
发布于
2026-07-21 16:09:20 +00:00 Following the pattern of #7262 (azure), #7433 (xai), #7434 (deepseek) and #7432
(perplexity), Fireworks AI's ~260 non-zero-cost entries in
model_prices_and_context_window.json (the accounts/fireworks/models/* catalog:
llama, qwen, deepseek, glm, kimi, minimax families and more) currently drop at
load time because fireworks_ai is not in PROVIDERS_MAPPING, so buildModelPrice
returns null for every one of them and Fireworks spans never get a cost.Add fireworks_ai -> fireworks_ai to PROVIDERS_MAPPING, and route it through
textGenerationWithCacheCostOpenAI in PROVIDERS_CACHE_COST_CALCULATOR. Fireworks'
cost calculator in LiteLLM (litellm/llms/fireworks_ai/cost_calculator.py)
delegates to generic_cost_per_token, so its usage payload uses the same OpenAI
shape (cached tokens flattened under prompt_tokens_details.cached_tokens); the 8
cache-priced Fireworks models today (glm-4p7, glm-5p1, kimi-k2p5, minimax-m2p1)
therefore get the same cache-read discount that OpenAI/Azure/xAI/DeepSeek do.PROVIDERS_CACHE_COST_CALCULATOR was at the 10-pair ceiling of Map.of, so it moves
to Map.ofEntries to take the eleventh entry.Parameterized test covers both branches: a Fireworks model with no cache rates
(plain textGenerationCost) and one with cache rates (cache-aware OpenAI route).下载附件