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

# Using OpenCode with Sail

> Use OpenCode with Sail as your LLM provider.

[OpenCode](https://opencode.ai) is an open-source coding agent. Sail is OpenAI-compatible, so plugging it in is just a config change.

## Install

Follow the install instructions at [opencode.ai](https://opencode.ai). The most common path is:

```bash theme={null}
curl -fsSL https://opencode.ai/install | bash
```

## Get your API key

Sign up for [Sail](https://app.sailresearch.com) and create an API key.

## Configure

Create your OpenCode config with Sail as a provider:

```bash theme={null}
mkdir -p ~/.config/opencode
```

Then put this in `~/.config/opencode/opencode.jsonc`:

```jsonc theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "Sail": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.sailresearch.com/v1",
        "apiKey": "YOUR_SAIL_API_KEY",
      },
      "models": {
        "glm-5.2-asap": {
          "id": "zai-org/GLM-5.2-FP8",
          "name": "GLM-5.2 (asap)",
          "options": { "metadata": { "completion_window": "asap" } },
          "variants": {
            "none": { "reasoningEffort": "none" },
            "high": { "reasoningEffort": "high" },
            "xhigh": { "reasoningEffort": "xhigh" },
          },
        },
        "glm-5.2-priority": {
          "id": "zai-org/GLM-5.2-FP8",
          "name": "GLM-5.2 (priority)",
          "options": { "metadata": { "completion_window": "priority" } },
          "variants": {
            "none": { "reasoningEffort": "none" },
            "high": { "reasoningEffort": "high" },
            "xhigh": { "reasoningEffort": "xhigh" },
          },
        },
        "glm-5.2-standard": {
          "id": "zai-org/GLM-5.2-FP8",
          "name": "GLM-5.2 (standard)",
          "options": { "metadata": { "completion_window": "standard" } },
          "variants": {
            "none": { "reasoningEffort": "none" },
            "high": { "reasoningEffort": "high" },
            "xhigh": { "reasoningEffort": "xhigh" },
          },
        },
        "glm-5.2-flex": {
          "id": "zai-org/GLM-5.2-FP8",
          "name": "GLM-5.2 (flex)",
          "options": { "metadata": { "completion_window": "flex" } },
          "variants": {
            "none": { "reasoningEffort": "none" },
            "high": { "reasoningEffort": "high" },
            "xhigh": { "reasoningEffort": "xhigh" },
          },
        },
      },
    },
  },
}
```

Replace `YOUR_SAIL_API_KEY` with the key you created above.

## Run

```bash theme={null}
opencode
```

Once OpenCode is up, run `/models` and search "Sail" to choose a GLM-5.2
completion window. See [Completion windows](/completion-windows) for latency and
cost tradeoffs.

## Control reasoning

The GLM-5.2 entries above define `none`, `high`, and `xhigh` reasoning
variants. Press `Ctrl+T` in the OpenCode terminal UI to switch variants. The
selected variant sets Sail's reasoning effort until you switch again.

Run `/thinking` to show the reasoning blocks returned by the model:

```text theme={null}
/thinking
```

`/thinking` only controls whether OpenCode displays those blocks. It does not
change the model's reasoning effort. See OpenCode's
[reasoning variant](https://opencode.ai/docs/models/#variants) and
[`/thinking`](https://opencode.ai/docs/tui/#thinking) documentation for more
detail.

Sail accepts `none`, `minimal`, `low`, `medium`, `high`, and `xhigh` for models
that support reasoning. See the [API support matrix](/support) for the request
and streaming response fields. The example includes the off, high, and maximum
settings. You can add the other effort levels as variants if you need them.

To make high reasoning the model default, add `reasoningEffort` to the model's
`options`:

```jsonc theme={null}
"options": {
  "metadata": { "completion_window": "asap" },
  "reasoningEffort": "high",
},
```

OpenCode uses the camelCase `reasoningEffort` config key and sends it to Sail as
`reasoning_effort`.

For a non-interactive request, select the variant and show its reasoning with:

```bash theme={null}
opencode run \
  --model Sail/glm-5.2-asap \
  --variant high \
  --thinking \
  "Explain this code."
```

## Tips

* **What's next:** see OpenCode's [Usage guide](https://opencode.ai/docs/#usage).
* **New models:** add any other model from Sail's [model catalog](/models) under `provider.Sail.models`.
