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

# OpenCode

> Connect OpenCode to the LLM Gateway

You need an [LLM Gateway key](https://docs.getunbound.ai/llm-gateway/keys.md#create-a-key).

## Setup

1. Add the gateway as a provider in `~/.config/opencode/opencode.jsonc`. List each model or [alias](https://docs.getunbound.ai/llm-gateway/models.md#aliases) you want:

   ```jsonc ~/.config/opencode/opencode.jsonc theme={null}
   {
     "$schema": "https://opencode.ai/config.json",
     "provider": {
       "unbound": {
         "npm": "@ai-sdk/openai-compatible",
         "name": "Unbound",
         "options": {
           "baseURL": "https://api.getunbound.ai/v1",
           "apiKey": "{env:UNBOUND_API_KEY}"
         },
         "models": {
           "claude-sonnet-4-6": { "name": "Claude Sonnet 4.6" }
         }
       }
     }
   }
   ```

2. Set the key in your shell profile:

   ```bash theme={null}
   export UNBOUND_API_KEY=<your-key>
   ```

3. Run `opencode` and pick an **Unbound** model with `/models`.

## Check it works

Send a prompt. In **LLM Gateway → Keys**, the key's **Last Used** updates.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.