Docs

Connect

OpenCode

Connect OpenCode to Arena.

Before you begin

  • OpenCode installed on macOS, Linux or WSL2. Native Windows works with the manual setup.
  • An Arena account with access to the Keys page.

Set up

Choose how to set up
  1. 1. Run the setup script

    Run this in a terminal. It finds OpenCode, opens your browser to approve the connection, creates a key, and saves your connection settings and model menu.

    curl -fsSL <portal-url>/setup.sh | bash
  2. 2. Check it works

    Restart OpenCode if it was open, then start it:

    opencode

    Type /models. You should see your Arena models under the Arena provider, with Arena Router listed as Arena Coding Router. Send a short prompt, and the request appears on Usage.

    The router has no reasoning levels; direct models can still offer reasoning variants.

    If the prompt fails, read the tool's error and check your Arena key and base URL in the saved configuration.

  1. 1. Create an API key

    Create a key on the Keys page. You can only copy it once.

  2. 2. Configure OpenCode

    Replace <your-arena-key> with your Arena key and preserve unrelated settings. Save once, then restart OpenCode.

    Router example:

    OpenCode provider entry. Paste into a new config file, or merge the defaults and Arena provider, replacing its models with this selection.

    ~/.config/opencode/opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "model": "arena/coding-router-preview",
      "small_model": "arena/coding-router-preview",
      "provider": {
        "arena": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Arena",
          "options": {
            "baseURL": "https://api.arena.ai/v1",
            "apiKey": "<your-arena-key>"
          },
          "models": {
            "coding-router-preview": {
              "name": "Arena Coding Router",
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "attachment": true,
              "tool_call": true,
              "reasoning": false,
              "variants": {
                "low": {
                  "disabled": true
                },
                "medium": {
                  "disabled": true
                },
                "high": {
                  "disabled": true
                }
              },
              "limit": {
                "context": 1000000,
                "output": 128000
              }
            }
          }
        }
      }
    }

    Sign in to generate this for your workspace's models.

  3. 3. Check it works

    Restart OpenCode if it was open, then start it:

    opencode

    Type /models. You should see your Arena models under the Arena provider, with Arena Router listed as Arena Coding Router. Send a short prompt, and the request appears on Usage.

    The router has no reasoning levels; direct models can still offer reasoning variants.

    If the prompt fails, read the tool's error and check your Arena key and base URL in the saved configuration.

Tips

  • Switch and update models. Type /models in a session to switch. To get new models or change your default, see Switching models.
  • Undo the setup. See Uninstall in the Quickstart.

Troubleshooting

OpenCode uses a different model
A project-level opencode.json overrides the global file. Check the project folder.
You use XDG_CONFIG_HOME or native Windows
Save the file at $XDG_CONFIG_HOME/opencode/opencode.json, or on Windows at %USERPROFILE%\.config\opencode\opencode.json.
403 organization_model_restricted
The model is not enabled for your workspace. Pick another model, or rerun the setup script and choose update models.

Next steps