fix(fireworks_ai): correct Kimi K2.5/K2.6/K2.7 max output token limits - #35174
Conversation
Fireworks publishes a 262144-token context window for the Kimi K2.5, K2.6 and K2.7 models but caps generation well below that. Every fireworks_ai Kimi K2.5/K2.6/K2.7 alias had max_output_tokens/max_tokens flattened to 262144 (equal to the context window), so the pre-call context-window check admitted requests asking for a full 262144-token completion that Fireworks rejects. Correct max_output_tokens/max_tokens to 32768 while keeping max_input_tokens at 262144, and add a regression test pinning the limits for all ten aliases. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Greptile SummaryCorrects Fireworks Kimi K2.5, K2.6, and K2.7 Code model metadata.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Updates the canonical Fireworks Kimi aliases to report a 32,768-token output limit while preserving their input context limits. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the corrected Kimi token limits in the bundled fallback model map. |
| tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_kimi_model_metadata.py | Adds regression assertions for all ten affected aliases through direct map access and get_model_info. |
| tests/test_litellm/test_utils.py | Aligns existing canonical and backup Fireworks metadata expectations with the corrected output limits. |
Reviews (2): Last reviewed commit: "test(fireworks_ai): align Kimi output-li..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…p fix Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
QA: live proxy, real Fireworks API, no mocks Tested against a live LiteLLM proxy with
|
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b0a48d5. Configure here.
TLDR
Problem this solves:
How it solves it:
Relevant issues
Linear ticket
Resolves LIT-4986
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
Every Kimi K2.5, K2.6 and K2.7 model on Fireworks publishes a 262144-token context window, but generation is capped well below that; the sibling entries set by hand show the pattern (
fireworks_ai/accounts/fireworks/models/kimi-k2-instructcaps output at 16384,kimi-k2-instruct-0905at 32768). The affected entries had copied 262144 intomax_output_tokens/max_tokens, so the pre-call context-window check would admit a request asking for a full 262144-token completion that Fireworks rejects.Before (parent commit 581f5c3), the cost map reported output == context:
After (fix commit f9c5be8), against a live proxy on localhost:4000 loading these two Fireworks Kimi deployments with
LITELLM_LOCAL_MODEL_COST_MAP=True:A real chat completion against Fireworks Kimi K2.6 through the same proxy still succeeds and tracks usage (real Fireworks API call):
Type
🐛 Bug Fix
Changes
Corrected
max_output_tokensandmax_tokensfrom 262144 to 32768 for the ten affectedfireworks_aiKimi aliases in bothmodel_prices_and_context_window.jsonand the bundledlitellm/model_prices_and_context_window_backup.json, leavingmax_input_tokensat the real 262144 context window. The aliases are the short names (kimi-k2p5,kimi-k2p6,kimi-k2p6-fast,kimi-k2p7-code,kimi-k2p7-code-fast), theaccounts/fireworks/models/...names and theaccounts/fireworks/routers/...names. Fireworks lists K2.7 only as "Kimi K2.7 Code", so there is no plain non-code K2.7 alias to add.Added
tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_kimi_model_metadata.py, which asserts the corrected limits for all ten aliases through both the raw cost map andget_model_info, so a future bulk edit that flattens output back to the context window fails.Final Attestation
Link to Devin session: https://app.devin.ai/sessions/62267d31816b438abf0e1f3651912e9a
Requested by: @mateo-berri
Note
Low Risk
Metadata-only correction in the model cost map plus tests; no runtime routing or auth changes, though callers may see stricter max-completion limits than before.
Overview
Fixes Fireworks Kimi K2.5/K2.6/K2.7 metadata so
max_output_tokensandmax_tokensare 32768 instead of 262144 (which matched the input context window and let pre-call checks admit completions Fireworks rejects).max_input_tokensstays 262144 across all ten aliases (short names,accounts/fireworks/models/..., and router variants) in bothmodel_prices_and_context_window.jsonand the bundled backup.Adds
test_fireworks_ai_kimi_model_metadata.pyto pin those limits on the raw cost map andget_model_info, and updates existing Fireworks parametrized expectations intest_utils.pyfor the Kimi entries.Reviewed by Cursor Bugbot for commit b0a48d5. Bugbot is set up for automated code reviews on this repo. Configure here.