diff --git a/site/public/docs/gemini.html b/site/public/docs/gemini.html index 1cb459a59..ae7b0a54a 100644 --- a/site/public/docs/gemini.html +++ b/site/public/docs/gemini.html @@ -317,6 +317,8 @@ magpie claude google-vertex/gemini-3.1-pro-preview
  • Checking a key. magpie provider test google sends a tiny request through each endpoint, or to each model you name. Add --as codex or --as claude-code to send it the way that agent would.
  • +

    More on Vertex AI: Google Vertex AI in Claude Code, Codex and other agents.

    +

    FAQ

    How do I use Gemini in Claude Code?

    Add a Gemini API key in magpie (Providers, Add provider, Google Gemini), then pick a model such as gemini-3.1-pro-preview on Claude Code’s row, or run magpie claude google/gemini-3.1-pro-preview. magpie writes Claude Code’s settings.json and translates each Messages request to Gemini’s Chat Completions, tool calls and streaming included.

    diff --git a/site/public/docs/ja/gemini.html b/site/public/docs/ja/gemini.html index 2284b45d7..3072ffb44 100644 --- a/site/public/docs/ja/gemini.html +++ b/site/public/docs/ja/gemini.html @@ -317,6 +317,8 @@ magpie claude google-vertex/gemini-3.1-pro-preview
  • キーの確認。magpie provider test google は各エンドポイントに、または指定した各モデルに小さなリクエストを送ります。--as codex や --as claude-code を付けると、そのツールと同じ形で送ります。
  • +

    Vertex AI の詳細:Google Vertex AI を Claude Code・Codex などのエージェントで使う。

    +

    よくある質問

    Claude Code で Gemini を使うには?

    magpie に Gemini API キーを追加し(プロバイダ、プロバイダを追加、Google Gemini)、Claude Code の行で gemini-3.1-pro-preview などのモデルを選ぶか、magpie claude google/gemini-3.1-pro-preview を実行します。magpie が Claude Code の settings.json を書き、Messages のリクエストを一つずつ Gemini の Chat Completions に変換します。ツール呼び出しもストリーミングもそのまま使えます。

    diff --git a/site/public/docs/ja/vertex.html b/site/public/docs/ja/vertex.html new file mode 100644 index 000000000..3442fb8f8 --- /dev/null +++ b/site/public/docs/ja/vertex.html @@ -0,0 +1,283 @@ + + + + + +Google Vertex AI を Claude Code・Codex で使う:自分の GCP プロジェクトで Gemini・Claude・DeepSeek・GLM · magpie + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    +

    ドキュメント · ガイド

    +

    Google Vertex AI を Claude Code・Codex などのエージェントで使う

    +

    Google Vertex AI(Google のドキュメントでは現在 Gemini Enterprise Agent Platform)は、自分の Google Cloud プロジェクトで Gemini を提供し、そのプロジェクトに課金されます。DeepSeek・GLM・gpt-oss などのパートナーモデルやオープンモデル、Anthropic の Claude も提供します。magpie の google-vertex プリセットは、これらを API キーなしで Claude Code・Codex・OpenCode などにつなぎます。各リクエストは Google の認証情報から作ったトークンで署名されます。

    +

    追加する

    +
      +
    1. API を有効にする。プロジェクトで Agent Platform API(aiplatform.googleapis.com)を有効にします。課金が有効である必要があります。
    2. +
    3. サインインする。gcloud auth application-default login を実行するか、サービスアカウントのキーファイルを用意します。
    4. +
    5. 追加してテストする。プロジェクト ID を指定してテストします。
    6. +
    +
    ターミナル
    gcloud auth application-default login
    +magpie provider add google-vertex project=my-project
    +magpie provider test google-vertex
    +

    アプリのエディターでは プロジェクト ID・ロケーション・認証ファイル・権限借用 で同じ内容を入力します。TUI の a はプロジェクトだけを聞き、残りは CLI で設定します。追加・一覧・表示では Google に問い合わせず、認証情報はリクエストの署名時に読みます。続いてエージェントのモデルを選びます。

    +
    ターミナル
    magpie claude google-vertex/claude-sonnet-5-5
    +magpie codex google-vertex/gemini-3.1-pro-preview
    +

    ロケーション・認証情報・サービスアカウント

    +
    ターミナル
    magpie provider set google-vertex location=us-central1        # global (default), us, eu or a region
    +magpie provider set google-vertex credentials=~/keys/vertex.json
    +magpie provider set google-vertex impersonate=vertex@my-project.iam.gserviceaccount.com
    +magpie provider set google-vertex impersonate=                # empty clears it
    + +

    ロケーションごとのモデル

    +

    ロケーションごとに提供されるモデルが違い、Vertex AI には問い合わせられる一覧がないため、magpie は各ロケーションに実際に応答したモデルを用意しています。

    + +

    asia-northeast1 の gemini-3.5-flash のように、リージョンがもう 1 つ提供している場合は、使いたいモデルと一緒に入力します。ロケーションを変えても選んだモデルはそのままなので、変えたあとに選び直してください。

    +

    パートナーモデル

    +

    パートナーモデルの ID はスラッシュの前に提供元が入ります(deepseek-ai/deepseek-v4.1-flash-maas、zai-org/glm-5.2-maas、openai/gpt-oss-120b-maas)。magpie は同じ認証情報で、プロジェクト内の Google の OpenAI 互換 Chat Completions に問い合わせます。設定は不要です。ほかのモデル(プレビュー版や後から公開されたもの)は完全な ID で入力します。

    +
    ターミナル
    magpie provider models google-vertex gemini-3.8-flash deepseek-ai/deepseek-v4.1-flash-maas google/gemma-4-26b-a4b-it-maas
    +magpie provider models google-vertex all     # back to the location's list
    +magpie provider test google-vertex zai-org/glm-5.2-maas
    +

    各パートナーモデルは、先にプロジェクトの Model Garden で有効にしてください。それまでは Google が拒否します。magpie provider test google-vertex は Gemini をテストします。パートナーモデルは単独で、アプリで右クリックするか、コマンドのあとにモデル ID を付けてテストします。

    +

    Vertex AI の Claude

    +

    ID が claude- で始まるモデルは、プロジェクト内の Anthropic の Messages API(streamRawPredict)に問い合わせます。Claude Code が CLAUDE_CODE_USE_VERTEX で問い合わせるのと同じで、追加の設定は不要です。どの API を話すエージェントでも使え、Codex や OpenCode も使えます。

    + +

    Priority PayGo と Flex PayGo

    +

    Google の Priority PayGo と Flex PayGo はリクエストヘッダーで指定します。エディターの ヘッダー に X-Vertex-AI-LLM-Request-Type と X-Vertex-AI-LLM-Shared-Request-Type があり、値は Google のページのとおりです。CLI では次のようにします。

    +
    ターミナル
    magpie provider set google-vertex header.=
    +

    よくあるエラー

    + + +

    よくある質問

    +

    magpie で Vertex AI を使うのに API キーは必要ですか?

    +

    不要です。gcloud のアプリケーションのデフォルト認証情報、サービスアカウントのキーファイル、または借用したサービスアカウントで各リクエストに署名します。キーは拒否されます。

    +

    Claude Code から magpie 経由で Vertex AI の Claude を使えますか?

    +

    使えます。claude- のモデルは CLAUDE_CODE_USE_VERTEX と同じく Anthropic の Messages API に問い合わせ、Codex や OpenCode からも使えます。先に Model Garden で有効にしてください。

    +

    ロケーションを変えたらモデルが変わったのはなぜ?

    +

    ロケーションごとに提供モデルが違います。global が最も多く、us と eu は新しい Flash、リージョンは 2.5 系です。ほかは magpie provider models google-vertex で入力します。

    +

    403 PERMISSION_DENIED が出たら?

    +

    署名するアカウントにプロジェクトの Agent Platform User(roles/aiplatform.user)が必要です。サービスアカウントを借用するなら、そのアカウントの Service Account Token Creator も必要です。

    + +

    関連ページ:Gemini を Claude Code・Codex・Gemini CLI・OpenCode で使う、DeepSeek を Claude Code・Codex・Gemini CLI・OpenCode で使う。エラーが出たら よくあるエラーの直し方:401・429・502・504 など を見るか、Discord で質問してください。

    +
    +
    + + + + + + + diff --git a/site/public/docs/vertex.html b/site/public/docs/vertex.html new file mode 100644 index 000000000..7d186f13d --- /dev/null +++ b/site/public/docs/vertex.html @@ -0,0 +1,283 @@ + + + + + +Google Vertex AI in Claude Code and Codex: Gemini, Claude, DeepSeek and GLM from your own GCP project · magpie + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    +

    Docs · Guide

    +

    Google Vertex AI in Claude Code, Codex and other agents

    +

    Google Vertex AI, which Google's documentation now calls Gemini Enterprise Agent Platform, serves Gemini from your own Google Cloud project, which is billed for it. It also serves partner and open models such as DeepSeek, GLM and gpt-oss, and Anthropic's Claude. magpie's google-vertex preset brings them to Claude Code, Codex, OpenCode and other agents with no API key: each request is signed with a token minted from your Google credentials.

    +

    Add it

    +
      +
    1. Turn on the API.Turn on the Agent Platform API (aiplatform.googleapis.com) in the project. Billing has to be on there.
    2. +
    3. Sign in.Run gcloud auth application-default login, or have a service account's key file.
    4. +
    5. Add and test.Give the project id, then test:
    6. +
    +
    Terminal
    gcloud auth application-default login
    +magpie provider add google-vertex project=my-project
    +magpie provider test google-vertex
    +

    The app's editor asks the same in Project ID, Location, Credentials file and Service account. The TUI's a asks for the project alone, and the CLI sets the rest. Adding, listing and showing it ask Google nothing; the credentials are read when a request is signed. Then pick a model for an agent:

    +
    Terminal
    magpie claude google-vertex/claude-sonnet-5-5
    +magpie codex google-vertex/gemini-3.1-pro-preview
    +

    Location, credentials, service account

    +
    Terminal
    magpie provider set google-vertex location=us-central1        # global (default), us, eu or a region
    +magpie provider set google-vertex credentials=~/keys/vertex.json
    +magpie provider set google-vertex impersonate=vertex@my-project.iam.gserviceaccount.com
    +magpie provider set google-vertex impersonate=                # empty clears it
    + +

    Models per location

    +

    Each location serves models of its own, and Vertex AI has no list to ask which, so magpie gives each location the models it answered with:

    + +

    When a region serves one more, as asia-northeast1 serves gemini-3.5-flash, type it in with the rest you want. Moving location keeps the models picked, so pick again after a move.

    +

    Partner models

    +

    A partner model names its publisher before a slash, as deepseek-ai/deepseek-v4.1-flash-maas, zai-org/glm-5.2-maas and openai/gpt-oss-120b-maas do. magpie asks it on Google's OpenAI-compatible chat completions in your project, with the same credentials and nothing to set. Type in another one (in preview, or listed later) under its full id:

    +
    Terminal
    magpie provider models google-vertex gemini-3.8-flash deepseek-ai/deepseek-v4.1-flash-maas google/gemma-4-26b-a4b-it-maas
    +magpie provider models google-vertex all     # back to the location's list
    +magpie provider test google-vertex zai-org/glm-5.2-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; test a partner model on its own, by right-clicking it in the app or by naming it after the command.

    +

    Claude on Vertex AI

    +

    A model whose id starts with claude- is asked on Anthropic's Messages API in your project (streamRawPredict), as Claude Code asks it with CLAUDE_CODE_USE_VERTEX, with nothing more to set. Every agent can use it, whatever API it speaks, Codex and OpenCode included.

    + +

    Priority PayGo and Flex PayGo

    +

    Google's Priority PayGo and Flex PayGo are asked for with request headers. The editor's Headers offers both, X-Vertex-AI-LLM-Request-Type and X-Vertex-AI-LLM-Shared-Request-Type; their values are the ones Google's pages give. From the CLI:

    +
    Terminal
    magpie provider set google-vertex header.=
    +

    Common errors

    + + +

    FAQ

    +

    Does Vertex AI need an API key in magpie?

    +

    No. magpie signs each request with gcloud's Application Default Credentials, a service account's key file or an impersonated service account. A key is refused.

    +

    Can Claude Code use Claude on Vertex AI through magpie?

    +

    Yes. claude- models are asked on Anthropic's Messages API, as with CLAUDE_CODE_USE_VERTEX, and Codex, OpenCode and other agents can use them too. Turn the model on in Model Garden first.

    +

    Why did the models change when I moved location?

    +

    Each location serves models of its own: global has the most, us and eu the newer Flash models, and a region the 2.5 models. Type others in with magpie provider models google-vertex.

    +

    What does a 403 PERMISSION_DENIED mean?

    +

    The account that signs needs Agent Platform User (roles/aiplatform.user) on the project; when it impersonates a service account, it also needs Service Account Token Creator on that account.

    + +

    Related: Gemini in Claude Code, Codex, Gemini CLI and OpenCode, DeepSeek in Claude Code, Codex, Gemini CLI and OpenCode. If something fails, see Fixing common errors: 401, 429, 502, 504 and more or ask on Discord.

    +
    +
    + + + + + + + diff --git a/site/public/docs/zh/gemini.html b/site/public/docs/zh/gemini.html index af6f86d0d..01b6748de 100644 --- a/site/public/docs/zh/gemini.html +++ b/site/public/docs/zh/gemini.html @@ -317,6 +317,8 @@ magpie claude google-vertex/gemini-3.1-pro-preview
  • 检查 Key。magpie provider test google 会向每个接口发一个很小的请求,或者发给你指定的每个模型。加上 --as codex 或 --as claude-code,就按那个工具的方式发送。
  • +

    Vertex AI 的详细说明:Google Vertex AI 接入 Claude Code、Codex 等 Agent。

    +

    常见问题

    Claude Code 怎么用 Gemini?

    在 magpie 里添加 Gemini API Key(供应商页,添加供应商,选 Google Gemini),然后在 Claude Code 那一行选一个模型,比如 gemini-3.1-pro-preview,或者运行 magpie claude google/gemini-3.1-pro-preview。magpie 会写好 Claude Code 的 settings.json,把每个 Messages 请求转换成 Gemini 的 Chat Completions,工具调用和流式输出都保留。

    diff --git a/site/public/docs/zh/vertex.html b/site/public/docs/zh/vertex.html new file mode 100644 index 000000000..7ac6ba2c2 --- /dev/null +++ b/site/public/docs/zh/vertex.html @@ -0,0 +1,283 @@ + + + + + +Google Vertex AI 接入 Claude Code、Codex:在自己的 GCP 项目里用 Gemini、Claude、DeepSeek 和 GLM · magpie + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    +

    文档 · 指南

    +

    Google Vertex AI 接入 Claude Code、Codex 等 Agent

    +

    Google Vertex AI(Google 文档现在叫 Gemini Enterprise Agent Platform)在你自己的 Google Cloud 项目里提供 Gemini,费用记在这个项目上。它还提供 DeepSeek、GLM、gpt-oss 等合作方和开放模型,以及 Anthropic 的 Claude。magpie 的 google-vertex 预设把它们接到 Claude Code、Codex、OpenCode 等 Agent,不需要 API Key:每次请求都用从你的 Google 凭据换来的令牌签名。

    +

    添加

    +
      +
    1. 开启 API。在项目里开启 Agent Platform API(aiplatform.googleapis.com),项目需要开通结算。
    2. +
    3. 登录。运行 gcloud auth application-default login,或者准备好服务账号的密钥文件。
    4. +
    5. 添加并测试。填上项目 id,再测一次:
    6. +
    +
    终端
    gcloud auth application-default login
    +magpie provider add google-vertex project=my-project
    +magpie provider test google-vertex
    +

    应用里的编辑器问的是同样的内容:项目 ID、位置、凭据文件 和 服务账号。TUI 的 a 只问项目,其余用 CLI 设置。添加、列出和查看都不会访问 Google,凭据在签名请求时才读取。然后给 Agent 选模型:

    +
    终端
    magpie claude google-vertex/claude-sonnet-5-5
    +magpie codex google-vertex/gemini-3.1-pro-preview
    +

    区域、凭据和服务账号

    +
    终端
    magpie provider set google-vertex location=us-central1        # global (default), us, eu or a region
    +magpie provider set google-vertex credentials=~/keys/vertex.json
    +magpie provider set google-vertex impersonate=vertex@my-project.iam.gserviceaccount.com
    +magpie provider set google-vertex impersonate=                # empty clears it
    + +

    每个区域的模型

    +

    每个区域提供的模型不同,而 Vertex AI 没有可以查询的列表,所以 magpie 给每个区域预设了它实际应答过的模型:

    + +

    某个区域多提供一个模型(比如 asia-northeast1 的 gemini-3.5-flash)时,把想要的模型都填进去即可。换区域会保留已选的模型,换完请重新选。

    +

    合作方模型

    +

    合作方模型的 id 在斜杠前写着发布方,比如 deepseek-ai/deepseek-v4.1-flash-maas、zai-org/glm-5.2-maas、openai/gpt-oss-120b-maas。magpie 用同样的凭据,在你的项目里通过 Google 的 OpenAI 兼容 Chat Completions 调用它们,不用另外设置。其他合作方模型(预览版或 Google 之后上线的)按完整 id 填进去:

    +
    终端
    magpie provider models google-vertex gemini-3.8-flash deepseek-ai/deepseek-v4.1-flash-maas google/gemma-4-26b-a4b-it-maas
    +magpie provider models google-vertex all     # back to the location's list
    +magpie provider test google-vertex zai-org/glm-5.2-maas
    +

    每个合作方模型都要先在项目的 Model Garden 里开启,否则 Google 会拒绝。magpie provider test google-vertex 测的是 Gemini,合作方模型要单独测:在应用里右键该模型,或者在命令后面加上模型 id。

    +

    Vertex AI 上的 Claude

    +

    id 以 claude- 开头的模型会在你的项目里走 Anthropic 的 Messages API(streamRawPredict),和 Claude Code 设置 CLAUDE_CODE_USE_VERTEX 时的调用方式一样,不需要再设置什么。不管 Agent 说的是哪种 API,都能用这些模型,Codex 和 OpenCode 也行。

    + +

    Priority PayGo 和 Flex PayGo

    +

    Google 的 Priority PayGo 和 Flex PayGo 通过请求头开启。编辑器的 请求头 里可以直接添加 X-Vertex-AI-LLM-Request-Type 和 X-Vertex-AI-LLM-Shared-Request-Type,值用 Google 文档给出的。命令行:

    +
    终端
    magpie provider set google-vertex header.=
    +

    常见错误

    + + +

    常见问题

    +

    用 Vertex AI 需要 API Key 吗?

    +

    不需要。magpie 用 gcloud 的应用默认凭据、服务账号密钥文件或模拟的服务账号签名每个请求。API Key 会被拒绝。

    +

    Claude Code 能通过 magpie 用 Vertex AI 上的 Claude 吗?

    +

    能。claude- 开头的模型走 Anthropic 的 Messages API,和 CLAUDE_CODE_USE_VERTEX 的方式一样;Codex、OpenCode 等其他 Agent 也能用。先在 Model Garden 里开启该模型。

    +

    为什么换了区域后模型变了?

    +

    每个区域提供的模型不同:global 最全,us 和 eu 只有新的 Flash,具体区域是 2.5 系列。其他模型用 magpie provider models google-vertex 手动填入。

    +

    报 403 PERMISSION_DENIED 怎么办?

    +

    签名的账号需要项目上的 Agent Platform User(roles/aiplatform.user)角色;模拟服务账号时,登录的账号还要在它上面有 Service Account Token Creator。

    + +

    相关页面:Gemini 接入 Claude Code、Codex、Gemini CLI 和 OpenCode、DeepSeek 接入 Claude Code、Codex、Gemini CLI 和 OpenCode。遇到错误请看 常见错误排查:401、429、502、504 等,或者到 Discord 提问。

    +
    +
    + + + + + + + diff --git a/site/public/llms-full.txt b/site/public/llms-full.txt index f36d3fa0d..643d4fc96 100644 --- a/site/public/llms-full.txt +++ b/site/public/llms-full.txt @@ -2659,6 +2659,8 @@ Two Google sign-ins give Gemini models without a key. They are subscriptions, se - **Vertex AI won’t save..** “Google Vertex AI needs the id of your Google Cloud project”: add `project=`. A credentials file has to be given by its full path. - **Checking a key..** `magpie provider test google` sends a tiny request through each endpoint, or to each model you name. Add `--as codex` or `--as claude-code` to send it the way that agent would. +More on Vertex AI: [Google Vertex AI in Claude Code, Codex and other agents](https://usemagpie.ai/docs/vertex). + ## FAQ ### How do I use Gemini in Claude Code? @@ -9354,6 +9356,114 @@ Related: [Quota left on every subscription and key](https://usemagpie.ai/docs/qu --- +Source: https://usemagpie.ai/docs/vertex + +# Google Vertex AI in Claude Code, Codex and other agents + +Google Vertex AI, which Google's documentation now calls Gemini Enterprise Agent Platform, serves Gemini from your own Google Cloud project, which is billed for it. It also serves partner and open models such as DeepSeek, GLM and gpt-oss, and Anthropic's Claude. magpie's `google-vertex` preset brings them to Claude Code, Codex, OpenCode and other agents with no API key: each request is signed with a token minted from your Google credentials. + +## Add it + +1. **Turn on the API..** Turn on the Agent Platform API (`aiplatform.googleapis.com`) in the project. Billing has to be on there. +2. **Sign in..** Run `gcloud auth application-default login`, or have a service account's key file. +3. **Add and test..** Give the project id, then test: + +``` +gcloud auth application-default login +magpie provider add google-vertex project=my-project +magpie provider test google-vertex +``` + +The app's editor asks the same in Project ID, Location, Credentials file and Service account. The TUI's `a` asks for the project alone, and the CLI sets the rest. Adding, listing and showing it ask Google nothing; the credentials are read when a request is signed. Then pick a model for an agent: + +``` +magpie claude google-vertex/claude-sonnet-5-5 +magpie codex google-vertex/gemini-3.1-pro-preview +``` + +## Location, credentials, service account + +``` +magpie provider set google-vertex location=us-central1 # global (default), us, eu or a region +magpie provider set google-vertex credentials=~/keys/vertex.json +magpie provider set google-vertex impersonate=vertex@my-project.iam.gserviceaccount.com +magpie provider set google-vertex impersonate= # empty clears it +``` + +- `location=` is `global` (the default, and what an empty value goes back to), `us`, `eu` or a region such as `us-central1`. +- `credentials=` names a credentials file to sign with in place of gcloud's sign-in, such as a service account's key. A relative path is made full from the folder the command runs in. +- `impersonate=` has requests made as that service account. The account signed in needs the Service Account Token Creator role on it. +- A key is refused, and so is an address (`url=` and the like): the project and location make the only address the token is sent to. + +## Models per location + +Each location serves models of its own, and Vertex AI has no list to ask which, so magpie gives each location the models it answered with: + +- `global`: Gemini (`gemini-3.8-flash`, `gemini-3.1-pro-preview`, `gemini-2.5-pro` and more), three partner models, and Claude models such as `claude-opus-5-5`, `claude-sonnet-5-5` and `claude-haiku-5-5`. +- `us`, `eu`: the 3.8, 3.7, 3.6 and 3.5 Flash models, `gemini-3.5-flash-lite` and `gemini-3.1-flash-lite`. +- A region: `gemini-2.5-pro`, `gemini-2.5-flash` and `gemini-2.5-flash-lite`. + +When a region serves one more, as asia-northeast1 serves `gemini-3.5-flash`, type it in with the rest you want. Moving location keeps the models picked, so pick again after a move. + +## Partner models + +A partner model names its publisher before a slash, as `deepseek-ai/deepseek-v4.1-flash-maas`, `zai-org/glm-5.2-maas` and `openai/gpt-oss-120b-maas` do. magpie asks it on Google's OpenAI-compatible chat completions in your project, with the same credentials and nothing to set. Type in another one (in preview, or listed later) under its full id: + +``` +magpie provider models google-vertex gemini-3.8-flash deepseek-ai/deepseek-v4.1-flash-maas google/gemma-4-26b-a4b-it-maas +magpie provider models google-vertex all # back to the location's list +magpie provider test google-vertex zai-org/glm-5.2-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; test a partner model on its own, by right-clicking it in the app or by naming it after the command. + +## Claude on Vertex AI + +A model whose id starts with `claude-` is asked on Anthropic's Messages API in your project (streamRawPredict), as Claude Code asks it with `CLAUDE_CODE_USE_VERTEX`, with nothing more to set. Every agent can use it, whatever API it speaks, Codex and OpenCode included. + +- `global` lists the current models under the ids Claude Code gives them for Vertex AI. +- An older model goes under Vertex's id with its date, such as `claude-sonnet-4-5@20250929`, typed in. +- At another location (`us-east5`, `europe-west1`), type in the Claude models it serves. +- Turn each Claude model on in Model Garden first, as a partner model is, and test it on its own. + +## Priority PayGo and Flex PayGo + +Google's Priority PayGo and Flex PayGo are asked for with request headers. The editor's Headers offers both, `X-Vertex-AI-LLM-Request-Type` and `X-Vertex-AI-LLM-Shared-Request-Type`; their values are the ones Google's pages give. From the CLI: + +``` +magpie provider set google-vertex header.= +``` + +## Common errors + +- `no Google credentials at `: there is no credentials file there. If it is your `credentials=`, correct it or clear it with `credentials=` alone; otherwise run `gcloud auth application-default login`. +- `GOOGLE_APPLICATION_CREDENTIALS names , which isn't there`, or `… not a full path`: the variable names no file magpie can read, and gcloud's own isn't read in its place. Give the whole path, unset it, or set `credentials=`. +- `the sign-in was refused`: the sign-in expired or was revoked. Run the command the advice names, such as `gcloud auth application-default login`. The next request reads the new file, with no restart. +- A 403 `PERMISSION_DENIED` naming `aiplatform.endpoints.predict`: the account that signs, or the service account it goes as, may not use Vertex AI in the project. Give it Agent Platform User (`roles/aiplatform.user`) on the project. +- `impersonating …: the sign-in was refused (403)`: the account signed in needs Service Account Token Creator (`roles/iam.serviceAccountTokenCreator`) on that service account. + +## FAQ + +### Does Vertex AI need an API key in magpie? + +No. magpie signs each request with gcloud's Application Default Credentials, a service account's key file or an impersonated service account. A key is refused. + +### Can Claude Code use Claude on Vertex AI through magpie? + +Yes. claude- models are asked on Anthropic's Messages API, as with CLAUDE_CODE_USE_VERTEX, and Codex, OpenCode and other agents can use them too. Turn the model on in Model Garden first. + +### Why did the models change when I moved location? + +Each location serves models of its own: global has the most, us and eu the newer Flash models, and a region the 2.5 models. Type others in with magpie provider models google-vertex. + +### What does a 403 PERMISSION_DENIED mean? + +The account that signs needs Agent Platform User (roles/aiplatform.user) on the project; when it impersonates a service account, it also needs Service Account Token Creator on that account. + +Related: [Gemini in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/gemini), [DeepSeek in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/deepseek). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF). + +--- + Source: https://usemagpie.ai/docs/library # Library diff --git a/site/public/llms.txt b/site/public/llms.txt index 8718b3a0b..13f1d8cda 100644 --- a/site/public/llms.txt +++ b/site/public/llms.txt @@ -142,6 +142,7 @@ DeepSeek, Kimi (Moonshot), GLM (Zhipu), Qwen, MiniMax, Anthropic (Claude), OpenA - [Quota left on every subscription and key](https://usemagpie.ai/docs/quota): each window's use and reset on Claude, Codex, Copilot and other subscriptions and each key's balance: magpie quota and --json, GET /v1/magpie/quotas, quota alerts, magpie quota wait to go on once allowance is back, history, and a Codex account's resets and credits. - [Image recognition and generation for any model](https://usemagpie.ai/docs/images): an Image recognition model describes images for models that can't see; analyze_image MCP server; Magpie Image generates images and videos into the project - [Token usage and cost per agent](https://usemagpie.ai/docs/usage): tokens and cost per agent, model, account and session; magpie usage --csv; magpie model price for a relay's real price; Claude Code status line; /v1/magpie/usage +- [Google Vertex AI in Claude Code, Codex and other agents](https://usemagpie.ai/docs/vertex): Gemini, Claude and partner models (DeepSeek, GLM, gpt-oss) from your own Google Cloud project, signed with gcloud credentials or a service account, no API key; models per location, Model Garden, PayGo headers and common errors. - [Library](https://usemagpie.ai/docs/library): instructions, MCP servers, skills, hooks and subagents for each agent. - [MCP router](https://usemagpie.ai/docs/mcp-router): one magpie MCP server per agent. - [Remote magpie](https://usemagpie.ai/docs/remote): use one magpie from several computers. diff --git a/site/public/sitemap.xml b/site/public/sitemap.xml index 22bf0bdfd..befe3e520 100644 --- a/site/public/sitemap.xml +++ b/site/public/sitemap.xml @@ -94,6 +94,7 @@ https://usemagpie.ai/docs/quota https://usemagpie.ai/docs/images https://usemagpie.ai/docs/usage +https://usemagpie.ai/docs/vertex https://usemagpie.ai/docs/local-models https://usemagpie.ai/docs/opencode-models https://usemagpie.ai/docs/alternatives @@ -209,6 +210,7 @@ https://usemagpie.ai/docs/zh/quota https://usemagpie.ai/docs/zh/images https://usemagpie.ai/docs/zh/usage +https://usemagpie.ai/docs/zh/vertex https://usemagpie.ai/docs/zh/local-models https://usemagpie.ai/docs/zh/opencode-models https://usemagpie.ai/docs/zh/alternatives @@ -323,6 +325,7 @@ https://usemagpie.ai/docs/ja/quota https://usemagpie.ai/docs/ja/images https://usemagpie.ai/docs/ja/usage +https://usemagpie.ai/docs/ja/vertex https://usemagpie.ai/docs/ja/local-models https://usemagpie.ai/docs/ja/opencode-models https://usemagpie.ai/docs/ja/alternatives