Skip to main content

Introduction

OpenCode is an open-source AI programming assistant supporting 75+ models and local deployment. With Mixroute Api, you can use various mainstream and latest models (GPT, Claude, Gemini, etc.) in OpenCode with custom provider and model configuration. Download: https://opencode.ai/

Quick Configuration

1. Get API Key

Create and copy your API key from Mixroute Api Console.

2. Configure Custom Provider in OpenCode

1

Open Settings

Open OpenCode, go to Server / Provider settings
OpenCode Provider Settings
2

Add Provider

Add Custom Provider (Configure an OpenAI compatible provider)
Add Custom Provider
3

Fill Configuration

  • Provider ID: e.g., mixroute (lowercase, numbers, hyphens or underscores)
  • Display Name: e.g., Mixroute Api
  • Base URL: https://console.mixroute.io/v1 (must end with /v1)
  • API Key: Paste your Mixroute Api key
4

Add Models

Add models you need (e.g., gpt-4o, claude-sonnet-4-20250514)
5

Save and Use

Use ProviderID/ModelID format (e.g., mixroute/gpt-4o)

3. Switch Models

Select configured provider and model in chat or settings (e.g., mixroute/gpt-4o).

Models Requiring Responses API

Some models require Responses API instead of Chat Completions. If you see this error:
The chatCompletion operation does not work with the specified model
Error Example
Add "apiCompatibility": "responses" in your config file:
{
  "provider": {
    "mixroute": {
      "models": {
        "gpt-5.1-codex": {
          "name": "gpt-5.1-codex",
          "apiCompatibility": "responses"
        }
      },
      "options": {
        "baseURL": "https://console.mixroute.io/v1"
      }
    }
  }
}
Config File Location
Configuration Success

Configuration Success Example

Below is an example of normal conversation using Mixroute Api in OpenCode:
OpenCode Conversation Example
TypeModel IDNotes
Codinggpt-5.1-codexRequires Responses API
Generalgpt-5.2, gpt-5.1-chatStandard config
Long textclaude-sonnet-4-20250514Standard config
Cost-effectivegpt-4.1-mini, gemini-2.5-flashStandard config