OpenCode
Configure FIM Gate's OpenAI, Anthropic, and third-party model sources for OpenCode.
OpenCode is an open-source terminal AI coding assistant. When connecting to FIM Gate, we recommend configuring three providers at once: the built-in openai and anthropic providers, plus a custom provider for all remaining third-party models. For installation details, see the OpenCode official docs.
Installation
Pick any one of these:
# Official install script
curl -fsSL https://opencode.ai/install | bash
# npm
npm install -g opencode-ai
# Yarn
yarn global add opencode-ai
# Bun
bun install -g opencode-ai
# Homebrew
brew install anomalyco/tap/opencodeWriting the Configuration File
-
Open (or create) the configuration file:
- macOS / Linux:
~/.config/opencode/opencode.json - Windows:
Users\<username>\.config\opencode\opencode.json
- macOS / Linux:
-
Add the following content (JSON does not support comments — don't leave any in after copying):
{ "$schema": "https://opencode.ai/config.json", "provider": { "anthropic": { "name": "Anthropic", "options": { "baseURL": "https://api.gate.fim.ai" } }, "openai": { "options": { "baseURL": "https://api.gate.fim.ai/v1" }, "models": { "gpt-5.2": { "options": { "include": ["reasoning.encrypted_content"], "store": false, "reasoningEffort": "high", "textVerbosity": "high", "reasoningSummary": "auto" } }, "gpt-5.2-codex": { "options": { "include": ["reasoning.encrypted_content"], "store": false } } } }, "fimgate": { "npm": "@ai-sdk/openai-compatible", "name": "FIM Gate", "options": { "baseURL": "https://api.gate.fim.ai/v1" }, "models": { "deepseek-v3.2": { "name": "DeepSeek V3.2" } } } } }
A few notes:
- Why split into three providers? OpenCode has special optimizations for the built-in OpenAI and Anthropic providers; if you cram all models into a single generic provider, some capabilities may be unavailable or degraded. Route OpenAI / Claude models through the built-in providers, and put everything else into the custom
fimgateprovider. - For GPT-series models, keep
include: ["reasoning.encrypted_content"]andstore: falseexactly as shown, or calls may fail. anthropicuses Claude's native protocol, so set itsbaseURLtohttps://api.gate.fim.ai(without/v1);openaiand the custom provider use the OpenAI-compatible protocol, so set theirbaseURLtohttps://api.gate.fim.ai/v1.- The keys under
fimgate.modelsare model IDs — add or remove them as needed. See the pricing page for available models.
Entering Your API Key
Enter the same FIM Gate key (created in the Console) for each of the three providers:
- Run
opencode auth loginin the terminal, chooseOpenAI→Manually enter API Key, and paste your key. - Run
opencode auth loginagain, chooseAnthropic→Manually enter API Key, and paste the same key. - Run
opencode auth logina third time, chooseOtherat the bottom of the list, enterfimgateas the Provider ID (it must match the provider key in your configuration file), and paste the key.
Getting Started
opencode- The first time you use it in a project, run
/initin the session to initialize. - Use the
/modelscommand to switch models. - Press
TABto toggle betweenplanandbuildmodes: we recommend generating a plan first, then switching to build to write code once you've confirmed it.
Optional Enhancement: Oh My OpenCode
Oh My OpenCode provides preset agents and plugins for OpenCode.
Installation
After starting opencode, paste and send the following in the session:
Install and configure oh-my-opencode by following the instructions here:
https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/refs/heads/master/docs/guide/installation.mdDuring installation you'll be asked three questions:
- Whether you have a Claude Pro / Max subscription — connecting a subscription carries a risk of account suspension, so it's generally not recommended;
- Whether you have a ChatGPT Plus / Pro subscription — answer based on your situation;
- Whether to integrate Google Gemini — choose Yes if you have a Gemini subscription, otherwise No.
Based on your answers, it automatically installs the corresponding plugins and connects your subscriptions to OpenCode.
Post-Install Configuration
After installation, opencode.json will contain a new plugin field (e.g. ["oh-my-opencode", "opencode-antigravity-auth@1.3.0"]). If you chose the Gemini integration, a google provider will also appear, with model entries like antigravity-gemini-3-pro-high, antigravity-gemini-3-pro-low, and antigravity-gemini-3-flash. See the opencode-antigravity-auth docs for the full model mapping.
It also generates ~/.config/opencode/oh-my-opencode.json. Common settings:
-
google_auth: must be set tofalsewhen using the antigravity plugin; -
mcp/commands/skills/agents/hooksunderclaude_code: set tofalseto stop OpenCode from automatically reading Claude Code's local configuration; -
agents: assigns a model to each built-in agent, for example:{ "agents": { "Sisyphus": { "model": "openai/gpt-5.2" }, "oracle": { "model": "openai/gpt-5.2" }, "librarian": { "model": "anthropic/claude-sonnet-4-5-20250929" }, "explore": { "model": "anthropic/claude-sonnet-4-5-20250929" }, "frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3-pro-high" }, "document-writer": { "model": "google/antigravity-gemini-3-flash" }, "multimodal-looker": { "model": "google/antigravity-gemini-3-flash" } } }What each agent does: Sisyphus handles coordination and simple tasks, oracle tackles hard problems and debugging, librarian looks up library documentation, explore explores the code repository, and the rest cover frontend design, documentation writing, and multimodal recognition respectively.
Note: if you integrated Google Gemini, you must first run opencode auth login and choose Google to complete authorization before the related models become available.