Repository navigation
feat(vertex_ai): add Meta Muse models on Vertex AI on lts/1.108.x - #53388
Merged
mateo-berri merged 65 commits intoNov 25, 2026
Merged
Conversation
(cherry picked from commit 224640c7cfbeddc3e7786ef10c1abb37ab73bd64)
(cherry picked from commit a2130c94e22d03778dacca26070082d6e806af09)
(cherry picked from commit f034a90b4eb3faa58c4e58b59c9d94e108f76ac7)
…arams for store Chat completions and /v1/messages now reach the Muse Responses endpoint for any vertex_ai/meta/muse-* model, including ones the cost map does not list yet. store=True now becomes store=False under drop_params instead of raising. (cherry picked from commit edcc38c63b86963edb2cf4a82c9d4cc20c42c4b4)
…calls The chat-to-Responses bridge now forwards the deployment's vertex_project, vertex_location and vertex_credentials, so chat and messages calls stop falling back to the host's own Google identity. Muse also answers 400 for a configured non-global vertex_location unless drop_params is set, and drops background and previous_response_id under drop_params instead of sending them to Vertex (cherry picked from commit d2f4449a514fdb9f99a87476ca565b441c599d03)
Expose drops_params under the name the picked Muse adapter imports, drop the per-call custom price assertion that depends on BerriAI#48119 (not on this line), and sort the bridge_check re-export imports that already failed ruff on the line
…cannot take (cherry picked from commit b8a367d8063154b323beee3a5d9205ee51632b71)
(cherry picked from commit 1d823b335a47e1c96b9a755ae0e717a5b909d56d)
Route only vertex_ai/meta/muse-* names to the Muse adapter, so a bare muse- name keeps its old path instead of being served with no price Serve Responses WebSocket mode through the managed HTTP bridge, since Vertex has no wss endpoint for Muse and the native path skipped every Muse check Keep /v1 in the URL when a custom api_base has no version path, the way the Vertex batches handler does Answer 400 on token counting for Muse, the convention for Vertex partner models that have no count route, instead of a Vertex 404 Let Ember take PDFs, which Google's model card and a direct Vertex call allow, and fall back to vertex_ai_project when vertex_project is blank (cherry picked from commit 9d44f0c9fbb93fffa9a8de5c39985e10a04d6003)
…ber PDF input A Muse api_base with a path prefix ending in /v1, or with a query string, lost the prefix or the query on the way to the meta responses path. Graft the default Vertex path under a /v1 or /v1beta1 base, and append it to any other base path while keeping the query muse-ember-1.0 was the only Muse row without supports_pdf_input, so /model/info showed null for it while the bridge already forwarded PDF parts The WebSocket test now streams a turn through the managed bridge instead of reading a flag, and _first_set is renamed to _first_non_empty (cherry picked from commit b433bcb702d3e65f9af51d3a3b9a1923d1ef99f6)
…gh the Codex chat bridge, accept the publisher api_base Muse rows now mark the reasoning efforts Vertex refuses, so they answer 400 or drop under drop_params. A Muse request that asks for the chat completions bridge still reaches its Responses endpoint, and an api_base that already names the Meta publisher path keeps working (cherry picked from commit 910b4aad6106f21680e4cf8f712a0d9c13ff9f5b)
The Responses-to-chat bridge joins a namespace and its member as {namespace}__{member}. Codex with a ChatGPT login sends MCP namespaces whose joined names run past the 64-character limit that chat providers enforce, so Vertex Muse refused the request. The bridge now shortens those names with the existing truncate_tool_name convention and maps them back to the original namespace and member in the response
(cherry picked from commit 6da3fb527dbce4d2fe46f7bbf979d30a01bc9481)
…o its chat name (cherry picked from commit 186aec657052035035feaa0ad9f4839843853246)
…tool names working
Vertex Muse takes only function and namespace tools and answers 400 for web_search, local_shell, mcp and custom tools. Codex over /v1 sends web_search by default, so every Codex turn failed even with drop_params. Under drop_params those tools are now removed, and tools is dropped when none are left
Shortening bridged {namespace}__{member} names over 64 characters hid the full name from the tool policy guardrail, so a policy on it stopped matching, and from Headroom, which lost the retrieve hold-back for Responses input. Both now see the full qualified name, and Headroom pairs Responses function_call items by call_id
The same change let a top-level function named like a long namespace member through the collision check, so a forced tool_choice on it called the member instead. It also left a replayed function_call that carries the full name and no namespace pointing at a tool the model was never given. The collision check now compares both names, and replayed full names map to the shortened chat name
Adapted for lts/1.108.x: the tool policy guardrail reads full names through namespace_member_qualified_names, and the request tools for replayed names are validated with the existing TypeAdapters, since this line has no request_tools helper
(cherry picked from commit 7515af106353fc4a2195b71608b234b9bf074f8c)
…name
A namespace member named after another member's shortened {namespace}__{member} name got the same chat name, so the bridge kept only one of them and a call meant for one tool went to the other. The collision check now also rejects two namespace members that map to the same chat name
(cherry picked from commit 74a863ebbe33886a98953d90bc2a1732c85603b0)
Muse answers a call to a namespace member as one function_call named {namespace}.{member} with no namespace field, in the JSON response and in the stream. Codex over /v1 then rejects the call as unsupported. The Muse adapter now splits that name back into its namespace and member name, but only when the request declared that namespace with that member, since Muse also accepts dotted names for top-level functions and returns them unchanged
(cherry picked from commit 463766a9fc24771d630568524461d11c58de568f)
…rt_50768_lts_1_108_x # Conflicts: # uv.lock
…the bridge sends them The guardrail scan flattens namespace tools to show them to the guardrail, but the provider still receives the namespaces as declared, so a collision between shortened chat names there is not an error. Only the Responses-to-chat bridge sends the shortened names, so the collision checks now run in that transform. (cherry picked from commit 0410bff0f965ad4ad5f418122ff5e7dbb9fb308f)
…mespace members on lts/1.108.x 640f046 validated the request's tools with a strict list adapter, so a request whose tools field was not a list answered 500 before any guardrail ran. Non-list tools now name no namespace members, as on main.
…t name A guardrail that drops one of two tools whose shortened chat names match now keeps the survivor it returned, matched by content. A rewrite that cannot be matched that way is rejected instead of sent unrewritten. (cherry picked from commit 5236af50f4879f7bc72df509d6a40367fce35e2d)
…ique content The guardrail scan sees full namespace member names again, as on the merge base, so shortened names no longer collide in the guardrail's view. When a guardrail drops one of several tools that share a chat name, the kept ones are matched by content only when exactly one alignment fits, first exactly and then ignoring descriptions and default fields, and otherwise the rewrite is rejected. Groups the guardrail did not shrink keep positional matching, and the merge computes each key once (cherry picked from commit e93ebdff8706f18fa3c9123e2ab74c1a301bfe6b)
…es in the guardrail view When a guardrail drops one of several same-named top-level function tools and edits another, every match sends the guardrail's own tool, so the kept one is taken in order instead of rejecting the rewrite. Namespace members still need exactly one match, since a wrong match would send a tool the guardrail dropped. Replayed function calls in the messages a guardrail sees now use the full namespace member name, the same name it sees the tool by (cherry picked from commit 3cb291597b20e196292d7da6defc016b9732b7f1)
…ly response scan When a guardrail shrinks a group of same-named tools, each kept tool is now matched to its original by content in any order, so a reorder no longer answers 500. When one kept tool matches several top-level twins that differ only in fields the guardrail cannot see, the guardrail's own tool is sent instead of guessing one twin. A replayed namespace member call is compared under its full name, so a message rewrite resends it as it came. In logging_only mode a request rewrite the endpoint cannot apply no longer drops the response scan (cherry picked from commit d55647f)
…e order (cherry picked from commit d141c0e)
The merge rescanned and revalidated both tool lists once per distinct tool name on every guarded Responses request, which made unchanged tool sets quadratic. It now groups positions by name in one pass, and a guardrail that drops and reorders same-name tools still maps each surviving tool to its own original. (cherry picked from commit 1aefb27)
A client-caused flattened name collision raised a bare ValueError and surfaced as a 500. It now raises BadRequestError, and the prompt caching deployment check runs the same validation again before building chat forms for its prefix key. (cherry picked from commit 2d59f57)
Builtin tool types such as web_search, mcp, custom and local_shell were forwarded to Vertex when drop_params was off and failed there with a provider error. They now fail fast with UnsupportedParamsError before any request is sent, matching store, truncation, tool_choice and reasoning effort handling. (cherry picked from commit 06d041a)
When two tools share one chat form and a guardrail drops one copy, the returned form cannot say which original survived, so the merge could keep the rejected member. The rewrite is now reported unappliable instead of guessing. (cherry picked from commit 8571a9f)
…nd show guardrails full tool names A guardrail that edited one of two MCP servers sharing a server_label and dropped the other made the request fail, because the merge could not tell which server the edit came from. An MCP server's chat form is the server itself, so the edit is sent as returned. The guardrail messages view for /v1/responses now names namespaced calls by their full name, not the 64-character provider name, so request guardrails see the same names the tool policy checks. Same change as a9cfa7b on the main branch litellm_responses_cold_replay_call_names.
… API path (BerriAI#48119) * fix(responses): honor per-call custom pricing on the native Responses API path Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(responses): narrow the custom pricing regression test to the type gates Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor(main): expose register_custom_pricing_for_request for the responses path Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(responses): mark custom pricing test locals Final Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(responses): price per-call custom rates request-locally instead of registering them globally Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(responses): bind per-call rates on the request logging object instead of inferring them in Logging Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(responses): keep Router deployments on the cost-map pricing path Router inherits cache rates onto the deployment's cost-map entry, so a routed Responses call binds no request-local price and keeps billing cached tokens at the inherited rate. Moves the deployment-id lookup to router_utils so the Responses and completion paths share it. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(responses): gate request-local pricing on the typed deployment model_info Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit e04e89c)
…#48119 is on the line efad10a dropped this assertion because the line lacked BerriAI#48119. With that fix picked, a per-call input_cost_per_token and output_cost_per_token price the Muse call again.
Contributor
Contributor
|
bugbot run |
Contributor
Contributor
|
bugbot run |
…backport_50768_lts_1_108_x # Conflicts: # litellm/responses/bridge_check.py
…rt_50768_lts_1_108_x
The line already replays a call to a namespace member named like its namespace under the name its tools declared, so only that regression test comes over for it (cherry picked from commit 298e7f1)
…me back in When a guardrail edits one of two same-named tools and drops the other, and the edit is as close to both as either is to the other, it now takes the slot that keeps its order around the uniquely named tools the guardrail returned, instead of always the first slot (cherry picked from commit d83c813)
Contributor
Contributor
…nnot stall the event loop (cherry picked from commit 1706add)
…n a large group passes the budget (cherry picked from commit a7b15b5)
…st the scoring budget A same-named group too large for nearest-match scoring now pairs kept tools with originals in order within each content match, as main does, instead of falling back to position across namespaces (cherry picked from commit dd13130)
Contributor
Contributor
|
bugbot run |
Contributor
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 5ec8d22. Configure here.
6 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handwritten 1-3 sentence description
Add native Responses support for Meta Muse models on the 1.108 LTS line. This is the LTS twin of #50768, which merges first
Details
TLDR
Problem this solves:
How it solves it:
Backport checklist
make check BASE_REF=origin/lts/1.108.xpassMain to LTS commit map and line adaptations
request_tools)completion_args)drops_paramsfor the Muse adapter, drops a price assertion needing fix(responses): honor per-call custom pricing on the native Responses API path #48119, and sorts imports. 95e495b restores that assertion now that fix(responses): honor per-call custom pricing on the native Responses API path #48119 is on the linerequest_toolshelper, which the line lacks without fix(responses): keep the namespace == name shape for deferred top-level tools #50602response_costfrom fix(openai): cap and bill web search rounds on Responses-pinned chat completions #51802, which the line lacks, and hoists with the line'shoist_additional_toolstool_namesparametercompletion_argsbuild and leaves out a main-only test that shared the conflict regiontool_fields, where the picks moved itUser Flow
Before, a developer who adds a Vertex-hosted Muse model to the proxy gets an HTTP 500 instead of an answer
vertex_ai/meta/muse-ember-1.0to the proxy config asmuse-ember-1.0withvertex_location: globaland Google service account credentialsPOST http://<proxy>/v1/chat/completionswith{"model":"muse-ember-1.0","messages":[{"role":"user","content":"hi"}],"max_tokens":16}Unknown partner model: meta/muse-ember-1.0.POST /v1/responsesandPOST /v1/messagesfail too, and so do Wonder 1.0 and Spark 1.3After, the same developer gets normal answers from all three Muse models on chat completions, responses and messages, with the cost tracked
x-litellm-response-costheaderPOST http://<proxy>/v1/responseswith{"model":"muse-ember-1.0","input":"hi"}, streamed and not, and get HTTP 200 with aresp_...response or aresponse.completedeventPOST http://<proxy>/v1/messageswith an Anthropic-shaped body and get HTTP 200 with amessageresponseGET http://<proxy>/spend/logs?request_id=<id>and see each request under the configured model with its costRelevant issues
Partially addresses #51074, for the Meta publisher only
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Vertex AI with #50768's setup, two 2-worker proxies per leg sharing Postgres and Redis
Last updated: 5ec8d22. H12 to H14 ran before at 91579a6 and after at 5ec8d22 (bound.md). C80 and H9 ran before at e83afb8 and after at 91579a6 (lts_r4.md), H6 to H8 before at 23af0e8 and after at e83afb8 (lts_r2.md), and the rest after at 742940a (lts52.md, lts51.md). Later picks touch only tool names, guardrail edits and per-call prices, so those results stay valid
Earlier commits
C75 and C76 failed at 82ae95f and passed at 20c8fef (
lts_picks.md). The cold storage smoke, C73 and C74 failed before their picks and passed after (lts_cold.md,c73.md,c74.md). Runs at earlier heads are inlts43.md,lts_before.md,lts_after.mdandlts_tip.mddocsMCP serverssearchfunctionssearchfunctionsa__b'sc, named likea'sb__caaC11 to C76 results
The line has no
/backend-api/codex, so C46 does not applyC79 and C80 stored call replay
/v1/responseswith the OpenAI SDK. Its input holds an earlier call to the 67-character joined namemcp__codex_apps__codex_document_control___get_document_tool_schemas, and the namespace's tools go once intoolsand once in anadditional_toolsitem. C80 also sends a note of about 4,800 characters, so the turn's spend row is cut short and the replay has to read the turn back from cold storage/spend/logsshows turn 1. For C80, also wait until it showstruncatedwith a cold storage key and the S3 bucket holds that objectprevious_response_idEach leg runs two 2-worker proxies sharing Postgres, Redis and an S3 cold store, with
store_prompts_in_spend_logs: trueandcold_storage_custom_logger: s3_v2, oncustom_openai/gpt-5.4-miniagainst OpenAI and on Vertex AIgemini-3.8-flash. At the merge base 7ab941f, the OpenAI-compatible route answers HTTP 400string too long. Expected a string with maximum length 64, but got a string with length 67at turn 1 in both cases and both placements, since the line sends the joined name as is. At 3ffd90d, all eight turn 2 calls answer 200 withN-41. Vertex AI accepts the long name, so Gemini passes on both legs. C80 also ran at 742940a, the commit before 3ffd90d, where turn 1 answers 200 and turn 2 answers 400 for the 67-character name on the OpenAI-compatible route, and at 17c03e2, where all eight turn 2 calls answer 200 (lts_tip95.md)The commands and output are in
lts80.mdin this gist/live-pr-risk at 742940a, 3ffd90d, 95e495b and 8e2ba39
Base f5f4134 and head 742940a, each two 2-worker proxies sharing Postgres and Redis, with a forwarding recorder in front of api.openai.com and api.anthropic.com. Turn 1 goes to proxy 1 and later turns alternate proxies through
previous_response_idLeaving out ids, message text and the model's thinking signatures, every recorded provider request is the same on both sides except the replayed history call's name, which head sends as the shortened name the tools declare. R2's short name is sent the same way on both sides. At 3ffd90d the cold storage replay ran live as C80 with a recorder in front of api.openai.com. The merge base declares and calls the 67-character name and gets 400, and head declares and calls the 64-character name and gets 200. The new rename has one caller, the replay, and does nothing unless the turn came from cold storage
For 17c03e2, the merge base 7ab941f, 3ffd90d and the tip 95e495b ran the same guardrail cells on
/v1/responseswith two MCP servers sharing a label, an MCP server beside a function, and twocode_interpretertools, each with a recorder in front of api.openai.com. Only R6, which is H4, differs. 3ffd90d answers 500 and sends nothing, while the merge base and the tip answer 200 and send the DeepWiki server alone atrequire_approval: always. The messages view change reaches only the Bedrock and semantic guard guardrails, which read message text and no tool names (risk53.md)The guardrail cells, H4 and H5 match c9a0e74 at 8e2ba39 (lts_tip8e.md)
The commands and output for 742940a and 3ffd90d are in
risk50.mdin this gistBefore (7ab941f)
C1 the reporter's chat request
After (742940a)
C1 the reporter's chat request
C48 and C51 Codex TUI, before and after
C48 Codex TUI over /v1, drop_params
codex_tui_v1.shpointing itslitellmmodel provider at the leg's proxy/v1with an API key, and the modelmuse-ember-1.0-dropparams, a deployment withdrop_params: trueRun the shell command: echo QA_TOOL_OK. Then reply with its output only.and press Enterywhen Codex asksBefore, at 7ab941f, Codex shows
We're currently experiencing high demand, which is how Codex 0.169.0 shows an HTTP 500 (codex-rs/codex-api/src/api_bridge.rsin openai/codex), and never runs the commandAfter, at 742940a, Codex runs the command and answers
QA_TOOL_OKC51 Codex TUI over /v1 calls an MCP tool on muse-spark-1.3
codex_mcp.shpointing itslitellmmodel provider at the leg's proxy/v1with an API key, the modelmuse-spark-1.3, andweather_server.pyas theweatherMCP server, whoseget_weathertool returns a code wordUse the weather MCP tool to get the weather in Paris, then tell me the code word it returns.and press Enterweathertool call when Codex asksBefore, at 7ab941f, Codex shows the same HTTP 500 message and never calls the tool
After, at 742940a, Codex calls
weather.get_weatherand answers with the code wordPELICANEach lts51 leg ran two 2-worker proxies at its stated sha, as the boot lines in lts_tip95.md show. C51a to C51d send Codex's namespace shape with curl. Their commands and output, and every other case's on both legs, are in
lts51.mdin this gistRig notes
data: [DONE]Type
🆕 New Feature
Caveats (if any)
Low
max_tokensandmax_output_tokensas None, since Google publishes no output limitnative_output_fallback.pyis unformatted on lts/1.108.x and unchanged hereosv-scanflags a dev dependency advisory whose lts/1.108.x ignore expired, fixed on main in build(deps): bump @azure/msal-node to 7.x in vscode-extension to clear osv-scan #50198llms-anthropicfails a fix(deepseek): forward output_config.effort and thinking as sent on /v1/messages #52196 test that also fails on lts/1.108.xrouter_code_coveragefails as it does on the line since 66ab196completion()andembedding()still write per-call prices intolitellm.model_costDecisions
The same decisions as #50768 and #54240
Final Attestation
Bugbot summary