OpenCode (gateway)

Route OpenCode’s LLM calls through the Respan gateway for automatic logging, caching, and model switching. Only your RESPAN_API_KEY is needed.

Setup

1

Install OpenCode

$npm install -g opencode-ai
2

Set environment variables

Add to your shell profile (.bashrc, .zshrc, or PowerShell $PROFILE):

$export OPENAI_BASE_URL="https://api.respan.ai/api/"
$export OPENAI_API_KEY="YOUR_RESPAN_API_KEY"

No separate OpenAI API key needed — the Respan gateway handles provider authentication.

3

Run OpenCode

$opencode run -m "openai/gpt-5.5" "your prompt"

All LLM calls now route through Respan.

Switch models

Change the -m flag to use 250+ models from different providers through the same gateway.

$opencode run -m "openai/gpt-5.5" "your prompt"
$opencode run -m "openai/gpt-5-mini" "your prompt"

OpenCode’s model flag includes the configured provider namespace. This page avoids showing Claude or Gemini behind the openai/ provider; use the Respan API or OpenAI SDK gateway pages for provider-neutral Claude and Gemini examples.

See the full model list.