Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
vertex: partner models (DeepSeek V4.1 Flash, GLM, gpt-oss) go to Google's OpenAI-compatible chat completions
yetone40f206dff112
diff --git a/docs/reference.md b/docs/reference.mdindex c6122ad2d..668a55c3a 100644--- a/docs/reference.md+++ b/docs/reference.md@@ -874,7 +874,9 @@ shows them, so magpie shows no plan usage for these keys.Google Vertex AI (`google-vertex`), which Google's documentation now callsGemini Enterprise Agent Platform, serves Google's Gemini models from your own-Google Cloud project, which is billed for them. It takes no API key: each+Google Cloud project, which is billed for them. It serves the+[partner and open models](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/maas/call-open-model-apis)+too, such as DeepSeek, GLM and gpt-oss. It takes no API key: eachrequest is signed with a token minted from your Google credentials. First turnon the Agent Platform API (`aiplatform.googleapis.com`) in the project (billinghas to be on there), then sign in with `gcloud auth application-default login`@@ -910,7 +912,7 @@ so magpie gives each location the models it answered with on 2026-10-06| Location | Models || --- | --- |-| `global` | `gemini-3.8-flash`, `gemini-3.7-flash`, `gemini-3.6-flash`, `gemini-3.5-flash`, `gemini-3.5-flash-lite`, `gemini-4-argon`, `gemini-3.1-pro-preview`, `gemini-3.1-pro-preview-customtools`, `gemini-3.1-flash-lite`, `gemini-3-flash-preview`, `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite` |+| `global` | `gemini-3.8-flash`, `gemini-3.7-flash`, `gemini-3.6-flash`, `gemini-3.5-flash`, `gemini-3.5-flash-lite`, `gemini-4-argon`, `gemini-3.1-pro-preview`, `gemini-3.1-pro-preview-customtools`, `gemini-3.1-flash-lite`, `gemini-3-flash-preview`, `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite`, `deepseek-ai/deepseek-v4.1-flash-maas`, `zai-org/glm-5.2-maas`, `openai/gpt-oss-120b-maas` || `us`, `eu` | `gemini-3.8-flash`, `gemini-3.7-flash`, `gemini-3.6-flash`, `gemini-3.5-flash`, `gemini-3.5-flash-lite`, `gemini-3.1-flash-lite` || A region | `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite` |@@ -925,6 +927,26 @@ magpie provider models google-vertex all # back to the location's list`magpie provider set google-vertex location=…` keeps the models picked, so pickagain after a move.+A partner model is one whose id names its publisher before a slash, as+`deepseek-ai/deepseek-v4.1-flash-maas` does. magpie asks it on Google's+OpenAI-compatible chat completions in your project+(`…/locations/<location>/endpoints/openapi/chat/completions`) with the same+credentials, and asks a Gemini model on generateContent, with nothing to set.+The three in the `global` row are the ones Google's docs list as live there on+2026-10-28. Another partner model (one in preview, or one Google lists later,+such as `google/gemma-4-26b-a4b-it-maas`) is typed in under its full id, as+any model is:++```sh+magpie provider models google-vertex gemini-3.8-flash deepseek-ai/deepseek-v4.1-flash-maas google/gemma-4-26b-a4b-it-maas+```++Turn each partner model on for the project in Model Garden first: until then+Google refuses it. `magpie provider test google-vertex` tests Gemini, and a+partner model is tested on its own (right-click it in the app, or+`magpie provider test google-vertex <model>`). Claude on Vertex AI isn't+served: it takes a request of its own (`rawPredict`), not chat completions.+Google's [Priority PayGo](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/priority-paygo)and [Flex PayGo](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/flex-paygo)are asked for with request headers. The editor's **Headers** offers both,diff --git a/docs/subsystems/gateway-routing.md b/docs/subsystems/gateway-routing.mdindex 1daa5a9df..bb43072bf 100644--- a/docs/subsystems/gateway-routing.md+++ b/docs/subsystems/gateway-routing.md@@ -41,7 +41,7 @@ backfilled; see [Gateway Session Aggregation](gateway-sessions.md).| One try | `attempt` sends one candidate the request. It goes through the proxy of the account or key it uses, else the provider's (`p.Via`, `ProxyChoice`: `AccountProxies` holds an account's by its name, a key's by its `KeyID`). A request magpie makes for one provider while serving another's (a web search, an image description, a classifier call) takes its own provider's proxy or the global one, never the outer one: `netproxy.With` replaces a choice the context already names, "" too, and `webSearch` starts from none, so the search APIs follow the global proxy (#1522). A provider of the user's set not to check its certificate (`InsecureTLS`, #2383) has it skipped for its own base URLs' hosts alone, through `p.Via` ([Providers and accounts](providers-accounts.md)). Every request to one vendor's host shares one HTTP/2 connection (`upstreamTransport`); one with no frame for 20s is pinged, and dropped when no answer comes within 10s (`netproxy.HTTP2Health`, on `http.DefaultTransport` too), so a connection gone silent without closing (a proxy's way out died, a NAT forgot the flow) fails the requests on it, which move on as a 502 does, and the next request dials a new one. A live vendor answers a ping whatever its streams are doing, so a long wait for a first byte is not cut by it (#2843: a group's requests hung with no first byte until a restart; `TestGroupMovesOnFromSilentHTTP2Connection`). A large body (64KB or more, or of no stated length) is pinged too, as a silent connection takes a body that fits its send buffer, but its ping's answer is queued behind the body's own DATA, so on a slow uplink a working connection loses it (#3909: a ~680KB turn on a 2-10KB/s uplink failed every try). Such a body whose connection was dropped for a lost ping is sent once more, through `GetBody`, on a new connection that is not pinged and is given up on when a write moves no bytes for a minute (`uploadTransport`); for 30 minutes after, large bodies go there at once (`drawsApart.slow`; `TestUploadStillUnderwayIsNotCutByHealthPing`, `TestSlowUplinkSkipsTheLostTry`, `TestLargeBodyOnSilentConnectionIsSentAgain`). A subscription with its own client is served specially, such as Claude through the genuine Claude Code. The request is relayed as is (`passthrough`) when the model is usable on the agent's API, except that a Claude model where the provider has an Anthropic URL is translated to Messages from Chat or Responses too (`OnMessages`: OpenCode speaks Chat for every model, and a relay drops cache_control there), unless the user set the model's API or the vendor's list names its APIs. An account that only streams (`Account.Stream`: a plugin's, and most subscriptions magpie signs in to) has a request that asked for one body translated, which magpie always asks streamed, except a plugin's on Responses (`gathers`): that is relayed all the same, asked with `stream:true`, and the client given the `response` of the stream's `response.completed` (or `response.incomplete`) as one JSON body (`gathered` in [`gathered.go`](../../internal/gateway/gathered.go); its `output` filled from the stream's `response.output_item.done` items, or else its text, when that event's is empty). So the tools the vendor runs itself, and its response's `tools` and usage details, reach the client (plugins#112: a translation dropped Grok's `x_search`, and Grok answered without searching; `TestGrokPluginNonStreamKeepsHostedTools`). A stream that fails or ends before that event is a 502 (`TestGrokPluginNonStreamEndedShort`), never an empty 200. A Messages request is still translated, its stream having no event that holds the whole reply, and so is a subscription magpie signs in to itself (the ChatGPT backend's, Qoder's): its own code fits its requests. A request offering web search to a provider that doesn't search by itself is translated too, so magpie can search for it (`search.go`; a provider that searches for some of its models only, Command Code's Provider API, lists them in `searchModels` by API, and none count under its `x-cmd-zdr` header, #1590), but on the agent's own API where the provider serves it and no `ResponsesFirst`/`MessagesFirst` rule prefers another: Codex offers web_search on every turn, and each went out as Chat (#997). Otherwise it is translated (`translate`) to the first API `usable` gives: Chat, except Responses for OpenAI's models where their maker serves them (`ResponsesFirst`), Responses for every model at ModelScope, whose Chat API reports neither the tokens its cache answered nor reasoning while its Responses API reports both (`ResponsesTellsCache`, #1578; a 404 there sends the model to Chat, and only there), and Anthropic's Messages for a Claude model where the provider has an Anthropic URL (`MessagesFirst`, which keeps its cache breakpoints, #997). An API that answers the model is not served there (`wrongEndpoint`, `catalog.WrongEndpoint`: the English wordings and AgentRouter's Chinese one, #3766, read escaped too; a model's test reads them as well, see [Providers and accounts](providers-accounts.md)) is remembered in `unfit` until magpie restarts. A Chat API that refuses function tools with reasoning, with no other API to take them to, is asked once more with `reasoning_effort` `none` (#176), unless `none` is known refused (`turnedAway`); `none` refused naming the levels, the tools refusal is the answer, not a retry at the lowest level (#2670). When every API has turned the model away, the API the user picked for it (`ModelAPI`) is asked again, and without a pick each API the provider has a URL for (`Speaks`), Chat first. `Provider.Native`, the API agents with a per-model API (Pi, omp, droid) are wired to ask on, follows the same order. A custom provider with a Gemini URL (#1346) has Gemini last among the APIs it speaks: a Gemini client's request is relayed there, and any other is translated to it when it has no other, or when the user set Gemini as the model's API (`SetModelAPI` takes chat, responses, anthropic or gemini, each only where the provider has its URL; a model set to Gemini has no `Native`, so those agents ask it on their own API and it is translated). Upstream it is always asked `models/{model}:streamGenerateContent?alt=sse` under the base (`upstreamPath`), the model only in the path (`forwardOnce` drops the body's), so a Gemini client that asked for one JSON body is translated, as for Factory's generate route. | [`gateway.go`](../../internal/gateway/gateway.go) || Trace | The Routing view's record of each decision, written where the decision is made: candidates, rests, which try answered. `Route.Folder` is the folder the agent says it works in (`workDir`), its last two levels only (`shortFolder`, e.g. `workspace/magpie`), never the full path; a request that says none (a title, a topic check) takes its session's as said last (`trace.sessionFolder`), one without a session id has none (#1068). It is kept in the routing history on disk for as long as the route is (`history.go`: 30 days, 200 MB). The GUI shows it in By session's headings, a request row's tooltip, the stage's agent working in more than one folder, and the tray panel's agent tooltip. | [`trace.go`](../../internal/gateway/trace.go) || Prompt | What each request's prompt held, part by part: the agent's system prompt, tool definitions (an MCP server's tools as one item), instruction files and skills, files its tools read, their other output, and the conversation. `inspectPrompt` reads it from the body as the agent sent it, before translation; `calibrated` scales the estimate to the prompt the vendor counted and sets the window of the model that answered. The route keeps names and sizes only, never the text, so the routing history on disk holds none. For the card's text (masaka on Discord), the trace keeps the last `promptBodies` (10) request bodies in memory only (at most 32 MiB each, 64 MiB together), masked as the vendor got them; for a model let have it unmasked, the body is kept as it went and masked when `PromptText` first reads it, so the request itself never waits on masking (#3973). `PromptText` reads a part's items and their text from that body again (`prompt_text.go`), served to the GUI as `/api/context/text`; once a body is dropped, or magpie quits, its text is gone. It goes on the trace as `Route.Prompt`, with `Route.Conv` naming a conversation that has no session id. The GUI's `/api/context` scores each agent from it (`internal/gui/context.go`). A session's line and its compactions are its own turns': a call with a `Kind`, a Claude Code subagent's (`Route.Sub`, from `x-claude-code-agent-id`), and, in a session whose turns carry tool definitions, a request without any (auto mode's classifier, the title, the quota check) are left out, so a classifier's 40K after a 100K turn is no compaction (`toolSessions`, `TestContextSideCallsAreNoCompaction`). | [`prompt.go`](../../internal/gateway/prompt.go) |-| Vertex AI | A [Google Vertex AI provider](providers-accounts.md#responsibilities-and-sources-of-truth) speaks Gemini alone. A request goes to `<base>/publishers/google/models/<model>:streamGenerateContent?alt=sse` (`provider.VertexPath`, `upstreamPath`), the model named as the user's upstream name for it says (`UpstreamNameIn`, which the usage log's endpoint names too), with no `model` or `stream` field in its body (`passthrough`, `forwardOnce`, `geminiRequest`). A Gemini client's request is relayed as it came, its own `thinkingConfig`, `safetySettings` and the rest kept: streamed there, asked whole to `:generateContent` (`provider.VertexWholePath`), which answers one JSON body (Factory's rule of translating a whole request, as its route only streams, isn't Vertex AI's). Every other API's is translated (`buildFor`, `buildVertex`) and its stream read by `codeAssistDecoder`, which gives thought parts as reasoning, never as the answer's text. Effort: `vertexEffort` fits it to the model's levels, reasoning turned off going as `minimal` fitted the same way, and holds a model whose levels aren't known to `low`…`high`. `vertexThinking` sends Gemini 3 a `thinkingLevel` (`includeThoughts` false with reasoning off) and 2.5 a `thinkingBudget` in the model's range (`vertexBudgets`): turned off, the budget that stops its thinking, or Pro's least, as Pro can't stop. Thought signatures are every Gemini path's (#1445): a call's signature reaches the client in its id (`signedID`) and goes back on the call it came on, while a call with none in a step Vertex AI signed goes without; a step with nothing to give back has every call sent `skip_thought_signature_validator`. A 400 `Invalid thought signature.` is asked again with every call sent so (`withoutSignatures`), for that request only. A 400 refusing `minimal` (`geminiRefusedLevel`) is asked again at the model's lowest other level (`onEffort`), and `markUnfit(offRefused)` keeps that level until magpie restarts. Both retries are the translated path's. Vertex AI's own Google Search grounding isn't used: `searchHosts` names only `generativelanguage.googleapis.com` for Gemini, so magpie searches for it (`search.go`). | [`vertex.go`](../../internal/gateway/vertex.go), [`gateway.go`](../../internal/gateway/gateway.go), [`codeassist.go`](../../internal/gateway/codeassist.go), [`gemini.go`](../../internal/gateway/gemini.go), [`gemini_signature.go`](../../internal/gateway/gemini_signature.go), [`search.go`](../../internal/gateway/search.go) |+| Vertex AI | A [Google Vertex AI provider](providers-accounts.md#responsibilities-and-sources-of-truth) speaks Gemini for its Gemini models, and chat completions for its partner models. A partner model (`provider.VertexPartner`: a `publisher/model` id such as `deepseek-ai/deepseek-v4.1-flash-maas`) goes to Google's OpenAI-compatible `<base>/endpoints/openapi/chat/completions` (`Base(Chat)`, `ListedAPIs`), signed with the same token, its full id in the body. It is relayed or translated there as any chat completions vendor is, and none of the Gemini rules below (`vertexEffort`, `vertexThinking`, signatures) touch it (`TestVertexPartnerModel`). A Gemini model's request goes to `<base>/publishers/google/models/<model>:streamGenerateContent?alt=sse` (`provider.VertexPath`, `upstreamPath`), the model named as the user's upstream name for it says (`UpstreamNameIn`, which the usage log's endpoint names too), with no `model` or `stream` field in its body (`passthrough`, `forwardOnce`, `geminiRequest`). A Gemini client's request is relayed as it came, its own `thinkingConfig`, `safetySettings` and the rest kept: streamed there, asked whole to `:generateContent` (`provider.VertexWholePath`), which answers one JSON body (Factory's rule of translating a whole request, as its route only streams, isn't Vertex AI's). Every other API's is translated (`buildFor`, `buildVertex`) and its stream read by `codeAssistDecoder`, which gives thought parts as reasoning, never as the answer's text. Effort: `vertexEffort` fits it to the model's levels, reasoning turned off going as `minimal` fitted the same way, and holds a model whose levels aren't known to `low`…`high`. `vertexThinking` sends Gemini 3 a `thinkingLevel` (`includeThoughts` false with reasoning off) and 2.5 a `thinkingBudget` in the model's range (`vertexBudgets`): turned off, the budget that stops its thinking, or Pro's least, as Pro can't stop. Thought signatures are every Gemini path's (#1445): a call's signature reaches the client in its id (`signedID`) and goes back on the call it came on, while a call with none in a step Vertex AI signed goes without; a step with nothing to give back has every call sent `skip_thought_signature_validator`. A 400 `Invalid thought signature.` is asked again with every call sent so (`withoutSignatures`), for that request only. A 400 refusing `minimal` (`geminiRefusedLevel`) is asked again at the model's lowest other level (`onEffort`), and `markUnfit(offRefused)` keeps that level until magpie restarts. Both retries are the translated path's. Vertex AI's own Google Search grounding isn't used: `searchHosts` names only `generativelanguage.googleapis.com` for Gemini, so magpie searches for it (`search.go`). | [`vertex.go`](../../internal/gateway/vertex.go), [`gateway.go`](../../internal/gateway/gateway.go), [`codeassist.go`](../../internal/gateway/codeassist.go), [`gemini.go`](../../internal/gateway/gemini.go), [`gemini_signature.go`](../../internal/gateway/gemini_signature.go), [`search.go`](../../internal/gateway/search.go) || Bedrock Mantle | A request on chat completions or Responses to an [Amazon Bedrock Mantle provider](providers-accounts.md#responsibilities-and-sources-of-truth) goes to the prefix that serves its model (`mantleRoutes`, `provider.MantleBase` in `forwardOnce`): `/openai/v1` for OpenAI's closed GPTs and xAI's Grok, `/v1` for the rest. A model Mantle refuses there with "model `x` isn't supported on this route" (a maker the rule doesn't know yet) is asked once more at the other prefix, and when it is taken there that prefix is remembered for the model in `unfit` (`mantleRouteKey`) until the gateway restarts. A model refused at both gets the first refusal and nothing is remembered (`mantleReroute`). Messages go to `/anthropic` alone. | [`mantle.go`](../../internal/gateway/mantle.go), [`gateway.go`](../../internal/gateway/gateway.go) |## Codex titles, descriptions, summaries and predictionsdiff --git a/docs/subsystems/providers-accounts.md b/docs/subsystems/providers-accounts.mdindex ca1c08b72..0800d6516 100644--- a/docs/subsystems/providers-accounts.md+++ b/docs/subsystems/providers-accounts.md@@ -32,7 +32,7 @@ keys and accounts per request is in [Gateway routing and fallback](gateway-routi| A provider with no key | A provider of the user's own saves, imports and is `Ready` with no key when it is a preset with `NoKey` or its host is on this computer or the user's own network (`keyOptional`, `ownNetwork`): localhost, a loopback, private, link-local or carrier-grade NAT (Tailscale's 100.64/10) address, or a `.local` name, read from the URL alone with no lookup. A company's keyless relay at a LAN address is taken as a local server is (iSnow_999 on X: a Codex relay at http://<LAN IP>:8080 was left out of a CC Switch import as "it has no API key"); a keyless address on the internet still needs its key. With no key it is asked as one on 127.0.0.1 is: a Responses request carries no `Authorization`. | [`provider.go`](../../internal/provider/provider.go), [`importapps.go`](../../internal/provider/importapps.go), [`import_lan_test.go`](../../internal/provider/import_lan_test.go) || A key a provider | One vendor's keys saved a provider each — an app that keeps an entry a key, as CC Switch does, imported (yuluo_yx on X: "NVIDIA #001" to "#600" at one address, "Mistral #0001"…) — are folded into one provider with those keys (`FoldCopies` at start-up, `foldAdded` after `ImportFromApps`): hundreds of copies listed every model hundreds of times in every agent's picker and found group, and 3,000 made `/api/state` 86 MB. At start-up only copies by name are folded: a base name and that name with a number after it (`copyBase`: " #12", or `freeName`'s " 2"), one at least numbered; an import folds what it added whatever their names. Either way they must be alike in all but their key (`foldShape`: the provider with its id, name, keys and on/off left out), what the settings say of their models (`modelPrefs`) and where they are named (`foldRefs`: Visible, the agents' picked, hidden and ordered models, the groups, the providers falling back to them), so one key shown to one agent and another to another stays apart. Not folded: a subscription's, a hidden one, one without a key, Vertex, one with a StepFun sign-in of its own. The first on, in the providers' order, takes the rest in; its name becomes the base and its key is named its old name. Each other is a key in order, named its name, off if it was off (all off: the provider is off, its keys on); its id goes in `Was`, so its calls count with the provider by their key (`ProviderKeyID` is the key's fingerprint, unchanged) and a model picked by the old id still reaches it. Group members, rules, weights and fallbacks naming them name the provider once; their per-model settings and fetched lists go; balance and window history kept by their id moves to their key's name (`foldHistories`). A providers.json that doesn't parse is left alone. It runs at every start and writes nothing when there is nothing to fold. `TestFoldCopies`, `TestFoldCopiesIntoOneOn`, `TestFoldCopiesUnreadable`, `TestImportFoldsAKeyAnEntry`. | [`fold.go`](../../internal/provider/fold.go), [`importapps.go`](../../internal/provider/importapps.go), [`main.go`](../../internal/cli/main.go) || A key's plan | A vendor whose plans take keys of their own (`PresetDef.KeyPlans`: zhipu, zai, stepfun, stepfun-cn, xiaomi, baidu-qianfan, tencent-cloud, huaweicloud, volcengine, siliconflow) lets each key say which of the preset's Regions it is for (`KeyAccount.Plan`, `Provider.KeyPlan` for the first; yckonnnn on X: a Volcengine pay-as-you-go key and an Agent Plan key in one provider). No plan, or the provider's own, is the provider's plan, as every key was before, and is stored as none (`SetKeyPlan`, the GUI's `keys/plan`). `WithKey` moves a key's copy to its plan's endpoints (`atKeyPlan`: chat, Responses, Anthropic, decide, key page, docs and catalog; a provider at a host of its own, a mirror or a test's fake vendor, keeps that host) and marks it a key's view (`keyView`), so nothing judges plans on it again. Only when the keys in use are on more than one plan (`PlansMixed`) does anything differ: the model list is each key's plan's (`fetch` goes to `fetchPerKey`; a plan with no list of its own, `planOnly`, is its preset list without a request, so Ark's Coding and Agent Plans ask nothing while pay as you go asks `/api/v3/models` with its own key); plan media (`planMedia`) are every plan's; each key serves its plan's models alone (`PlanServing`, read by the gateway's `perKeyBarred`; a model set for the key in `AccountModels` it serves); plan windows (`PlanQuotas`), Volcengine's and Tencent Cloud's access-key windows (`planViews`) and balances (`balance.go`) are read at each key's plan. Volcengine's keys carry nothing that says their plan, so none is guessed; Xiaomi's `tp-`, Tencent's `sk-tp-`, MiniMax's `sk-cp-` and Bailian's `sk-sp-` prefixes are documented in code but not used to set a plan. The editor's key row has a plan chip (`planPicker`, the app's own menu) while the provider has several keys or the key has a plan. Not done: a gateway key held to some keys of a mixed provider's video (`videoAsker`) may pick another key's plan; a mixed provider whose own plan has no balance source while a key's plan has is not read; StepFun's plan windows are a sign-in per site, unchanged. `TestKeyPlanEndpoints`, `TestKeyPlanServing`, `TestKeyPlanOldConfigsUnchanged`, `TestSetKeyPlan`, `TestKeyPlanModelList`, `TestKeyPlanViews`, `key-plan.test.cjs`. | [`key_plans.go`](../../internal/provider/key_plans.go), [`keys.go`](../../internal/provider/keys.go), [`models.go`](../../internal/provider/models.go) |-| Google Vertex AI | `google-vertex` (`VertexPreset`, `IsVertex`) is a provider of the user's own with no key. `Provider.Vertex` holds `project`, `location` (`global`, `us`, `eu` or a region; `global` when empty), `credentials` (a file; empty for Application Default Credentials) and `impersonate` (a service account's email). Save refuses a key given it, then normalizes them (`Normal`) and checks each (`check`); `normalize` clears the four URLs and any key put in `providers.json` by hand, which stands in for neither a token nor a project and leaves the provider as found savable, so the provider's one address is `vertexBase`, `https://<host>/v1/projects/<project>/locations/<location>`, its host following the location (`vertexHost`). It speaks Gemini alone (`Speaks`, `Base`). It is `Ready` once that address can be made, never from a key or an account; until then the app, `magpie providers` and the TUI say it needs a project, and `magpie provider <id>` says how to give it one. `hasEndpoint` counts it as a provider of the user's own, not a subscription's picks. An import link naming it is refused (`ParseImport`): its project and credentials are the user's own, which no link hands over. `Sign` refuses any other address and sets the bearer token before the user's `Headers`; `AuthHeaders` gives it no key header. Its models are its location's (`vertexModels`, in `planModels`): the preset has `NoList`, because Vertex AI has no list that says what a location serves. The lists are in the [reference](../reference.md#google-vertex-ai). | [`vertex.go`](../../internal/provider/vertex.go), [`provider.go`](../../internal/provider/provider.go), [`account.go`](../../internal/provider/account.go), [`rename.go`](../../internal/provider/rename.go), [`models.go`](../../internal/provider/models.go), [`importurl.go`](../../internal/provider/importurl.go) |+| Google Vertex AI | `google-vertex` (`VertexPreset`, `IsVertex`) is a provider of the user's own with no key. `Provider.Vertex` holds `project`, `location` (`global`, `us`, `eu` or a region; `global` when empty), `credentials` (a file; empty for Application Default Credentials) and `impersonate` (a service account's email). Save refuses a key given it, then normalizes them (`Normal`) and checks each (`check`); `normalize` clears the four URLs and any key put in `providers.json` by hand, which stands in for neither a token nor a project and leaves the provider as found savable, so the provider's one address is `vertexBase`, `https://<host>/v1/projects/<project>/locations/<location>`, its host following the location (`vertexHost`). It speaks chat completions and Gemini (`Speaks`, `Base`), each model one of them (`ListedAPIs`, which `ModelAPI` can't change for it): a Gemini model on generateContent at that address, and a partner model (`VertexPartner`: a `publisher/model` id, as every one models.dev lists for `google-vertex` has, such as `deepseek-ai/deepseek-v4.1-flash-maas`) on Google's OpenAI-compatible chat completions at `<address>/endpoints/openapi`. The provider's test asks Gemini alone, since a partner model answers only after the project turns it on in Model Garden. Each partner model has its own test (`TestModel`, `TestVertexPartnerModels`), and a test as Codex is refused as it is for Claude Code. It is `Ready` once that address can be made, never from a key or an account; until then the app, `magpie providers` and the TUI say it needs a project, and `magpie provider <id>` says how to give it one. `hasEndpoint` counts it as a provider of the user's own, not a subscription's picks. An import link naming it is refused (`ParseImport`): its project and credentials are the user's own, which no link hands over. `Sign` refuses any other address and sets the bearer token before the user's `Headers`; `AuthHeaders` gives it no key header. Its models are its location's (`vertexModels`, in `planModels`): the preset has `NoList`, because Vertex AI has no list that says what a location serves. The lists are in the [reference](../reference.md#google-vertex-ai). | [`vertex.go`](../../internal/provider/vertex.go), [`provider.go`](../../internal/provider/provider.go), [`account.go`](../../internal/provider/account.go), [`rename.go`](../../internal/provider/rename.go), [`models.go`](../../internal/provider/models.go), [`importurl.go`](../../internal/provider/importurl.go) || Vertex AI tokens | `vertexCredentialsFile` finds the credentials as Google's libraries find Application Default Credentials: the provider's `credentials`, else the file `GOOGLE_APPLICATION_CREDENTIALS` names, else `application_default_credentials.json` in gcloud's folder (`CLOUDSDK_CONFIG`, else `~/.config/gcloud`, `%APPDATA%\gcloud` on Windows); a `~/` that starts any of them is the home. `mint` reads three kinds: `authorized_user` (a refresh-token grant), `service_account` (an RS256 JWT, RFC 7523: `signed`) and gcloud's `impersonated_service_account`, whose `source_credentials` are minted and traded at IAM Credentials, along its `delegates`, for the account its `service_account_impersonation_url` names (`impersonationURL`: the token never goes to that URL's host). With `impersonate` set, the token those give is traded at IAM Credentials' `generateAccessToken` for a `cloud-platform` token of that account's, as gcloud's `--impersonate-service-account` does (`impersonateFor`); the credentials' account needs `roles/iam.serviceAccountTokenCreator` on it, which the 403 names. `vertexTokens` keeps one token per file and impersonated account, in memory only; requests made together mint it once, and those that waited through a mint that failed are given its error rather than each minting in turn (`mints`, `failed`). A mint cut short because its own request was given up on fails none of them: the next one mints. It is minted again within `vertexRefreshLead` (5 minutes) of expiry, or when the file's size or modification time has changed (gcloud signed in again). One mint, every exchange included, gets `vertexMintWait` (30 seconds). The file is only read. | [`vertex.go`](../../internal/provider/vertex.go), [`signin.go`](../../internal/provider/signin.go) || Amazon Bedrock Mantle | `bedrock-mantle` ("Amazon Bedrock (Mantle)", @marktoown on X) is a vendor preset beside the runtime's `bedrock`, with the same Bedrock API key and seventeen regions of its own (`mantleRegions`: the `bedrock-mantle.{region}.api.aws` hosts that answered on 2026-10-16). Chat completions and Responses are at `/v1`, Messages at `/anthropic`; unlike the runtime it lists its models (`GET /v1/models`; `NoList` stays the runtime's alone). Its OpenAI APIs serve each model under one of two prefixes: OpenAI's closed GPTs and xAI's Grok under `/openai/v1`, the rest under `/v1` (`MantleBase`, used by the gateway and the provider test's `tinyBody`). `IsBedrockMantle` is the preset or a provider added at a Mantle host (`mantleHost`), and `IsBedrock` includes it, so every Bedrock rule holds there too: Claude on Messages alone, the key as `x-api-key` alone, `max_completion_tokens`, no metadata, no Priority. A provider added at a Mantle address is given the APIs it wasn't (`mantleEndpoints`, in `normalize`), and a chat or Responses URL given at `/openai/v1` is moved to `/v1`, where the list is. | [`presets.go`](../../internal/provider/presets.go), [`provider.go`](../../internal/provider/provider.go), [`test.go`](../../internal/provider/test.go) || Subscription accounts | `Accounts` reads the credentials each agent keeps on disk or in the macOS Keychain; nothing is stored twice. With account discovery off (#1535, below) none of them is read. A built-in that has moved to its plugin is dropped (`Moved`), and plugin accounts are placed in its slot (`placeMoved`). `Sign` adds the account's own auth, then the user's `Headers`. | [`account.go`](../../internal/provider/account.go) |diff --git a/internal/gateway/gateway.go b/internal/gateway/gateway.goindex ad984ceaa..a9cad81ac 100644--- a/internal/gateway/gateway.go+++ b/internal/gateway/gateway.go@@ -5453,7 +5453,9 @@ func (s *Server) forwardTranslated(ctx context.Context, p provider.Provider, tor.Effort, req = e, &r}}- if p.IsVertex() {+ if p.IsVertex() && !provider.VertexPartner(model) {+ // Gemini's levels; a partner model on chat completions is sent+ // its effort as any OpenAI-compatible vendor isreq = vertexEffort(req, p.Efforts(model))}// the names in force, read once however many endpoints the request isdiff --git a/internal/gateway/vertex.go b/internal/gateway/vertex.goindex d72c7b9ff..9f711c038 100644--- a/internal/gateway/vertex.go+++ b/internal/gateway/vertex.go@@ -16,6 +16,12 @@ import (// at all on 2.5, is a 400 (vertexEffort, vertexThinking). A call's thought// signature goes back as Vertex AI gave it, as on every Gemini path// (gemini_signature.go): a call made with none on a step it signed is a 400.+//+// Its partner models (provider.VertexPartner: deepseek-ai/…, zai-org/…,+// openai/gpt-oss-…) are not Gemini: Google serves them on its+// OpenAI-compatible chat completions at the project (Base(Chat)), under+// the same token, and the gateway asks them there as it asks any chat+// completions vendor. Nothing in this file is done to them.// buildVertex is a streamGenerateContent body for Vertex AI, which names the// model in its path and has none in here.diff --git a/internal/gateway/vertex_test.go b/internal/gateway/vertex_test.goindex 2e3d38e56..b837f2cfd 100644--- a/internal/gateway/vertex_test.go+++ b/internal/gateway/vertex_test.go@@ -135,6 +135,22 @@ const (vertexMissingSig = "{\n \"error\": {\n \"code\": 400,\n \"message\": \"Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call `default_api:get_weather` , position 2. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.\",\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n")+// vertexPartnerStream and vertexPartnerWhole are a partner model's+// answer on Vertex AI's OpenAI-compatible chat completions, streamed and+// whole, in the shape Google's docs for its open models show+// (call-open-model-apis): chat.completion.chunk events, the last with the+// finish reason and usage, then [DONE].+const (+ vertexPartnerStream = `data: {"id":"chatcmpl-v41","object":"chat.completion.chunk","created":1761609600,"model":"deepseek-ai/deepseek-v4.1-flash-maas","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]}++data: {"id":"chatcmpl-v41","object":"chat.completion.chunk","created":1761609600,"model":"deepseek-ai/deepseek-v4.1-flash-maas","choices":[{"index":0,"delta":{"content":" from DeepSeek"},"finish_reason":"stop"}],"usage":{"prompt_tokens":9,"completion_tokens":4,"total_tokens":13}}++data: [DONE]++`+ vertexPartnerWhole = `{"id":"chatcmpl-v41","object":"chat.completion","created":1761609600,"model":"deepseek-ai/deepseek-v4.1-flash-maas","choices":[{"index":0,"message":{"role":"assistant","content":"Hello from DeepSeek"},"finish_reason":"stop"}],"usage":{"prompt_tokens":9,"completion_tokens":4,"total_tokens":13}}`+)+// vertexLevels are the reasoning levels models.dev gives Gemini's models.const vertexLevels = `{"google":{"models":{"gemini-3.8-flash":{"id":"gemini-3.8-flash","reasoning_options":[{"type":"effort","values":["low","medium","high"]}]},@@ -177,6 +193,13 @@ func (v *vertexUp) ServeHTTP(w http.ResponseWriter, r *http.Request) {if strings.HasSuffix(r.URL.Path, ":generateContent") {out, kind = vertexColours, "application/json; charset=UTF-8"}+ if strings.HasSuffix(r.URL.Path, "/endpoints/openapi/chat/completions") {+ // a partner model, on Google's OpenAI-compatible chat completions+ out = vertexPartnerStream+ if m["stream"] != true {+ out, kind = vertexPartnerWhole, "application/json"+ }+ }if refused := vertexSigRefused(m); refused != "" {code, out = http.StatusBadRequest, refused} else if v.reply != nil {@@ -849,3 +872,48 @@ func TestVertexRetriesOnlyForVertex(t *testing.T) {}}}++// A partner model on Vertex AI (deepseek-ai/deepseek-v4.1-flash-maas) is+// asked on Google's OpenAI-compatible chat completions at the project,+// signed with the same minted token, its full id in the body, from a Chat+// client, Claude Code and Codex, streamed or not, with nothing set beyond+// the Gemini provider the user already has; a Gemini model beside it is+// still asked at streamGenerateContent. Its effort goes as the client+// asked: Gemini's levels (vertexEffort) are not put on it.+func TestVertexPartnerModel(t *testing.T) {+ v := &vertexUp{}+ s := vertexServe(t, v, vertexLevels)+ const want = "/v1/projects/proj-1/locations/global/endpoints/openapi/chat/completions"+ const model = "google-vertex/deepseek-ai/deepseek-v4.1-flash-maas"+ for _, c := range []struct{ name, path, body string }{+ {"chat", "/v1/chat/completions", `{"model":"` + model + `","messages":[{"role":"user","content":"hi"}]}`},+ {"anthropic", "/v1/messages", `{"model":"` + model + `","max_tokens":100,"messages":[{"role":"user","content":"hi"}]}`},+ {"responses", "/v1/responses", `{"model":"` + model + `","input":"hi"}`},+ } {+ for _, stream := range []string{"false", "true"} {+ n := v.count()+ body := strings.TrimSuffix(c.body, "}") + `,"stream":` + stream + `}`+ out := vertexAsk(t, s, c.path, body)+ a := v.last(t)+ if v.count() != n+1 || a.path != want || a.auth != "Bearer ya29.vertex-test" || a.body["model"] != "deepseek-ai/deepseek-v4.1-flash-maas" {+ t.Errorf("%s stream %s: asked %d times, at %s with %q, model %v", c.name, stream, v.count()-n, a.path, a.auth, a.body["model"])+ }+ if _, gemini := a.body["contents"]; gemini {+ t.Errorf("%s stream %s: sent a Gemini body: %v", c.name, stream, a.body)+ }+ if !strings.Contains(out, "Hello") || !strings.Contains(out, "DeepSeek") {+ t.Errorf("%s stream %s: client given %s", c.name, stream, out)+ }+ }+ }+ vertexAsk(t, s, "/v1/chat/completions", `{"model":"google-vertex/gemini-3.8-flash","messages":[{"role":"user","content":"hi"}]}`)+ if a := v.last(t); a.path != "/v1/projects/proj-1/locations/global/publishers/google/models/gemini-3.8-flash:streamGenerateContent" {+ t.Errorf("Gemini asked at %s", a.path)+ }+ // translated from Codex's Responses, where Gemini's levels (low to+ // high when a model's own aren't known) would be put on it+ vertexAsk(t, s, "/v1/responses", `{"model":"`+model+`","reasoning":{"effort":"xhigh"},"input":"hi"}`)+ if a := v.last(t); a.path != want || a.body["reasoning_effort"] != "xhigh" {+ t.Errorf("effort xhigh sent at %s as %v", a.path, a.body["reasoning_effort"])+ }+}diff --git a/internal/provider/account.go b/internal/provider/account.goindex c0028a28a..13246f3c3 100644--- a/internal/provider/account.go+++ b/internal/provider/account.go@@ -159,6 +159,14 @@ func (p Provider) ListedAPIs(model string) []Protocol {return apis}}+ // Vertex AI serves Gemini on generateContent, and its partner models+ // (publisher/model) on chat completions alone+ if p.IsVertex() {+ if VertexPartner(model) {+ return []Protocol{Chat}+ }+ return []Protocol{Gemini}+ }// Factory serves each model on the one API droid sends it onif p.ID == "factory" && p.Account != nil {return factoryAPIs(model)diff --git a/internal/provider/modelprefs.go b/internal/provider/modelprefs.goindex 1f2e67b81..bffe22036 100644--- a/internal/provider/modelprefs.go+++ b/internal/provider/modelprefs.go@@ -470,7 +470,8 @@ func setModelAPI(ref, api string) (bool, error) {// ModelAPI is the API the user said p's model is asked on, when p has a// URL for it still.func (p Provider) ModelAPI(model string) (Protocol, bool) {- if len(p.Speaks()) < 2 {+ // Vertex AI's model id says its one API (ListedAPIs)+ if len(p.Speaks()) < 2 || p.IsVertex() {return "", false}proto := Protocol(heldSettings().ModelAPIs[p.ID+"/"+model])diff --git a/internal/provider/presets.go b/internal/provider/presets.goindex d38af3c6d..0febdfd25 100644--- a/internal/provider/presets.go+++ b/internal/provider/presets.go@@ -139,8 +139,12 @@ var presets = []PresetDef{Website: "https://aistudio.google.com", KeysURL: "https://aistudio.google.com/apikey"},// Google's Gemini models in the user's own Google Cloud project// (vertex.go): generateContent, signed with their Google credentials- // rather than a key. It has no list to ask that says which models a- // location serves, so they are given: these, every one global serves;+ // rather than a key; and its partner models (publisher/model ids,+ // VertexPartner) on Google's OpenAI-compatible chat completions there,+ // the live ones Google's docs list at global on 2026-10-28 (Gemma 4,+ // Experimental, is left to be typed in). It has no list to ask that+ // says which models a location serves, so they are given: these,+ // every one global serves;// vertexModels has the others'. Its Priority PayGo and Flex PayGo are// asked for with the two headers.{ID: VertexPreset, Name: "Google Vertex AI", Short: "Vertex AI", Icon: "vertexai-color", Kind: KindVendor,@@ -149,7 +153,8 @@ var presets = []PresetDef{NoList: true,Models: []string{"gemini-3.8-flash", "gemini-3.7-flash", "gemini-3.6-flash", "gemini-3.5-flash", "gemini-3.5-flash-lite","gemini-4-argon", "gemini-3.1-pro-preview", "gemini-3.1-pro-preview-customtools", "gemini-3.1-flash-lite", "gemini-3-flash-preview",- "gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite"},+ "gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite",+ "deepseek-ai/deepseek-v4.1-flash-maas", "zai-org/glm-5.2-maas", "openai/gpt-oss-120b-maas"},HeaderHints: []string{"X-Vertex-AI-LLM-Request-Type", "X-Vertex-AI-LLM-Shared-Request-Type"}},{ID: "deepseek", Name: "DeepSeek", Icon: "deepseek-color", Kind: KindVendor, Catalog: "deepseek",Chat: "https://api.deepseek.com/v1", Responses: "https://api.deepseek.com/v1", Anthropic: "https://api.deepseek.com/anthropic",diff --git a/internal/provider/provider.go b/internal/provider/provider.goindex cf3d4184b..8ce3eebc0 100644--- a/internal/provider/provider.go+++ b/internal/provider/provider.go@@ -1537,6 +1537,14 @@ func (p Provider) baseOf(api string) string {func (p Provider) Base(proto Protocol) string {switch proto {case Chat:+ // Vertex AI's partner models, on Google's OpenAI-compatible chat+ // completions at the project (VertexPartner)+ if p.IsVertex() {+ if b := p.vertexBase(); b != "" {+ return b + "/endpoints/openapi"+ }+ return ""+ }return p.Chatcase Responses:return p.Responses@@ -1579,7 +1587,9 @@ func (p Provider) Speaks() []Protocol {// Factory's Gemini models, on generateContent. A model droid didn't// list stays on the other three (factoryAPIs); this is not one of them.// A custom provider's Gemini API comes after the others it has.- // Vertex AI's, on generateContent alone, at its project.+ // Vertex AI's Gemini models, on generateContent at its project, after+ // the chat completions its partner models are served on (ListedAPIs+ // gives each model its one).if p.IsVertex() {if p.vertexBase() != "" {out = append(out, Gemini)diff --git a/internal/provider/test.go b/internal/provider/test.goindex de3556282..c4c899800 100644--- a/internal/provider/test.go+++ b/internal/provider/test.go@@ -70,6 +70,12 @@ func (p Provider) Test(ctx context.Context) []Result {}var out []Resultfor _, proto := range p.Speaks() {+ if p.IsVertex() && proto == Chat {+ // a partner model answers only once the project has turned it+ // on in Model Garden: the provider is tested on Gemini, and a+ // partner model by its own test (TestModel)+ continue+ }q, ok := p.keyFor(proto)model := p.testModel(q, proto)if !ok {@@ -192,7 +198,7 @@ func tinyBody(q Provider, proto Protocol, model string) (url, body string) {if q.IsBedrock() || q.IsAzure() {return q.mantleBase(q.Chat, model) + "/chat/completions", fmt.Sprintf(`{"model":%q,"messages":[{"role":"user","content":"hi"}],"max_completion_tokens":16}`, model)}- return q.Chat + "/chat/completions", fmt.Sprintf(`{"model":%q,"messages":[{"role":"user","content":"hi"}],"max_tokens":16}`, model)+ return q.Base(Chat) + "/chat/completions", fmt.Sprintf(`{"model":%q,"messages":[{"role":"user","content":"hi"}],"max_tokens":16}`, model)case Responses:return q.mantleBase(q.Responses, model) + "/responses", fmt.Sprintf(`{"model":%q,"input":[{"type":"message","role":"user","content":[{"type":"input_text","text":"hi"}]}],"max_output_tokens":16}`, model)case Anthropic:diff --git a/internal/provider/test_as.go b/internal/provider/test_as.goindex a4e16e222..f5ead83e1 100644--- a/internal/provider/test_as.go+++ b/internal/provider/test_as.go@@ -80,6 +80,11 @@ func (p Provider) TestsAs(client string) string {if p.IsOpenCode() || p.IsCline() || p.IsKilo() {return "its requests are asked as its own client already"}+ if p.IsVertex() && client == ClientCodex {+ // Google's own endpoints, as Claude Code's are below: its chat+ // completions serve the partner models alone+ return "a test is asked as Codex only of a relay"+ }if clientProto(client, p.Speaks()) == "" {if client == ClientClaudeCode {return "it has no Anthropic endpoint, where Claude Code's requests go"diff --git a/internal/provider/vertex.go b/internal/provider/vertex.goindex 1b9241f78..75607a93c 100644--- a/internal/provider/vertex.go+++ b/internal/provider/vertex.go@@ -174,6 +174,15 @@ func VertexPath(model string) string {return "/publishers/google/models/" + url.PathEscape(model) + ":streamGenerateContent?alt=sse"}+// VertexPartner is whether model is one of Vertex AI's partner or open+// models (Model as a Service: DeepSeek, GLM, gpt-oss, Gemma, Llama…),+// which Google serves on its OpenAI-compatible chat completions at the+// project (Base(Chat), …/endpoints/openapi) under a publisher/model id+// such as deepseek-ai/deepseek-v4.1-flash-maas. Every such id models.dev+// lists for google-vertex has the publisher before a slash, and no Gemini+// id on generateContent has one, so the slash is what tells them apart.+func VertexPartner(model string) bool { return strings.Contains(model, "/") }+// VertexWholePath is where a request for model answered as one JSON body// goes.func VertexWholePath(model string) string {@@ -215,9 +224,10 @@ func vertexGeneration(model string) int {return n}-// vertexModels are the Gemini models a location serves, as each answered+// vertexModels are the models a location serves, as each answered// on 2026-10-06: every one at global (and Gemini 4 Argon, there since-// 2026-10-13, #2155); Gemini 3's Flash models at us and+// 2026-10-13, #2155, and the partner models Google serves at global+// alone, VertexPartner); Gemini 3's Flash models at us and// eu, which serve no Pro, preview or 2.5; Gemini 2.5 at a region, where a// few add one more (asia-northeast1's gemini-3.5-flash), typed in by hand.func vertexModels(loc string) []string {diff --git a/internal/provider/vertex_test.go b/internal/provider/vertex_test.goindex b2580a089..ed48b8655 100644--- a/internal/provider/vertex_test.go+++ b/internal/provider/vertex_test.go@@ -177,6 +177,10 @@ func (f *vertexGoogle) ServeHTTP(w http.ResponseWriter, r *http.Request) {case vertex && strings.Contains(r.URL.Path, "/models/gemini-9-pro:"):w.WriteHeader(http.StatusNotFound)io.WriteString(w, "{\"error\":{\"code\":404,\"message\":\"Publisher Model `projects/acme-vertex/locations/global/publishers/google/models/gemini-9-pro` was not found or your project does not have access to it. Please ensure you are using a valid model version. For more information, see: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/model-versions\",\"status\":\"NOT_FOUND\"}}")+ case vertex && strings.HasSuffix(r.URL.Path, "/endpoints/openapi/chat/completions"):+ // a partner model, on Google's OpenAI-compatible chat completions,+ // answered as its docs show+ io.WriteString(w, `{"id":"chatcmpl-1","object":"chat.completion","created":1761609600,"model":"deepseek-ai/deepseek-v4.1-flash-maas","choices":[{"index":0,"message":{"role":"assistant","content":"Hi"},"finish_reason":"length"}],"usage":{"prompt_tokens":1,"completion_tokens":1,"total_tokens":2}}`)case vertex:io.WriteString(w, `{"candidates":[{"content":{"role":"model","parts":[{"text":"Hi"}]},"finishReason":"MAX_TOKENS"}],"usageMetadata":{"promptTokenCount":1,"candidatesTokenCount":1,"totalTokenCount":2},"modelVersion":"gemini-3.8-flash"}`)default:@@ -502,7 +506,7 @@ func TestVertexProviderListed(t *testing.T) {t.Fatal(err)}base := "https://aiplatform.googleapis.com/v1/projects/acme-vertex/locations/global"- if !p.Ready() || !p.On() || !slices.Equal(p.Speaks(), []Protocol{Gemini}) || p.Base(Gemini) != base {+ if !p.Ready() || !p.On() || !slices.Equal(p.Speaks(), []Protocol{Chat, Gemini}) || p.Base(Gemini) != base || p.Base(Chat) != base+"/endpoints/openapi" {t.Fatalf("ready %v, on %v, speaks %v at %q", p.Ready(), p.On(), p.Speaks(), p.Base(Gemini))}if !customIDs()["vertex-prod"] || PluginID("vertex-prod") != "vertex-prod-plugin" {@@ -1557,3 +1561,93 @@ func TestVertexMintWaitCancelled(t *testing.T) {stop()<-minted}++// Vertex AI's partner models (DeepSeek, GLM, gpt-oss: publisher/model ids)+// are served on Google's OpenAI-compatible chat completions at the+// project, …/endpoints/openapi/chat/completions, signed with the same+// Google token as Gemini, with nothing more set by the user: global lists+// them, each is tested there with its full id in the body, and a Gemini+// model is still asked on generateContent alone. The provider's own test+// asks Gemini, as a partner model answers only once the project turned it+// on in Model Garden.+func TestVertexPartnerModels(t *testing.T) {+ vertexHome(t)+ f := newVertexGoogle(t)+ file := filepath.Join(t.TempDir(), "application_default_credentials.json")+ writeFile(t, file, vertexUser("1//0g-test-refresh"))+ if err := Save(vertexAt("global", file)); err != nil {+ t.Fatal(err)+ }+ p, err := Find("vertex-prod")+ if err != nil {+ t.Fatal(err)+ }+ base := f.url + "/vertex/v1/projects/acme-vertex/locations/global"+ if !slices.Equal(p.Speaks(), []Protocol{Chat, Gemini}) || p.Base(Chat) != base+"/endpoints/openapi" || p.Base(Gemini) != base {+ t.Fatalf("speaks %v, chat at %q, Gemini at %q", p.Speaks(), p.Base(Chat), p.Base(Gemini))+ }+ partners := []string{"deepseek-ai/deepseek-v4.1-flash-maas", "zai-org/glm-5.2-maas", "openai/gpt-oss-120b-maas"}+ listed := modelIDs(p.Available())+ for _, m := range partners {+ if !slices.Contains(listed, m) {+ t.Errorf("%s not listed at global: %v", m, listed)+ }+ if apis := p.APIs(m); !slices.Equal(apis, []Protocol{Chat}) {+ t.Errorf("%s asked on %v", m, apis)+ }+ if p.Native(m) != Chat {+ t.Errorf("%s native %v", m, p.Native(m))+ }+ }+ if apis := p.APIs("gemini-3.8-flash"); !slices.Equal(apis, []Protocol{Gemini}) {+ t.Errorf("Gemini asked on %v", apis)+ }+ for _, loc := range []string{"us", "us-central1"} {+ q := vertexAt(loc, file)+ if err := Save(q); err != nil {+ t.Fatal(err)+ }+ q2, _ := Find("vertex-prod")+ if got := modelIDs(q2.Available()); slices.ContainsFunc(got, VertexPartner) {+ t.Errorf("at %s, which serves no partner model: %v", loc, got)+ }+ }+ if err := Save(vertexAt("global", file)); err != nil {+ t.Fatal(err)+ }+ p, _ = Find("vertex-prod")+ rs := p.Test(context.Background())+ if len(rs) != 1 || !rs[0].OK || rs[0].Protocol != Gemini {+ t.Fatalf("provider test: %+v", rs)+ }+ rs = p.TestModels(context.Background(), []string{"deepseek-ai/deepseek-v4.1-flash-maas", "gemini-3.8-flash"})+ if len(rs) != 2 || !rs[0].OK || rs[0].Protocol != Chat || !rs[1].OK || rs[1].Protocol != Gemini {+ t.Fatalf("models' tests: %+v", rs)+ }+ calls := f.vertexCalls()+ if len(calls) != 3 {+ t.Fatalf("Vertex AI was asked %d times, want 3: %+v", len(calls), calls)+ }+ // the models' tests may go out together, in either order+ var chats int+ for _, c := range calls {+ if strings.HasSuffix(c.path, "/endpoints/openapi/chat/completions") {+ chats+++ var body struct {+ Model string `json:"model"`+ }+ json.Unmarshal([]byte(c.body), &body)+ if c.path != "/vertex/v1/projects/acme-vertex/locations/global/endpoints/openapi/chat/completions" ||+ c.header.Get("Authorization") != "Bearer ya29.minted-1" || body.Model != "deepseek-ai/deepseek-v4.1-flash-maas" {+ t.Errorf("partner model asked at %s with %q: %s", c.path, c.header.Get("Authorization"), c.body)+ }+ continue+ }+ if !strings.HasPrefix(c.path, "/vertex/v1/projects/acme-vertex/locations/global/publishers/google/models/gemini-") || !strings.HasSuffix(c.path, ":generateContent") {+ t.Errorf("Gemini asked at %s", c.path)+ }+ }+ if chats != 1 {+ t.Errorf("chat completions asked %d times, want 1", chats)+ }+}