<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Opencode on Major Hayden</title><link>https://major.io/tags/opencode/</link><description>Recent content in Opencode on Major Hayden</description><generator>Hugo</generator><language>en</language><managingEditor>major@mhtx.net (Major Hayden)</managingEditor><webMaster>major@mhtx.net (Major Hayden)</webMaster><copyright>All content licensed [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)</copyright><lastBuildDate>Mon, 13 Apr 2026 21:40:09 +0000</lastBuildDate><atom:link href="https://major.io/tags/opencode/index.xml" rel="self" type="application/rss+xml"/><item><title>Using Anthropic's models via Vertex AI in opencode</title><link>https://major.io/p/vertex-ai-anthropic-opencode/</link><pubDate>Mon, 13 Apr 2026 00:00:00 +0000</pubDate><author>major@mhtx.net (Major Hayden)</author><guid>https://major.io/p/vertex-ai-anthropic-opencode/</guid><description>&lt;p&gt;We use &lt;a href="https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude"&gt;Vertex AI&lt;/a&gt; at work for accessing Anthropic&amp;rsquo;s models and the opencode setup is quite smooth!
Although getting your authentication credentials from Google can be a little tricky, using them with &lt;a href="https://github.com/anomalyco/opencode"&gt;opencode&lt;/a&gt; involves setting a few environment variables.&lt;/p&gt;
&lt;h1 id="setting-up-vertex-ai"&gt;Setting up Vertex AI&lt;/h1&gt;
&lt;p&gt;Before you point opencode at Vertex AI, you need a few things on the GCP side.&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;A GCP project with the &lt;strong&gt;Vertex AI API&lt;/strong&gt; enabled&lt;/li&gt;
&lt;li&gt;IAM permissions for the Claude models (your account needs the &lt;code&gt;aiplatform.endpoints.predict&lt;/code&gt; permission, or a broader role like &lt;code&gt;Vertex AI User&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Either a service account key or Application Default Credentials (ADC)&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="authentication"&gt;Authentication&lt;/h2&gt;
&lt;p&gt;You have two main options here.
The easiest for local development is ADC:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gcloud auth application-default login
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This stores credentials locally and opencode picks them up automatically.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re using a &lt;a href="https://cloud.google.com/iam/docs/service-accounts-create"&gt;service account&lt;/a&gt; (common in enterprise setups where your org provisions access), point to the key file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;GOOGLE_APPLICATION_CREDENTIALS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/path/to/your-service-account.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="environment-variables"&gt;Environment variables&lt;/h2&gt;
&lt;p&gt;Set these in your shell profile or session:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;ANTHROPIC_VERTEX_PROJECT_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-gcp-project-id
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;GOOGLE_CLOUD_PROJECT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-gcp-project-id
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;GOOGLE_APPLICATION_CREDENTIALS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/path/to/your-service-account.json &lt;span class="c1"&gt;# if not using ADC&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can also set &lt;code&gt;VERTEX_LOCATION&lt;/code&gt; if you need a specific region, but the &lt;code&gt;global&lt;/code&gt; endpoint is the default.
It routes to the nearest available region.&lt;/p&gt;
&lt;h1 id="using-opencode"&gt;Using opencode&lt;/h1&gt;
&lt;p&gt;You don&amp;rsquo;t need to configure opencode at all!
It finds the environment variables and takes care of the rest for you.&lt;/p&gt;
&lt;p&gt;You can type &lt;code&gt;/models&lt;/code&gt;, press enter, and you should see the list of available models from Vertex AI.
From there, use CTRL-F to select any favorites that you use often.&lt;/p&gt;
&lt;h1 id="troubleshooting"&gt;Troubleshooting&lt;/h1&gt;
&lt;p&gt;If you don&amp;rsquo;t see any models, double check the environment variables to ensure they are set in your terminal session.
You may need to open a new terminal or source your shell profile to pick up the new variables.&lt;/p&gt;
&lt;p&gt;You can also run &lt;code&gt;opencode models --refresh&lt;/code&gt; to force a refresh of the model list from Vertex AI.&lt;/p&gt;</description></item></channel></rss>