[NA] [BE] fix: register fireworks_ai as a canonical provider so Fireworks model prices load#7554
Merged
andrescrz merged 1 commit intoJul 21, 2026
Conversation
…model prices load Following the pattern of comet-ml#7262 (azure), comet-ml#7433 (xai), comet-ml#7434 (deepseek) and comet-ml#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).
andrescrz
approved these changes
Jul 21, 2026
andrescrz
left a comment
Member
There was a problem hiding this comment.
Hi @Anuj7411
Thanks for the contribution! I reviewed the PR and everything looks good from my side. I've approved it, and all CI checks have passed successfully.
We'll merge it shortly, and the change will be included in the next Opik release.
Thanks again for contributing to Opik!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
Fireworks AI's pricing entries are silently dropped by Opik today.
model_prices_and_context_window.jsoncarries roughly 260 non-zero-cost entries taggedlitellm_provider: "fireworks_ai"(theaccounts/fireworks/models/*catalog spanning the llama, qwen, deepseek, glm, kimi and minimax families), and none of them load becausefireworks_aiis not registered inPROVIDERS_MAPPING;buildModelPricereturnsnullfor any entry whose provider is not in that map, so every Fireworks span ends up with no cost. This follows the exact pattern of the earlier provider-registration fixes for azure (#7262), xai (#7433), deepseek (#7434) and perplexity (#7432).fireworks_ai -> fireworks_aiinPROVIDERS_MAPPINGso the entries loadfireworks_aithroughtextGenerationWithCacheCostOpenAIinPROVIDERS_CACHE_COST_CALCULATOR; Fireworks' LiteLLM cost calculator (litellm/llms/fireworks_ai/cost_calculator.py) delegates togeneric_cost_per_token, so its usage payload uses the OpenAI shape (cached tokens underprompt_tokens_details.cached_tokens), and the eight cache-priced Fireworks models today (glm-4p7, glm-5p1, kimi-k2p5, minimax-m2p1) get the same cache-read discount OpenAI/Azure/xAI/DeepSeek receivePROVIDERS_CACHE_COST_CALCULATORwas at the ten-pair ceiling ofMap.of, so it moves toMap.ofEntriesto take the eleventh entryChange checklist
Issues
No ticket; discovered by scanning
litellm_providervalues in the bundled price map for providers with priced models that are absent fromPROVIDERS_MAPPING.AI-WATERMARK
AI-WATERMARK: yes
model_prices_and_context_window.jsonbefore submissionTesting
Added a parameterized test (
calculateCostHandlesFireworksModels) covering both branches:fireworks_ai/accounts/fireworks/models/llama-v3p1-70b-instruct(input 9e-7, output 9e-7, no cache) routes throughtextGenerationCost; 1000 prompt + 200 completion tokens = 0.00108fireworks_ai/accounts/fireworks/models/kimi-k2p5(input 6e-7, output 3e-6, cache_read 1e-7) routes throughtextGenerationWithCacheCostOpenAI; with 300 of 1000 prompt tokens cached, 700 * 6e-7 + 200 * 3e-6 + 300 * 1e-7 = 0.00105Both cases fail against the current code (the models do not resolve without the mapping entry, so cost comes back as zero) and pass with the fix.
Documentation
No documentation changes needed; provider pricing is driven entirely by the bundled price map and the provider registration in
CostService.Follow-up
The same drop affects several other high-volume OpenAI-compatible inference providers that could be registered the same way if the team wants them: openrouter (~92 priced models), novita (~85), deepinfra (~67), together_ai (~36), databricks (~28) and moonshot (~22). Happy to open follow-ups for any of those; keeping this PR scoped to Fireworks alone.