fix(fireworks_ai): add kimi-k3 pricing so tool_choice is not rejected locally - #35446
Conversation
|
|
Greptile SummaryThe PR registers both Fireworks Kimi K3 model-name forms in the canonical and bundled backup model-cost maps, enabling local
Confidence Score: 5/5The PR appears safe to merge, with the canonical and backup metadata synchronized and both supported model-name forms covered by a focused regression test. The added entries resolve through the existing Fireworks capability lookup, expose
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds consistent canonical pricing, context, and capability metadata for both Fireworks Kimi K3 identifiers. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the canonical Kimi K3 entries in the package-local fallback map used by local model-cost loading. |
| tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py | Adds a network-free regression test that exercises both identifiers through the real supported-parameter capability gate. |
Reviews (1): Last reviewed commit: "fix(fireworks_ai): add kimi-k3 pricing s..." | Re-trigger Greptile
|
Checked the osv-scan job log and this one is inherited from the base branch, not introduced here. The job scans lockfiles only, invoked as osv-scanner -L uv.lock -L ui/litellm-dashboard/package-lock.json. This PR changes model_prices_and_context_window.json, its backup mirror, and one test file, so it touches neither lockfile and cannot add or remove a dependency finding. The 30 findings are led by gitpython 3.1.50, which is pinned in the base branch's own uv.lock at line 2317 of litellm_oss_daily_2026_07_20, alongside pyasn1 0.6.3 and the package-lock.json entries. Bumping those is a dependency-maintenance change that belongs in its own PR rather than folded into a model-pricing fix. I have not pushed anything for this check. The other jobs were still queued when the watcher fired; happy to revisit if any of those come back red. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Following up on my note that the queued jobs were still running. misc / Run tests has now finished and it is red, but for the same base-branch reason as osv-scan rather than anything in this diff. It fails on exactly two tests in tests/test_litellm/interactions/test_openapi_compliance.py, test_status_enum_values and test_content_schema_uses_discriminator, with 3021 passing alongside them. Both were fixed upstream after litellm_oss_daily_2026_07_20 was cut, in fcd2360 (#34135) and ae74b06 (#35161), and both fail the same way on the sibling PRs that share this base. This PR only adds two model-map entries and a Fireworks test, so it does not touch the interactions spec. That leaves osv-scan and those two compliance tests as the only reds, all three inherited from the base. Greptile came back 5/5 and I have ticked that checklist item. |
|
To settle the osv-scan red: it is pre-existing and not introduced here. osv-scan fails on unmodified main as well. The most recent run on main, https://github.com/BerriAI/litellm/actions/runs/30286853243 from 2026-07-27, failed on gitpython 3.1.54 in uv.lock. The job only ever scans lockfiles, invoked as osv-scanner -L uv.lock -L ui/litellm-dashboard/package-lock.json, and this PR changes no uv.lock and no package-lock.json, so it cannot add or remove a dependency finding. The specific pins it flags here come from the base branch lockfile. I am leaving it alone rather than bumping dependencies from an unrelated PR. The misc / Run tests red is separate and also not from this diff: it fails on exactly two tests in tests/test_litellm/interactions/test_openapi_compliance.py, test_status_enum_values and test_content_schema_uses_discriminator, with 3021 others passing. Both were fixed upstream after this PR's base branch was cut, in fcd2360 (#34135) and ae74b06 (#35161). |
4cea417 to
091b413
Compare
|
Rebased and retargeted onto litellm_internal_staging. This was previously based on a litellm_oss_daily_* branch, and I had missed that CLAUDE.md now names litellm_internal_staging as the base for external contributions too; no new daily branch has been cut since 2026_07_20, which explains the stale base. That also clears both red checks, since staging already carries the compliance-test fixes and the lockfile bump that osv-scan was flagging. The failures were never from this diff. For context, this adds Fireworks Kimi K3 to the model map so tool_choice is no longer rejected locally with UnsupportedParamsError. Tests pass on the new base and the scope is unchanged. Happy to adjust anything or split it differently if that helps. |
091b413 to
0c38b0e
Compare
0c38b0e to
f8290fb
Compare
Relevant issues
Fixes #35382
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Kimi K3 on Fireworks had no entry in the model cost map, so
supports_tool_choice()returned False andFireworksAIConfig.get_supported_openai_paramslefttool_choiceout of the supported list. Callers got a localUnsupportedParamsErrorbefore the request ever left LiteLLM, even though Fireworks accepts the parameter and returns tool calls, which the reporter confirmed by forcing it through withallowed_openai_params.Proxy config used for both runs, pointed at an unreachable base so the outgoing request body is what gets inspected rather than a completion:
Both runs use
LITELLM_LOCAL_MODEL_COST_MAP=Trueso the proxy reads this repo's map rather than the published one.Before, on base
7c56317edf, the call is rejected locally and never reaches Fireworks:After, with this PR, validation passes and
tool_choiceis forwarded. The request now gets as far as the network, and the only error is the deliberately unreachable base:As a control, the same request without
tool_choicealready reached the network on the base commit, which places the failure squarely in the capability gate rather than anywhere downstream.Type
🐛 Bug Fix
Changes
Adds
fireworks_ai/accounts/fireworks/models/kimi-k3and the shortfireworks_ai/kimi-k3alias tomodel_prices_and_context_window.jsonand its backup mirror, following the existing Kimi entries which carry both key forms. Pricing is $3.00 per million input, $0.30 per million cached input and $15.00 per million output, taken from the Fireworks serverless pricing page; the 1M context window, function calling and image input come from the model page. Those input and output figures also match Moonshot's own published K3 pricing.supports_tool_choiceis set to true, which is what actually unblocks the reported error.A parametrized regression test covers both key forms, asserting the pricing fields and that
tool_choiceappears in the supported params; it fails on the base commit for both.Final Attestation
Disclosure: I'm fairly new to this codebase and used Claude Code to trace the capability gate and run the before and after proxy captures. I checked the pricing against the Fireworks pages myself and confirmed the repro before and after; happy to correct anything that looks off.