# OpenCode & ChatGPT passthrough (/docs/clients/opencode)



Route OpenCode's OpenAI provider through llama-dash to log and inspect ChatGPT subscription requests. OpenCode keeps ownership of the subscription OAuth bearer; llama-dash preserves it while forwarding requests to the ChatGPT Codex backend.

## Client config [#client-config]

Connect OpenCode to **OpenAI** with its ChatGPT subscription first. Then set the OpenAI provider base URL in `~/.config/opencode/opencode.jsonc`:

```jsonc
{
  "provider": {
    "openai": {
      "options": {
        "baseURL": "https://<llama-dash-host>/v1"
      },
    }
  }
}
```

Restart OpenCode after changing its config:

```sh
opencode2 service restart
```

Do not set an OpenAI API key for this flow. OpenCode supplies its subscription credentials, and llama-dash forwards them unchanged.

## Routing rule [#routing-rule]

In **Policies**, add a first-match routing rule for the OpenAI Responses API:

* Match endpoint `/v1/responses`.
* Match the exact OpenCode model IDs you use, such as `gpt-5.6-terra`, `gpt-5.6-luna`, and `gpt-5.6-sol`.
* Set action to `continue`.
* Set auth mode to `passthrough` and preserve the client `Authorization` header.
* Set direct target to `https://chatgpt.com/backend-api/codex`.

Do not leave **Requested model** empty. Other OpenAI-compatible clients can use `/v1/responses`; exact model matching limits this rule to the selected OpenCode models.

The resulting requests remain visible in **Requests**, including routing metadata, the redacted authorization header, and OpenCode attribution.
