## Watch the setup video

Poolside with OpenCode

## Prerequisites

- You have one of the following:
  - A Poolside Platform API key. To create one, go to [platform.poolside.ai](https://platform.poolside.ai/).
  - An API key for your organization’s Poolside deployment.
  - An OpenRouter API key with access to Poolside models. To create one, go to [OpenRouter API keys](https://openrouter.ai/keys).

## Steps

- Poolside Platform
- Poolside deployment
- OpenRouter

01. In Poolside Platform, open **API Keys**.
02. Click **New key**.
03. Copy the API key.
04. In OpenCode, run the `/connect` command.

```
    /connect
    ```

05. Scroll to **Other**.
06. Enter `poolside` as the provider ID.

```
    poolside
    ```

07. Enter your Poolside Platform API key.
08. Add an example Poolside provider to your `opencode.json` file. The `models` block below is an example. Use a Poolside model available to your API key. To find model IDs for your access method, see [List available models](https://docs.poolside.ai/api/openai-api-examples#list-available-models).

opencode.json

```
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "poolside": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Poolside",
          "options": {
            "baseURL": "https://inference.poolside.ai/v1"
          },
          "models": {
            "<poolside-model-id>": {
              "name": "Poolside model"
            }
          }
        }
      }
    }
    ```

09. Run the `/models` command.

```
    /models
    ```

10. Select a Poolside model.
11. Start a new chat and send a codebase question to confirm OpenCode responds with the selected Poolside model.

If you run Poolside on your own infrastructure, set the base URL to your deployment’s OpenAI-compatible endpoint instead. Replace `<api-domain>` with your deployment’s host. The path is `/openai/v1`.

To use OpenCode with your organization’s Poolside deployment, configure Poolside as a custom OpenAI-compatible provider and provide your API key through the `POOLSIDE_API_KEY` environment variable.

```
export POOLSIDE_API_KEY="<api-key>"
```

opencode.json

```
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "poolside": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Poolside",
      "env": ["POOLSIDE_API_KEY"],
      "options": {
        "baseURL": "https://poolside.example.com/openai/v1"
      }
    }
  }
}
```

- `env`: Environment variables OpenCode reads your API key from.
- `options.baseURL`: Your deployment’s OpenAI-compatible endpoint.

Run the `/models` command, select a Poolside model, then start a new chat and send a codebase question to confirm OpenCode responds with the selected Poolside model.

1. In OpenCode, run the `/connect` command.

```
    /connect
    ```

2. Select **OpenRouter**.
3. Enter your OpenRouter API key. To create one, go to [OpenRouter API keys](https://openrouter.ai/keys).
4. Select a Poolside model.  OpenRouter may offer free and paid Poolside models. To see current availability, see [Poolside models on OpenRouter](https://openrouter.ai/poolside).
5. Start a new chat and send a codebase question to confirm OpenCode responds with the selected Poolside model.
