Run `vercel ai-gateway coding-agents setup` once, and [OpenCode](https://opencode.ai/) can use 300+ models through Vercel AI Gateway with one key and one bill. OpenCode ships a first-party gateway provider, so the command only needs to store your key. You keep switching models in-app with `/models`.

## [Copy link to heading](#what-is-opencode,-and-how-does-it-reach-models-without-the-gateway)What is OpenCode, and how does it reach models without the gateway?

OpenCode is an open source AI coding agent made by Anomaly. It helps you write code in your terminal, IDE, or desktop app, and it runs on macOS, Windows, and Linux. The project counts 195K GitHub stars, and over 16M developers use it.

OpenCode requires no subscription or account. You bring your own model provider, and the tool [connects to 75+ LLM providers through Models.dev](https://opencode.ai/), including local models. The project also says it doesn't store your code or context data.

That flexibility has a cost. Each provider you rely on comes with its own signup, API key, and bill, so the accounts pile up. Vercel AI Gateway replaces that spread with a single key for access to a catalog of 300+ models. OpenCode's 75+ counts providers; the gateway's 300+ counts models served through one connection.

## [Copy link to heading](#set-up-opencode-with-vercel-ai-gateway)Set up OpenCode with Vercel AI Gateway

You need a Vercel account and the Vercel CLI. OpenCode itself asks for neither, but the gateway key comes from your account.

1.  Run `vercel ai-gateway coding-agents setup`. The command detects the coding agents installed on your machine, generates an API key, and writes the gateway URL and credentials into OpenCode's native config format.

2.  Review the diff. Setup shows a diff of every planned change before it writes anything. Files are edited in place with formatting preserved, and your key is stored in the macOS Keychain instead of a plaintext config file.

3.  Open OpenCode and pick a model. The first-party gateway provider is already inside the tool, so the key is the only thing setup has to hand it. Setup doesn't lock you into a specific model; choose whatever fits the session.

## [Copy link to heading](#how-do-you-switch-models-in-opencode)How do you switch models in OpenCode?

Type `/models` inside OpenCode, then choose a model in the form `vercel/<creator>/<model>`. OpenCode discovers the models available through the gateway automatically, and you can switch between them on the fly, mid-session.

The selector now covers 300+ models, including models OpenCode has no native support for, with automatic fallbacks.

## [Copy link to heading](#what-changes-in-daily-use,-and-what-doesn't)What changes in daily use, and what doesn't?

Inside OpenCode, almost nothing changes. You still work in the terminal, the desktop app, or the IDE extension, and you still switch models with `/models` mid-session. OpenCode's no-account, bring-your-own-provider design stays intact. From the tool's perspective, the gateway is just another provider, with a much larger catalog behind it.

What changes is where requests route and bill. Instead of spreading usage across per-provider accounts and keys, every request goes through your gateway key and bills to your Vercel account. Budgets, a spend dashboard, and team-wide policy are gateway features shared by every supported agent; the [guide to using any coding agent with 300+ models](https://vercel.com/i/use-any-coding-agent-with-300-plus-models) covers them.

## [Copy link to heading](#what-the-gateway-doesn't-change)What the gateway doesn't change

- OpenCode's workflow. Sessions run as they always have, `/models` included. The gateway changes routing and billing, not the tool.

- OpenCode's account model. You still sign up for nothing on OpenCode's side. The Vercel account requirement sits on the gateway, because the key and the bill are yours.

- Your model choice. Nothing about setup pins you to one model; the full catalog stays open from the same selector.

## [Copy link to heading](#frequently-asked-questions)Frequently asked questions

### [Copy link to heading](#how-do-i-connect-opencode-to-vercel-ai-gateway)How do I connect OpenCode to Vercel AI Gateway?

With a Vercel account and the Vercel CLI in place, run vercel ai-gateway coding-agents setup. The command generates an API key, previews each planned edit as a diff before writing anything, and stores the gateway credentials in OpenCode's config. OpenCode has built-in Vercel AI Gateway support, so the key is all it needs.

### [Copy link to heading](#how-do-i-switch-models-in-opencode)How do I switch models in OpenCode?

Run /models inside OpenCode and pick a model in the vercel/creator/model format. The catalog of 300+ models on Vercel AI Gateway shows up in the selector automatically, and you're free to switch mid-session.

### [Copy link to heading](#do-i-need-an-opencode-subscription-or-account)Do I need an OpenCode subscription or account?

No. OpenCode works without a subscription or an account; you bring your own model provider instead. The one account you do need is a Vercel account, since that's where the gateway API key and the bill live.

[

**Build a software factory with Vercel Connect**

Ship a software factory in minutes, with GitHub and Linear connectors provisioned for you from the first deployment.

Learn more

](https://github.com/vercel-labs/eve-software-factory-template)

## [Copy link to heading](#related-resources)Related resources

- [Use any coding agent with 300+ models](https://vercel.com/i/use-any-coding-agent-with-300-plus-models)

- [Set up coding agents in one command with AI Gateway](https://vercel.com/changelog/set-up-coding-agents-in-one-command-with-ai-gateway)

- [Vercel AI Gateway model catalog](https://vercel.com/ai-gateway/models)

- [How I use OpenCode with Vercel AI Gateway to build features fast](https://vercel.com/kb/guide/how-i-use-opencode-with-vercel-ai-gateway-to-build-features-fast)