CrossModel

Integration guide

OpenCode

OpenCode is an open-source terminal coding assistant. It supports custom OpenAI-compatible providers, so a little config gets you onto the CrossModel catalog.

Quickstart

1. Install OpenCode

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

Or install with npm:

npm install -g opencode-ai

2. Create an API key

Sign in to the Console and create a key that starts with cm- on the API Keys page. The key is shown only once, so copy it somewhere safe.

3. Point OpenCode at CrossModel

CrossModel isn't a built-in OpenCode provider, so wire it up as a custom OpenAI-compatible one. Edit opencode.json (in your project root, or ~/.config/opencode/opencode.json):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "crossmodel": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "CrossModel",
      "options": {
        "baseURL": "https://api.crossmodel.ai/v1",
        "apiKey": "{env:CROSSMODEL_API_KEY}"
      },
      "models": {
        "deepseek/deepseek-v4-pro": { "name": "DeepSeek V4 Pro" },
        "deepseek/deepseek-v4-flash": { "name": "DeepSeek V4 Flash" }
      }
    }
  }
}

4. Set the API key environment variable

{env:CROSSMODEL_API_KEY} reads the key from the environment. Add it to your shell profile (~/.zshrc or ~/.bashrc):

export CROSSMODEL_API_KEY="cm-YOUR_KEY"

5. Launch and pick a model

Run opencode from your project directory, then use /models to pick a model under CrossModel:

cd /path/to/your/project
opencode

How it works

The npm field tells OpenCode to handle this provider with the @ai-sdk/openai-compatible adapter. options.baseURL points at CrossModel's OpenAI-compatible endpoint, and options.apiKey handles auth. Requests go to CrossModel with your cm- key sent as a Bearer token.

Choosing models

Each model you want to use goes into provider.crossmodel.models, keyed by a vendor/short_name model ID. After adding a model, run /models again to see it. See the full list in the model catalog.

Troubleshooting

SymptomWhat to check
Auth failureConfirm CROSSMODEL_API_KEY is set, active in the current shell, and holds a valid cm- key.
CrossModel missing from /modelsMake sure opencode.json is valid JSON and the provider.crossmodel block is complete.
"Model not found"Verify the keys in models match IDs from the /v1/models response.
Insufficient balanceTop up in the Console.