> ## Documentation Index
> Fetch the complete documentation index at: https://docs.auriko.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenCode

> Use Auriko as your LLM provider in OpenCode

Auriko is in OpenCode's provider registry, giving you access to 15 models through a single API key.

## Prerequisites

* [OpenCode](https://opencode.ai) 1.4.10+
* An [Auriko API key](https://auriko.ai/signup?redirectTo=%2Fdashboard%3Ftab%3Dapi-keys)

## Install OpenCode

Run the official install script:

```bash theme={null}
curl -fsSL https://opencode.ai/install | bash
```

Or install via npm:

```bash theme={null}
npm i -g opencode-ai
```

Or via Homebrew (macOS):

```bash theme={null}
brew install opencode
```

Open a new terminal if you used the install script, then confirm:

```bash theme={null}
opencode --version
```

You need version 1.4.10 or later.

The install script writes PATH to `~/.bashrc`, which non-interactive shells don't source. In CI, GitHub Actions, or agent-driven sessions, add this before invoking `opencode`:

```bash theme={null}
export PATH="$HOME/.opencode/bin:$PATH"
```

## Set your API key

Export your API key:

```bash theme={null}
export AURIKO_API_KEY="ak_live_..."
```

Your key starts with `ak_live_` (production) or `ak_test_` (testing).

Add this line to `~/.zshrc` or `~/.bashrc` to persist it across terminal sessions.

Reload your shell after saving:

```bash theme={null}
source ~/.zshrc   # or: source ~/.bashrc
```

Or open a new terminal.

## Verify

Run this from inside a git repository. OpenCode requires a git working tree.

```bash theme={null}
opencode run "Say exactly: setup-ok" --model auriko/claude-sonnet-4-6 --pure
```

OpenCode prints extra setup output on first run. The model response follows.

## Set default model

To avoid passing `--model` on every run, create an `opencode.json` in your project root:

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "model": "auriko/claude-sonnet-4-6"
}
```

You can also place this at `~/.config/opencode/opencode.json` to set a global default. A project-root config takes precedence.

You don't need a provider block. OpenCode resolves Auriko's models automatically.

## Use different models

Pass any registered model with the `--model` flag:

```bash theme={null}
opencode run "Summarize this repo" --model auriko/deepseek-v4-flash
opencode run "Review my code" --model auriko/gemini-2.5-pro
```

To start an interactive session:

```bash theme={null}
opencode
```

Use `/models` to browse and switch models during a session.

These models are registered in OpenCode's provider registry and work without configuration:

| Model                    | Author    | Context |
| ------------------------ | --------- | ------- |
| `claude-sonnet-4-6`      | Anthropic | 1M      |
| `claude-opus-4-6`        | Anthropic | 1M      |
| `claude-opus-4-7`        | Anthropic | 1M      |
| `deepseek-v4-flash`      | DeepSeek  | 1M      |
| `deepseek-v4-pro`        | DeepSeek  | 1M      |
| `gemini-2.5-flash`       | Google    | 1M      |
| `gemini-2.5-pro`         | Google    | 1M      |
| `gemini-3.1-pro-preview` | Google    | 1M      |
| `glm-5.1`                | Z.AI      | 200K    |
| `grok-4.3`               | xAI       | 1M      |
| `kimi-k2.5`              | Moonshot  | 262K    |
| `kimi-k2.6`              | Moonshot  | 262K    |
| `minimax-m2-7`           | MiniMax   | 205K    |
| `minimax-m2-7-highspeed` | MiniMax   | 205K    |
| `qwen-3.6-plus`          | Alibaba   | 1M      |

To list all Auriko models (not just the 15 registered in OpenCode):

```bash theme={null}
curl -s -H "Authorization: Bearer $AURIKO_API_KEY" \
  https://api.auriko.ai/v1/models | jq '.data[].id'
```

## Add unregistered models

The 15 registered models work without configuration. To use any of the 250+ other models Auriko serves, add a provider and model definition to your `opencode.json`:

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "model": "auriko/deepseek-v3.2",
  "provider": {
    "auriko": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Auriko",
      "env": ["AURIKO_API_KEY"],
      "options": {
        "baseURL": "https://api.auriko.ai/v1",
        "apiKey": "{env:AURIKO_API_KEY}"
      },
      "models": {
        "deepseek-v3.2": {
          "name": "DeepSeek V3.2",
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 163840, "output": 8192 },
          "modalities": { "input": ["text"], "output": ["text"] }
        }
      }
    }
  }
}
```

Browse model capabilities via the [directory API](https://api.auriko.ai/v1/directory/models) to fill in the model definition fields.

## Control routing

Configure routing in the [Auriko dashboard](https://auriko.ai/dashboard). See [routing options](/guides/routing-options) for details.

## Uninstall

Remove `AURIKO_API_KEY` from your shell profile (`~/.zshrc` or `~/.bashrc`). If you created an `opencode.json`, remove the auriko-related lines or delete the file.

## Troubleshoot

| Symptom                               | Cause                                                   | Fix                                                                                              |
| ------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `Error: API key is invalid.`          | `AURIKO_API_KEY` not set or key is wrong                | Run `echo $AURIKO_API_KEY`. If empty, export it. If set, verify at `https://api.auriko.ai/v1/me` |
| `Error: Model not found: auriko/<id>` | Model not in registry and no local definition           | Add a model definition to `opencode.json` (see "Add unregistered models")                        |
| `opencode: command not found`         | Install script PATH not loaded in non-interactive shell | Run `export PATH="$HOME/.opencode/bin:$PATH"` before invoking `opencode`                         |
| Connection error                      | `baseURL` wrong or has trailing slash                   | Use exactly `https://api.auriko.ai/v1`                                                           |
| Config not taking effect              | Local config overriding global                          | Check both `~/.config/opencode/opencode.json` (global) and `./opencode.json` (project root)      |
| Empty response from `opencode run`    | Not inside a git repository                             | Run from inside a git repo, or run `git init` first                                              |
