Skip to main content
OpenCode configures each model provider separately, so it can talk to whichever API formats your resource supports — Anthropic Messages, OpenAI Chat/Responses, or both, depending on which providers are attached. See AI Gateway Overview if you haven’t set that up yet. You’ll need the resource’s URL (its <endpoint>) and its API key (<key>). Both are on the resource’s Keys page.
Public vs. private resourcesWherever these instructions show <key>, what you put there depends on the resource type:
  • Public resource - reachable from anywhere, so the gateway checks a virtual API key. Copy it from the resource URL after login, the Resource Launcher more-info panel, or https://app.pangolin.net/<org-id>/keys (use your self-hosted dashboard URL in place of app.pangolin.net if you self-host).
  • Private resource - only reachable from devices connected to your Pangolin network, so no key is checked. You must have the Pangolin client installed and connected. Use the literal string none as the key.
Don’t delete the key field for private resources. Most clients refuse to start without some key set, so they need an inert placeholder rather than a missing one.

Fastest: Pangolin CLI

Install the Pangolin CLI if you don’t have it, then log in:
Configure OpenCode against a resource:
This prompts you to pick an organization and resource (if you have more than one), then asks which OpenCode provider ID(s) should point at this gateway — defaults to anthropic,openai, but you can enter any comma-separated list OpenCode recognizes (e.g. openrouter,google). It fetches a key for you if needed and writes opencode.json and auth.json. To skip the org/resource prompts:
To undo it:

Manual setup

Merge this into your global opencode.json (~/.config/opencode/opencode.json, or $XDG_CONFIG_HOME/opencode/opencode.json if set):
Then merge your key into auth.json (~/.local/share/opencode/auth.json, or $XDG_DATA_HOME/opencode/auth.json if set):
auth.json is required even for a private resource. OpenCode refuses to start a provider with no key at all and fails with OpenAI API key is missing. Pass it using the 'apiKey' parameter or the OPENAI_API_KEY environment variable. Set the key to none rather than leaving the entry out.
Only add entries for the providers your resource actually supports. To point a different OpenCode provider (openrouter, google, groq, etc.) at this gateway, add a matching block under provider in opencode.json and a matching key in auth.json.