# OpenCode

Run OpenCode on Boundless models: install, the opencode.json provider, model ids with limits, a verify command and common errors.


OpenCode reaches Boundless through a custom provider in `opencode.json`, using the OpenAI-compatible package and the base URL `https://api.inference.boundless.network/v1`.

## Install

Install OpenCode from its own documentation first. Then pick one way to point it at Boundless.

Run this in a terminal on macOS or Linux and choose **OpenCode**:

```bash
curl -fsSL https://boundless.md/install | sh
```

Or run the package yourself, which also works on Windows:

```bash
npx -y @boundless.md/setup@latest
```

Setup signs you in through your browser, creates a key on your account and backs up every file it changes. To undo it, run `curl -fsSL https://boundless.md/install | sh -s -- --revert`. Need a key to configure by hand? Create one in [API Keys](https://inference.boundless.network/settings/api-keys).

## Configure

### OpenCode

A custom provider in `opencode.json`, either in your project or `~/.config/opencode/opencode.json`. `model` is the default for every session and `small_model` handles titles, summaries and other light work:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "boundless/deepseek/deepseek-v4.1-flash",
  "small_model": "boundless/deepseek/deepseek-v4-flash-0731",
  "provider": {
    "boundless": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Boundless",
      "options": {
        "baseURL": "https://api.inference.boundless.network/v1",
        "apiKey": "{env:BOUNDLESS_API_KEY}"
      },
      "models": {
        "deepseek/deepseek-v4-flash-0731": {
          "name": "DeepSeek V4 Flash",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true
        },
        "deepseek/deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        },
        "deepseek/deepseek-v4.1-flash-1017": {
          "name": "DeepSeek V4.1 Flash 1017",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        },
        "openai/gpt-oss-120b": {
          "name": "gpt-oss-120b",
          "limit": { "context": 131072, "output": 32000 },
          "reasoning": true,
          "tool_call": true
        },
        "nvidia/nemotron-3-super-120b-a12b": {
          "name": "Nemotron 3 Super",
          "limit": { "context": 262144, "output": 32000 },
          "reasoning": true,
          "tool_call": true
        },
        "qwen/qwen3.6-35b-a3b": {
          "name": "Qwen3.6-35B-A3B",
          "limit": { "context": 262144, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        },
        "moonshotai/kimi-k3": {
          "name": "Kimi K3",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        },
        "moonshotai/kimi-k3.1-pro": {
          "name": "Kimi K3.1 Pro",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        },
        "z-ai/glm-5.3": {
          "name": "GLM-5.3",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true
        },
        "z-ai/glm-5.3-flash": {
          "name": "GLM-5.3 Flash",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image", "video"] }
        },
        "deepseek/deepseek-v4-pro-0813": {
          "name": "DeepSeek V4 Pro",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true
        },
        "google/gemma-4-31b-it": {
          "name": "Gemma 4 31B",
          "limit": { "context": 262144, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        },
        "xiaomi/mimo-v2.6-pro": {
          "name": "MiMo-V2.6 Pro",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image", "audio", "video"] }
        },
        "xiaomi/mimo-v2.6-flash": {
          "name": "MiMo-V2.6 Flash",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image", "audio", "video"] }
        },
        "minimax/minimax-m3.1-flash": {
          "name": "MiniMax M3.1 Flash",
          "limit": { "context": 1000000, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image", "video"] }
        },
        "minimax/minimax-m3": {
          "name": "MiniMax M3",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image", "video"] }
        },
        "minimax-m3-free": {
          "name": "MiniMax M3 (Free)",
          "limit": { "context": 1048576, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image", "video"] }
        },
        "openai/gpt-6-luna": {
          "name": "GPT-6 Luna",
          "limit": { "context": 1050000, "output": 128000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        },
        "openai/gpt-6-sol": {
          "name": "GPT-6 Sol",
          "limit": { "context": 1050000, "output": 128000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        },
        "anthropic/claude-opus-5.5": {
          "name": "Claude Opus 5.5",
          "limit": { "context": 1000000, "output": 128000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        },
        "anthropic/claude-fable-5.1": {
          "name": "Claude Fable 5.1",
          "limit": { "context": 262144, "output": 32000 },
          "reasoning": true,
          "tool_call": true
        },
        "anthropic/claude-fable-5.2": {
          "name": "Claude Fable 5.2",
          "limit": { "context": 1000000, "output": 32000 },
          "reasoning": true,
          "tool_call": true,
          "modalities": { "input": ["text", "image"] }
        }
      }
    }
  }
}
```

A custom provider inherits nothing from OpenCode's catalog, so each model needs its own `limit`. Undeclared `reasoning` and `tool_call` read as false. A key saved for `boundless` through `/connect` takes precedence over `apiKey`; remove it with `opencode auth logout boundless`.

```bash
opencode run --auto 'Use the bash tool to run printf boundless, then report the output.'
```

## Model ids

The examples use `boundless/deepseek/deepseek-v4.1-flash`. Use `boundless/` plus any id from `GET https://api.inference.boundless.network/v1/models`, never the bare id; the [models page](https://inference.boundless.network/models) lists each one with its price and limits. A custom provider inherits nothing from OpenCode's catalog, so each model needs its own `limit`; the list in the config above carries them.

## Verify

Run the `opencode run` command from the setup above. The reply should report `boundless`.

To check the base URL and key on their own, list the models the gateway serves. A list of models means both are right. A `401` means the key is missing or wrong:

```bash
curl https://api.inference.boundless.network/v1/models -H "Authorization: Bearer YOUR_API_KEY"
```

## Common errors

| What you see | What it usually is |
| --- | --- |
| `401` on every request | Wrong key. Set `BOUNDLESS_API_KEY`, and remove a stale key saved through `/connect` with `opencode auth logout boundless`. |
| An error naming a model you never chose | The harness is sending its default. Set the model explicitly, including any small or background slot. |
| Empty reply, `stop_reason: max_tokens` | The output budget has to cover thinking too. Give reasoning models 1024+. |
| `403` with `model_not_allowed` | Your team admin has not enabled that model for you. Ask them, or pick another. See [Model access](https://inference.boundless.network/docs/teams#model-access). |

Every status and code is on the [Errors](https://inference.boundless.network/docs/errors) page. Other harnesses are on the [Coding Agents & Harnesses](https://inference.boundless.network/docs/coding-agents-and-harnesses) page.
