# OpenCode (https://inference.net/docs/integrations/opencode)

`fast opencode on` adds an `inference-net` provider to
`~/.config/opencode/opencode.json` and sets it as OpenCode's `model` and
`small_model`. Other providers and settings in the file are left in place.

## Connect OpenCode

<ConnectAgent integration="opencode" />

## Connect with Inference Pass

If you have an Inference Pass subscription, use the `@inference/cli` (`inf`) CLI
for automatic plan detection, live allowance checks, self-healing config repair,
and local loopback proxy support:

```bash
npm install -g @inference/cli
inf auth login
inf pass on opencode
inf pass status
```

Run `inf pass doctor` to repair drifted settings or rotated keys, `inf pass off opencode`
to restore your previous configuration, or `inf pass proxy` for desktop apps over
`http://127.0.0.1:4141/v1`.

## Choose a model

OpenCode uses `kimi-k3-fast` unless you pick another ID from the
[model catalog](/models/):

```bash
# Set the model for every agent
fast opencode on --model kimi-k3-fast

# Connect with an Inference Pass plan key (auto-picks a plan model)
fast opencode on --plan

# Set the model per agent
fast opencode on --build kimi-k3-fast --plan deepseek-v4-flash-0731

# Combine an Inference Pass plan key with an explicit plan-agent model
fast opencode on --plan-key --plan deepseek-v4-flash-0731
```

`--build` and `--plan <model-id>` pin OpenCode's build and plan agents; both
default to `--model`. Passing bare `--plan` (with no model ID) connects with an
Inference Pass plan key instead; to specify a plan-agent model while also using
an Inference Pass plan key, pass `--plan-key --plan <model-id>`. Explicit model
IDs used with a plan key must be included in your plan (`GET /v1/models`). Run
`on` again to change them. Restart OpenCode afterward.

### Switch models in OpenCode

Every model from the [model catalog](/models/) is registered under the
`inference-net` provider. Open the picker with `/models` (or Ctrl+X then M);
the choice is remembered for your next session. Reasoning models expose their
effort levels as variants — cycle them with Ctrl+T.

## Check status

```bash
fast opencode status
```

Shows the connection, model, and config paths.

## Disconnect

```bash
fast opencode off
```

Restores `opencode.json` to the backup taken by `on`, so edits made after
connecting are lost. Restart OpenCode afterward.

## Troubleshooting

- **`fast opencode on` fails to read the config** — fix the JSON syntax in
  `opencode.json` first.
- **Requests return 401** — run `fast status`, then `fast opencode on`.
- **Model rejected** — pick an ID from the [model catalog](/models/).