HomeDocsagents/opencode
Gateway Protocol v1 · Production Reference

Documentation

One key, two compatible wire protocols, 15 frontier models. Read the quickstart or explore the API reference.

Coding agents · OpenCode

OpenCode

OpenCode is an open-source, terminal-first AI coding agent. You declare the Selora gateway as a custom provider in opencode.json and pick your model when you launch.

Create an API key on the API Keys page and export it as $SELORA_API_KEY before continuing.

1

Install OpenCode

Install
curl -fsSL https://opencode.ai/install | bash
opencode --version
2

Declare the gateway as a provider

OpenCode merges a global config at ~/.config/opencode/opencode.json with a project-level opencode.json. Add the Selora gateway as an OpenAI-compatible provider with your key injected from the environment.

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "selora": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Selora Gateway",
      "options": {
        "baseURL": "https://api.selora.lol/v1",
        "apiKey": "{env:SELORA_API_KEY}"
      },
      "models": {
        "claude-sonnet-5": { "name": "Claude Sonnet" },
        "gpt-6-astra": { "name": "GPT-6 Astra" }
      }
    }
  }
}

Keep the key out of the file: set SELORA_API_KEY in your shell, and reference it with {env:SELORA_API_KEY}.

3

Run it

Launch the TUI, then switch to a Selora model with /models (e.g. selora/claude-sonnet-5).

Launch
export SELORA_API_KEY="sk-gw-..."
cd /path/to/project
opencode