opencode

Point opencode at a Gateway key.

Run this

Writes the configuration below, backs up anything it touches, and picks up only the models your key actually serves. Run it again after connecting another plan and it adds what is new.

Terminal
ren inference setup opencode

Check it worked

Terminal
opencode run --model ren/anthropic/claude-sonnet-5 'say hello'

A reply, and `/models` lists the Ren provider with every model you configured.

Configure it by hand instead

The same result, written yourself. Replace <YOUR_KEY> with your key.

opencode takes the `/v1` suffix despite speaking the Anthropic API, because the AI SDK provider appends its own path segment.

  • Declare `limit` on every model

    opencode has no catalogue entry for Ren model ids and falls back to a default context window, which makes it compact far too early.

Terminal · bash

The config references the key as `{env:REN_INFERENCE_KEY}`, so the secret stays out of the file. Add this to your shell profile.

Terminal · bash
export REN_INFERENCE_KEY="<YOUR_KEY>"

Claude models

~/.config/opencode/opencode.jsonc

Adds Ren as a provider. opencode deep-merges config, so your existing providers are untouched.

~/.config/opencode/opencode.jsonc
{
  "provider": {
    "ren": {
      "npm": "@ai-sdk/anthropic",
      "name": "Ren",
      "options": {
        "baseURL": "https://llm.useren.ai/v1",
        "apiKey": "{env:REN_INFERENCE_KEY}"
      },
      "models": {
        "anthropic/claude-opus-5": {
          "name": "Claude Opus 5",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 1000000,
            "output": 64000
          }
        },
        "anthropic/claude-sonnet-5": {
          "name": "Claude Sonnet 5",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 1000000,
            "output": 64000
          }
        },
        "anthropic/claude-fable-5": {
          "name": "Claude Fable 5",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 1000000,
            "output": 64000
          }
        },
        "anthropic/claude-haiku-4-5": {
          "name": "Claude Haiku 4.5",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 200000,
            "output": 64000
          }
        }
      }
    }
  }
}

~/.config/opencode/opencode.jsonc

Optional

Makes Ren the default. Skip it to keep your current default and pick Ren from `/models` instead.

~/.config/opencode/opencode.jsonc
{
  "model": "ren/anthropic/claude-sonnet-5"
}

ChatGPT models

~/.config/opencode/opencode.jsonc

Adds Ren as a provider. opencode deep-merges config, so your existing providers are untouched.

~/.config/opencode/opencode.jsonc
{
  "provider": {
    "ren-codex": {
      "npm": "@ai-sdk/openai",
      "name": "Ren (Codex)",
      "options": {
        "baseURL": "https://llm.useren.ai/v1",
        "apiKey": "{env:REN_INFERENCE_KEY}"
      },
      "models": {
        "openai/gpt-5.6-sol": {
          "name": "GPT-5.6 Sol",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 272000,
            "output": 64000
          }
        },
        "openai/gpt-5.6-terra": {
          "name": "GPT-5.6 Terra",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 272000,
            "output": 64000
          }
        },
        "openai/gpt-5.6-luna": {
          "name": "GPT-5.6 Luna",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 272000,
            "output": 64000
          }
        },
        "openai/gpt-5.5": {
          "name": "GPT-5.5",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 272000,
            "output": 64000
          }
        },
        "openai/gpt-5.4": {
          "name": "GPT-5.4",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 272000,
            "output": 64000
          }
        },
        "openai/gpt-5.4-mini": {
          "name": "GPT-5.4 Mini",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 272000,
            "output": 64000
          }
        },
        "openai/gpt-5.3-codex-spark": {
          "name": "GPT-5.3 Codex Spark",
          "reasoning": true,
          "tool_call": true,
          "limit": {
            "context": 128000,
            "output": 64000
          }
        }
      }
    }
  }
}

~/.config/opencode/opencode.jsonc

Optional

Makes Ren the default. Skip it to keep your current default and pick Ren from `/models` instead.

~/.config/opencode/opencode.jsonc
{
  "model": "ren-codex/openai/gpt-5.6-terra"
}