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

# OpenCode

> Install OpenCode and add Floodgate as a custom provider.

OpenCode can use all Floodgate models through one custom provider.

## 1. Install OpenCode

<CodeGroup>
  ```bash macOS, Linux, or WSL theme={null}
  curl -fsSL https://opencode.ai/install | bash
  ```

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

  ```powershell Windows with Chocolatey theme={null}
  choco install opencode
  ```
</CodeGroup>

## 2. Set your API key

```bash theme={null}
export FLOODGATE_API_KEY="YOUR_API_KEY"
```

PowerShell:

```powershell theme={null}
$env:FLOODGATE_API_KEY = "YOUR_API_KEY"
```

## 3. Add the provider

Create `~/.config/opencode/opencode.json`. You can alternatively place `opencode.json` inside your project root.

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "model": "floodgate/gpt-6-sol",
  "provider": {
    "floodgate": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Floodgate",
      "options": {
        "baseURL": "https://api.floodgate.dev/v1",
        "apiKey": "{env:FLOODGATE_API_KEY}"
      },
      "models": {
        "gpt-6-sol": { "name": "GPT-6 Sol" },
        "gpt-6-astra": { "name": "GPT-6 Astra" },
        "gpt-6-luna": { "name": "GPT-6 Luna" },
        "claude-opus-5-5": { "name": "Claude Opus 5.5" },
        "claude-opus-5": { "name": "Claude Opus 5" },
        "claude-sonnet-5": { "name": "Claude Sonnet 5" },
        "grok-4.7": { "name": "Grok 4.7" },
        "deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash" },
        "qwen3.8-max": { "name": "Qwen 3.8 Max" }
      }
    }
  }
}
```

## 4. Run OpenCode

```bash theme={null}
cd /path/to/your/project
opencode
```

Run `/models` inside the OpenCode TUI to switch between models under **Floodgate**.

<Tip>
  For the best general coding experience, use `floodgate/gpt-6-sol` or `floodgate/claude-opus-5-5`. Switch to `floodgate/deepseek-v4.1-flash` or `floodgate/gpt-6-luna` for ultra-fast, budget-conscious completions.
</Tip>


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