Skip to content
Integrations/Agent Harnesses

OpenCode

Connect OpenCode to AudioLab Router.

Configuration

Install OpenCode and Node.js 20 or later. Create an AudioLab workspace key with llm.write, available credits, and access to the selected model. Export it as AUDIOLAB_API_KEY in the terminal that launches the agent.

~/.config/opencode/opencode.json
{
  "provider": {
    "audiolab": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "AudioLab",
      "options": {
        "baseURL": "https://api.tryaudiolab.ai/v1",
        "apiKey": "{env:AUDIOLAB_API_KEY}"
      },
      "models": {
        "openai/gpt-6-astra": {
          "name": "openai/gpt-6-astra",
          "limit": {
            "context": 128000,
            "output": 4096
          }
        }
      }
    }
  }
}

Automatic Setup

The command previews the files and fields it changes. Confirm to apply; it stores a private backup and prints an undo command. It does not store the API key or change your shell profile. Automatic file setup supports macOS and Linux.

Terminal
npx https://tryaudiolab.ai/cli/router-0.1.0.tgz setup --agent opencode

Launch

Terminal
npx https://tryaudiolab.ai/cli/router-0.1.0.tgz run opencode

Supported Configuration

This recipe uses the OpenCode v1 provider configuration documented by the upstream provider guide. It explicitly selects @ai-sdk/openai-compatible for Chat Completions. Keep unrelated permissions, tools, and MCP settings. If you run a release with a different configuration schema, follow that version’s provider guide.

Verify the Connection

Send a short text prompt, then a read-only tool request in a disposable project. Check the model, request record, and usage in Router. Test streaming and a follow-up turn before using a longer workflow. Client-specific tools and permissions remain managed by OpenCode.

The setup command can check authentication and model discovery without generating a response. See the protocol contracts for model and feature limits.

Reference

OpenCode Configuration — Official Documentation

AudioLab Setup Command