Use Xantly with OpenCode

sst/opencode is the cleanest BYO story in the AI coding CLI ecosystem. One opencode.jsonc block pointed at Xantly and every feature, chat, edit, agent, streaming, tools, just works.

OpenCode (github.com/sst/opencode) is a fully OSS AI coding CLI that leans on the Vercel AI SDK. Its custom-provider config is the cleanest BYO story in the ecosystem, one JSON block and every feature works: chat, edit, agent, streaming, tool calls.

Prerequisites

Setup

Edit ~/.config/opencode/opencode.jsonc (create it if missing):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "xantly": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.xantly.com/v1",
        "apiKey": "xantly_sk_..."
      },
      "models": {
        "xantly/auto-quality": { "name": "Xantly Quality (BaRP T1)" },
        "xantly/auto-value":   { "name": "Xantly Value (BaRP T2)" },
        "xantly/auto-speed":   { "name": "Xantly Speed (BaRP T3)" },
        "anthropic/claude-sonnet-4.6": { "name": "Claude Sonnet 4.6 (pinned)" },
        "openai/gpt-5.4":               { "name": "GPT-5.4 (pinned)" }
      }
    }
  },
  "model": "xantly/auto-quality"
}

Or use the equivalent env-var style for CI:

export OPENCODE_PROVIDER_XANTLY_BASE_URL=https://api.xantly.com/v1
export OPENCODE_PROVIDER_XANTLY_API_KEY=xantly_sk_...

Verify

cd any-project
opencode
# at the prompt:
> list files in this directory and tell me what this codebase does

OpenCode should fire read_file / list_files tool calls against Xantly, return a summary, and log the request in your dashboard with cost + cache status.

Model choice

OpenCode's agent mode uses tools heavily, multi-file reads, multi-step plans, parallel edits. Recommended:

Model IDWhy
xantly/auto-qualityBaRP picks the best T1, safest for agent mode.
anthropic/claude-sonnet-4.6Rock-solid tool calling.
openai/gpt-5.4Strong structured outputs.
xantly/auto-valueBudget mode for routine tasks.

What you get

Gotchas

@ai-sdk/openai-compatible version matters. OpenCode pins this transitively. If your opencode.jsonc doesn't load, run opencode --version and verify it's on 0.14.0+.

Streaming vs non-streaming. OpenCode uses streaming by default. Xantly supports it natively (OpenAI SSE shape). If you see chunks arriving slowly, check your network, Xantly's p95 stream overhead is <20ms.

Custom provider names must be valid JSON keys. xantly works. Avoid hyphens or weird chars in the provider key.

Next steps