Integrations

OpenCode

Open-source coding agent for the terminal. Step-by-step setup with Laras Router.

On this page

This guide connects OpenCode to Laras Router. Every step was checked against the OpenCode documentation.

You need an API key (lr_live_…) and a topped-up balance. New to Laras Router? Start with the Quickstart.

Set up

Set your API key

Put your key in an environment variable.

Shell
export LARAS_API_KEY="lr_live_your_key_here"

Add the provider

Add Laras Router as a custom provider in ~/.config/opencode/opencode.json, or in opencode.json at your project root.

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "laras/deepseek-flash",
  "provider": {
    "laras": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Laras Router",
      "options": {
        "baseURL": "https://api.larasrouter.com/v1",
        "apiKey": "{env:LARAS_API_KEY}"
      },
      "models": {
        "deepseek-flash": {
          "name": "DeepSeek Flash",
          "limit": { "context": 1000000, "output": 32000 }
        }
      }
    }
  }
}

Pick the model

Start OpenCode and pick DeepSeek Flash under Laras Router with /models, or start it with --model laras/deepseek-flash.

Good to know

  • apiKey reads LARAS_API_KEY from your environment. If the variable is not set, the key is empty and requests return 401 invalid_api_key.
  • Set limit yourself: OpenCode cannot look up the context and output limits of a custom provider.

Settings and screens can change between versions. If something looks different, check the OpenCode documentation. For other tools, see all integrations.