Skip to content

fix(proxy): support slashes in google generateContent model names (#1… - #19753

Merged
Sameerlite merged 8 commits into
mainfrom
litellm_oss_staging_01_26_2026
Jan 27, 2026
Merged

fix(proxy): support slashes in google generateContent model names (#1…#19753
Sameerlite merged 8 commits into
mainfrom
litellm_oss_staging_01_26_2026

Conversation

@ghost

@ghost ghost commented Jan 26, 2026

Copy link
Copy Markdown

…9737)

  • fix(proxy): support slashes in google route params

  • fix(proxy): extract google model ids with slashes

  • test(proxy): cover google model ids with slashes

Relevant issues

Pre-Submission checklist

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

  • I have Added testing in the tests/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

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:

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes


Note

  • Google routes: Support model IDs with slashes in generateContent/countTokens paths; improved extraction in auth utils; updated route matching; new unit tests.
  • Prometheus: Add client_ip, user_agent, and broader model_id propagation; new deployment tpm/rpm limit gauges; adjust remaining API key metrics labels; improved invalid-key filtering; comprehensive tests.
  • MCP: More robust client (optional imports, refactored session handling); OAuth discovery endpoints supporting standard and legacy patterns; respect X-Forwarded-* headers; added tests incl. PKCE.
  • Onyx guardrail: Support request timeout (config/env ONYX_TIMEOUT), use httpx with timeouts; docs updated; tests for timeouts/error handling.
  • Logo endpoint: Make /get_image async, add on-disk caching and timeouted async fetch with graceful fallback; tests added.
  • Core/logging: Pass tpm/rpm in params; include user_agent in standard logging; minor formatting/cleanup.

Written by Cursor Bugbot for commit aa8134f. This will update automatically on new commits. Configure here.

…9737)

* fix(proxy): support slashes in google route params

* fix(proxy): extract google model ids with slashes

* test(proxy): cover google model ids with slashes
@vercel

vercel Bot commented Jan 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Jan 27, 2026 11:32am

Request Review

* fix(mcp): Add standard MCP URL pattern support for OAuth discovery (#17272)

  OAuth discovery endpoints now support both URL patterns:
  - Standard MCP pattern: /mcp/{server_name} (new)
  - Legacy LiteLLM pattern: /{server_name}/mcp (backward compatible)

  The standard pattern is required by MCP-compliant clients like
  mcp-inspector and VSCode Copilot, which expect resource URLs
  following the /mcp/{server_name} convention per RFC 9728.

  Changes:
  - Add _build_oauth_protected_resource_response() helper
  - Add oauth_protected_resource_mcp_standard() endpoint
  - Add oauth_authorization_server_mcp_standard() endpoint
  - Keep legacy endpoints for backward compatibility
  - Add tests for both URL patterns

  Fixes #17272

* fix(mcp): Add standard MCP URL pattern support for OAuth discovery (#17272)

  OAuth discovery endpoints now support both URL patterns:
  - Standard MCP pattern: /mcp/{server_name} (new)
  - Legacy LiteLLM pattern: /{server_name}/mcp (backward compatible)

  The standard pattern is required by MCP-compliant clients like
  mcp-inspector and VSCode Copilot, which expect resource URLs
  following the /mcp/{server_name} convention per RFC 9728.

  Changes:
  - Add _build_oauth_protected_resource_response() helper
  - Add oauth_protected_resource_mcp_standard() endpoint
  - Add oauth_authorization_server_mcp_standard() endpoint
  - Keep legacy endpoints for backward compatibility
  - Add tests for both URL patterns

  Fixes #17272

* Test was relocated

* refactor(mcp): Extract helper methods from run_with_session to fix PLR0915

Split the large run_with_session method (55 statements) into smaller
helper methods to satisfy ruff's PLR0915 rule (max 50 statements):

- _create_transport_context(): Creates transport based on type
- _execute_session_operation(): Handles session lifecycle

Also changed cleanup exception handling from Exception to BaseException
to properly catch asyncio.CancelledError (which is a BaseException subclass
in Python 3.8+).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(mcp): Fix flaky test by mocking health_check_server

The test_mcp_server_manager_config_integration_with_database test was
making real network calls to fake URLs which caused timeouts and
CancelledError exceptions.

Fixed by mocking health_check_server to return a proper
LiteLLM_MCPServerTable object instead of making network calls.

* test(mcp): Fix skip condition to properly detect claude model names

The skip condition for missing API keys was checking for "anthropic" in
the model name, but the test uses "claude-haiku-4-5" which doesn't match.
Updated to check for both "anthropic" and "claude" model patterns.

Also added skip condition for OpenAI models when OPENAI_API_KEY is not set.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(mcp): Fix skip condition to properly detect claude model names

The skip condition for missing API keys was checking for "anthropic" in
the model name, but the test uses "claude-haiku-4-5" which doesn't match.
Updated to check for both "anthropic" and "claude" model patterns.

Also added skip condition for OpenAI models when OPENAI_API_KEY is not set.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Harshit28j and others added 2 commits January 25, 2026 23:07
* feat: add clientip and user agent in metrics

* fix: lint errors

* Add model id and other req labels

---------

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
* add timeout to onyx guardrail

* add tests

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

url=self.server_url,
http_client=http_client,
)
return transport_ctx, http_client

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.

MCP HTTP transport crashes when import fails

High Severity

The code sets streamable_http_client = None when the import fails, but then calls streamable_http_client(...) directly without checking if it's None. When HTTP transport is used (the default) and the mcp.client.streamable_http module is unavailable (e.g., older MCP package version), this will raise a TypeError: 'NoneType' object is not callable.

Additional Locations (1)

Fix in Cursor Fix in Web

self, api_base: Optional[str] = None, api_key: Optional[str] = None, **kwargs
self, api_base: Optional[str] = None, api_key: Optional[str] = None, timeout: Optional[float] = 10.0, **kwargs
):
timeout = timeout or int(os.getenv("ONYX_TIMEOUT", 10.0))

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.

Onyx timeout uses int() causing ValueError on floats

Medium Severity

The timeout fallback uses int(os.getenv("ONYX_TIMEOUT", 10.0)), which will raise a ValueError if a user sets ONYX_TIMEOUT to a decimal value like "2.5". Since timeout is typed as Optional[float] and httpx.Timeout accepts floats, float() should be used instead of int().

Fix in Cursor Fix in Web

try:
from mcp.server.streamable_http_manager import StreamableHTTPSessionManager
except ImportError:
StreamableHTTPSessionManager = None # type: ignore

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.

MCP server crashes when session manager import fails

High Severity

The code sets StreamableHTTPSessionManager = None when the import fails, but it's then used at module load time (lines 128 and 136) without checking for None. When the MCP package is installed but missing the streamable_http_manager module, the MCP server will fail to initialize with a TypeError: 'NoneType' object is not callable.

Additional Locations (1)

Fix in Cursor Fix in Web

@ghost
ghost requested a review from Sameerlite January 27, 2026 05:54
@Sameerlite
Sameerlite merged commit ea0a264 into main Jan 27, 2026
17 of 54 checks passed
@ishaan-berri
ishaan-berri deleted the litellm_oss_staging_01_26_2026 branch March 26, 2026 22:29
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…26_2026

fix(proxy): support slashes in google generateContent model names (#1
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.

5 participants