Skip to content

Match litellm.completion supported model parameters with proxy model info - #27720

Merged
krrish-berri-2 merged 3 commits into
BerriAI:litellm_internal_stagingfrom
jyeros:fix/completion_params_use_base_model
May 12, 2026
Merged

Match litellm.completion supported model parameters with proxy model info#27720
krrish-berri-2 merged 3 commits into
BerriAI:litellm_internal_stagingfrom
jyeros:fix/completion_params_use_base_model

Conversation

@jyeros

@jyeros jyeros commented May 12, 2026

Copy link
Copy Markdown
Contributor

Relevant issues

Fixes #27717

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Screenshots / Proof of Fix

Type

🐛 Bug Fix

Changes

@jyeros

jyeros commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai

@codecov

codecov Bot commented May 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a mismatch between the model identifier passed to get_optional_params and the actual base model configured in proxy model info. When a proxy model is configured with a base_model in model_info, litellm now uses that base model name to resolve supported optional parameters instead of the proxy alias.

  • litellm/main.py: In optional_param_args, the \"model\" key now uses model_info[\"base_model\"] when the field is present and non-empty, falling back to the already-provider-stripped model value otherwise.
  • tests/test_litellm/test_main.py: Adds a parametrized mock test that patches get_optional_params and asserts the correct model value is forwarded in both the no-model_info and base_model-present cases.

Confidence Score: 5/5

The change is a single-line conditional in optional_param_args construction; it only affects parameter resolution and does not touch the actual model sent to the upstream provider.

The fix is narrow and well-tested: base_model is only used when model_info is a dict with a non-empty base_model key, with a safe fallback to the original model name in all other cases. The mock test covers both paths without network calls.

No files require special attention.

Important Files Changed

Filename Overview
litellm/main.py Uses base_model from model_info (when present) as the model arg to get_optional_params, so proxy model aliases correctly inherit supported parameter sets from their base model.
tests/test_litellm/test_main.py Adds a parametrized mock-only test verifying that get_optional_params receives the base_model value when model_info contains one, and falls back to the stripped model name otherwise.

Reviews (2): Last reviewed commit: "Formatting" | Re-trigger Greptile

Comment thread tests/test_litellm/test_main.py
@jyeros

jyeros commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai

@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor

🤖 litellm-agent: This PR is currently BLOCKED from merge.

Score: 3/5

Why blocked:

  • 1 PR-related CI failure (triage-llm-invalid: schema validation failed — manual review required) (pr_related_failures, -2 pts)

Details: Score docked for: 1 PR-related CI failure (triage-llm-invalid: schema validation failed — manual review required).

Fix the issues above and push an update — the bot will re-review automatically.

Note: This bot is still in beta and might not always work as expected. Please share any feedback via Slack.

@krrish-berri-2
krrish-berri-2 merged commit fc8a9a3 into BerriAI:litellm_internal_staging May 12, 2026
42 checks passed
@jyeros
jyeros deleted the fix/completion_params_use_base_model branch May 12, 2026 19:25
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…info (BerriAI#27720)

* Use base_model for supported optional params

* Add test

* Formatting
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.

[Bug]: Proxy model with base model support thinking but failing on completion

3 participants