Skip to content

OpenCode

OpenCode supports OpenAI-compatible providers declared in its configuration file. We declare Kloria there, with the models you want in the picker.

  1. Install OpenCode

    Fenêtre de terminal
    curl -fsSL https://opencode.ai/install | bash

    Or with npm: npm install -g opencode-ai.

  2. Put your key in an environment variable

    Add to your ~/.zshrc or ~/.bashrc, then open a new terminal:

    Fenêtre de terminal
    export KLORIA_API_KEY="sk-…"
  3. Declare Kloria in the configuration

    Global file: ~/.config/opencode/opencode.json. You can also put an opencode.json at a project’s root, but then without a plain-text key in it.

    ~/.config/opencode/opencode.json
    {
    "$schema": "https://opencode.ai/config.json",
    "provider": {
    "kloria": {
    "npm": "@ai-sdk/openai-compatible",
    "name": "Kloria",
    "options": {
    "baseURL": "https://api.kloria.dev/v1",
    "apiKey": "{env:KLORIA_API_KEY}"
    },
    "models": {
    "claude-sonnet-5": { "name": "Claude Sonnet 5" },
    "claude-opus-5-5": { "name": "Claude Opus 5.5" },
    "claude-sonnet-4-6": { "name": "Claude Sonnet 4.6" },
    "gpt-6.1-sol": { "name": "GPT-6.1 Sol" },
    "gpt-5.6-terra": { "name": "GPT-5.6 Terra" }
    }
    }
    },
    "model": "kloria/claude-sonnet-5"
    }

    {env:KLORIA_API_KEY} tells OpenCode to read the key from the environment variable: it’s never written in the file.

  4. Start OpenCode and check

    Fenêtre de terminal
    opencode

    Type /models: the Kloria models appear under the Kloria provider. Pick one and send a message.

Symptom Check
Kloria doesn’t show up in /models The JSON is invalid or the file isn’t in the right place. Check the path and syntax (one extra comma is enough).
401 error KLORIA_API_KEY isn’t visible in this terminal, or the key is invalid. opencode auth list shows saved credentials.
“No available channel for model…” An ID in the models section is wrong.
© 2026 Kloria — private beta