Coding Agents

OpenCode setup with Thalam

Install OpenCode (sst), drop your Thalam API key into opencode.json, and ship in under a minute. Claude, GPT, Gemini, DeepSeek, Qwen and more — accessible through the same OpenCode TUI you already use.

Install OpenCode

Setup in three steps

OpenCode reads opencode.json from the project root or from ~/.config/opencode/opencode.json globally.

1

Sign up

Create a THALAM account and copy your API key from the dashboard. No credit card required.

2

Add the provider config

Drop the JSON snippet below into opencode.json (project root) or ~/.config/opencode/opencode.json (global).

3

Connect & pick a model

In the OpenCode TUI run /connect, enter "thalam" as the provider id, paste your API key, then run /models to pick a model.

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "thalam": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "THALAM",
      "options": {
        "baseURL": "https://api.thalam.ai/v1"
      },
      "models": {
        "anthropic/claude-sonnet-4.6": {
          "name": "Claude Sonnet 4.6"
        },
        "deepseek/deepseek-v3.2": {
          "name": "DeepSeek V3.2"
        }
      }
    }
  }
}

Add as many model entries as you want under models. Each key is the THALAM model id (<provider>/<model>) — browse them on the . The name field is just the friendly label OpenCode shows in the picker.

Verify it works

Inside the OpenCode TUI, ask the active model:

Which model are you and which API base URL is serving you?

Common gotchas

Three issues that account for almost every "it didn't work" report.

Provider not found

The npm field must be exactly @ai-sdk/openai-compatible. OpenCode pulls the package on first use; if it can't reach npm the provider won't load — check your network and run OpenCode again.

Auth not picked up

OpenCode stores keys in ~/.local/share/opencode/auth.json. If /connect never ran, no key is there. Either run /connect in the TUI or set "apiKey": "{env:THALAM_API_KEY}" in your provider's options and export the env var.

Model id missing in /models

You added the model under the wrong provider key, or the JSON has a trailing-comma syntax error. Check models sits under provider.thalam and the JSON validates.


Why use THALAM with OpenCode

OpenCode runs as a TUI agent — model choice and per-call cost dominate any meaningful session.

Every leading model, one provider

List as many model ids as you want under the same THALAM provider entry. Switch via /models in the TUI without restarting.

Project vs global config

opencode.json in the project root overrides ~/.config/opencode/opencode.json — different repos can default to different models with the same THALAM key.

Pay per token

No subscription, no minimums. Auth lives in ~/.local/share/opencode/auth.json (gitignored by OpenCode), so it doesn't leak into commits.

OpenAI-compatible end to end

Streaming, tool calling, structured outputs, vision — every OpenCode feature works through Thalam without a custom adapter.


Frequently asked questions

What developers ask before wiring Thalam into OpenCode (sst).

Do I need an API key to use OpenCode with Thalam?

?

Yes. OpenCode reads provider credentials from ~/.local/share/opencode/auth.json (written by /connect inside the TUI) or from an env var referenced in opencode.json. To route OpenCode through Thalam, create a free Thalam account, copy your API key from the dashboard, then run /connect in the TUI and paste it. No credit card required to create the key — you only pay when you make requests.

How do I install OpenCode and connect it to Thalam?

?

Three steps. (1) Install OpenCode (sst) — see opencode.ai/docs/ for the platform installer. (2) Sign up at thalam.ai and copy your tl-live-... key. (3) Drop the provider block from the snippet above into opencode.json (project root) or ~/.config/opencode/opencode.json (global), then inside the TUI run /connect, enter "thalam" as the provider id, paste your key, and pick a model with /models.

Is Thalam OpenAI-compatible?

?

Yes. Thalam exposes an OpenAI-compatible base URL at https://api.thalam.ai/v1, and OpenCode connects to it via the @ai-sdk/openai-compatible npm package — exactly the integration shape OpenCode uses for every OpenAI-compatible provider. Every model Thalam routes to (Claude, Gemini, DeepSeek, Qwen and more) is reachable through the same OpenAI Chat Completions interface.

Can I use Thalam with OpenCode on Mac and Windows?

?

Both, plus Linux. OpenCode runs in any modern terminal — macOS, Windows (PowerShell or WSL), Linux. opencode.json works the same on every platform; only the global config path differs (~/.config/opencode/opencode.json on Mac/Linux vs. %USERPROFILE%\.config\opencode\opencode.json on Windows).

Can I switch models without changing my code?

?

Yes. List as many model ids as you want under the same Thalam provider entry in opencode.json, then run /models in the TUI to switch between them at runtime. Switching between Claude, GPT, DeepSeek or any other Thalam-routed model is a config change, not a code change.

Plug in. Pick a model. Ship.

Get an API key in under a minute. No credit card required.