Skip to content

fix(sambanova): correct DeepSeek-V3.2 context window (32k -> 128k) - #32035

Open
bhumikadangayach wants to merge 2 commits into
BerriAI:litellm_oss_stagingfrom
bhumikadangayach:fix/deepseek-v3.2-context-window-v3
Open

fix(sambanova): correct DeepSeek-V3.2 context window (32k -> 128k)#32035
bhumikadangayach wants to merge 2 commits into
BerriAI:litellm_oss_stagingfrom
bhumikadangayach:fix/deepseek-v3.2-context-window-v3

Conversation

@bhumikadangayach

Copy link
Copy Markdown
Contributor

Follow-up to #30016.

Greptile flagged in that PR that DeepSeek-V3.2's 32k context window might be a repeat of the same copy-paste mistake that was just fixed for DeepSeek-V3.1 (also 32k -> 128k). Confirmed via multiple sources (OpenRouter, Artificial Analysis, DeepSeek's own technical paper) that DeepSeek-V3.2 has a 128k (131,072 token) context window, matching its V3.1 predecessor's architecture lineage.

Fixed max_tokens, max_input_tokens, and max_output_tokens for sambanova/DeepSeek-V3.2 from 32768 → 131072. Pricing and other fields unchanged.

Backup file synced to match primary.

Supersedes #31417 (rebased onto current litellm_oss_staging).

@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the sambanova/DeepSeek-V3.2 context window from 32 768 → 131 072 tokens in both the primary and backup model pricing files, mirroring an identical correction made for DeepSeek-V3.1 in #30016.

  • model_prices_and_context_window.json: only the three DeepSeek-V3.2 token fields are changed — this part is correct.
  • litellm/model_prices_and_context_window_backup.json: contains ~200+ lines of additional model additions and updates not present in the primary file (new Gemini image models, ZAI/GLM models, OpenAI context window corrections, repositioned darkbloom entries). The repositioning of the darkbloom entries broke the file's JSON structure — the root object is now closed before fallback_generalizations, making the backup an invalid JSON document that will crash litellm whenever the backup path is used.

Confidence Score: 1/5

Not safe to merge — the backup JSON file is malformed and will crash litellm in any scenario that falls back to it.

The backup file's JSON structure is broken: the root object closes before fallback_generalizations, leaving that section and a stray } outside the root. load_local_model_cost_map() has no exception handling around json.loads(), so every code path that touches the backup — forced local mode, remote-fetch failure, and the integrity-check count — will throw a JSONDecodeError at runtime. The primary file's change is correct and isolated, but the backup breakage is a hard blocker.

litellm/model_prices_and_context_window_backup.json needs to be regenerated or hand-corrected so that fallback_generalizations remains inside the root JSON object, and its contents should be reconciled with the primary file.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Correctly updates sambanova/DeepSeek-V3.2 max_tokens, max_input_tokens, and max_output_tokens from 32768 to 131072; no other changes in this file
litellm/model_prices_and_context_window_backup.json Contains the DeepSeek-V3.2 fix plus ~200+ unreferenced model additions/updates; critically, repositioning the darkbloom entries breaks the JSON structure — the root object closes before fallback_generalizations, making the file unparseable

Comments Outside Diff (1)

  1. litellm/model_prices_and_context_window_backup.json, line 1 (link)

    P1 Backup file diverges significantly from the primary file

    The PR description states "Backup file synced to match primary," but the diff shows the backup contains ~200+ lines of additional changes absent from model_prices_and_context_window.json: new model entries (gemini-3-pro-image, gemini-3.1-flash-image for vertex_ai/gemini/bare variants, openrouter/z-ai/glm-5.1, zai/glm-5.1, zai/glm-4.7-flash), updated max_input_tokens values for several OpenAI models, corrected max_output_tokens/max_tokens for o1-pro variants, and repositioned darkbloom entries. The two files are not in sync. Any user relying on the backup will get different model data than a user relying on the primary.

Reviews (1): Last reviewed commit: "fix(sambanova): correct DeepSeek-V3.2 co..." | Re-trigger Greptile

Comment on lines +44015 to +44016
},
"fallback_generalizations": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Broken JSON structure — backup file is now invalid

The relocation of the darkbloom model entries introduced a malformed JSON structure. At line 44015 the root object is closed by } followed by a trailing ,, and "fallback_generalizations" appears on the next line at 0-space indentation — outside the root {}. This makes the file invalid JSON that json.loads() will reject with a JSONDecodeError.

load_local_model_cost_map() in get_model_cost_map.py has no try/except around json.loads(), so this will crash litellm in any scenario where the backup is needed: when LITELLM_LOCAL_MODEL_COST_MAP=True, when the remote fetch fails (the fallback path at lines 295–297 of get_model_cost_map.py), and during integrity validation via _get_backup_model_count(). Compare with the primary file (model_prices_and_context_window.json line 44008–44009) where gpt-oss-20b correctly closes with }, (comma included) and fallback_generalizations remains at 2-space indent inside the root object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 748ddd3 — regenerated the backup directly from the primary file. Both files are now in sync and valid JSON (verified locally with json.load()). The Greptile review is based on the first commit before the fix — please re-trigger to confirm.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant