Skip to content
OpenCode

Coding agents

Use OpenCode with Shannon

Add Shannon as a provider in opencode.json and OpenCode plans, edits and runs code on Shannon models.

  • Tested Nov 7, 2026
  • OpenAI Chat Completions
  • About 3 min

About OpenCode

OpenCode is an open-source coding agent with a terminal interface, a desktop app and IDE extensions. It works with many model providers, plans and edits code with its own tools, and keeps sessions you can come back to. A provider block in opencode.json adds Shannon next to the providers you already use.

What you need

A Shannon API key
Keys & usage
Base URL
https://api.shannon-ai.com/v1 Endpoint: /v1/chat/completions
Every snippet below follows your choice.

Set it up

  1. Export your API key

    The config reads it as {env:SHANNON_API_KEY}, so the key stays out of the file.

    Shell
    export SHANNON_API_KEY=YOUR_API_KEY
  2. Add Shannon as a provider

    Put this in ~/.config/opencode/opencode.json for every project, or in opencode.json at the root of one project. limit.context tells OpenCode when to compact the conversation.

    ~/.config/opencode/opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "shannon": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Shannon",
          "options": {
            "baseURL": "https://api.shannon-ai.com/v1",
            "apiKey": "{env:SHANNON_API_KEY}"
          },
          "models": {
            "Kimi-K3-uncensored-NVFP4": {
              "name": "Kimi-K3-uncensored-NVFP4",
              "limit": { "context": 1022976, "output": 262144 }
            }
          }
        }
      },
      "model": "shannon/Kimi-K3-uncensored-NVFP4"
    }
  3. Run OpenCode

    Start opencode in your project, or give it one task with opencode run. /models switches between the ids you listed.

    Shell
    opencode run "Run the tests and fix what fails."
    OpenCode in a terminal on the Shannon model Kimi-K3-uncensored-NVFP4: it runs the tests, fixes two bugs and the tests pass
    A real run on OpenCode 1.19.5: tests run, two fixes made, all tests passing.

Check that it works

Send: What does this project do?

You should see: OpenCode reads your files and answers; the status line shows shannon/<id>.

Models that fit OpenCode

Every id below meets what OpenCode needs. The first one is the default in the snippets.

Model idContext windowMax outputImage input
Kimi-K3-uncensored-NVFP4 1,022,976 262,144 Yes
shannon-coder-1 131,072 65,536 No
Kimi-K3.1-Pro-uncensored-NVFP4 1,022,976 262,144 Yes
Kimi-K3-uncensored-3BIT-REAP 225,280 225,280 Yes
shannon-3 196,608 65,536 Yes

Model settings

OpenCode asks for these values. They follow the model you picked.

SettingValueWhy
limit.context 1022976 The model's window; OpenCode compacts before it.
limit.output 262144 The longest answer.

Good to know

  • OpenCode 1.19 reads the provider block shown here. The newer providers / package / settings form in OpenCode's online schema is skipped by 1.19 ("Omitted native setting") and OpenCode then waits without a model.
  • In a script, close standard input: opencode run "…" < /dev/null. Without a terminal, opencode run waits for input first.
  • List several ids under models to switch between them with /models.

Tips

  1. Put the provider in ~/.config/opencode/opencode.json to use it in every project, or in opencode.json at the project root for one project.
  2. Type /models in the interface to switch between the ids listed under the provider.
  3. Set limit.context and limit.output for each model so OpenCode knows when to compact.
  4. opencode run "…" < /dev/null runs one task without the interface, for scripts.

Troubleshooting

SymptomCauseFix
OpenCode starts and then waits forever The config uses providers (plural), which this version drops, so no model is selected; or opencode run is waiting on standard input. Use provider with npm, options and models as above; in scripts add < /dev/null.
401 SHANNON_API_KEY is not set where OpenCode starts. Export it, or write the key into options.apiKey.
"Model not found" The model value does not match a provider and model id. Write it as shannon/<id>, with the id exactly as listed under models.
401 Unauthorized The key is missing, mistyped or rotated. Copy the key again from Keys & usage; it starts with sk-.
context_length_exceeded / "prompt is too long" The conversation is longer than the model's window. Start a new chat, let the tool compact it, or pick a model with a larger window.
insufficient_quota Your balance cannot pay for the request. Top up or change plan; the request is not retried by itself.

Questions

Does OpenCode work with Shannon?

Yes, as a custom provider with the @ai-sdk/openai-compatible package and the base URL https://api.shannon-ai.com/v1.

Which model should OpenCode use?

A model with tool calls and a long window, such as Kimi-K3-uncensored-NVFP4; shannon-coder-1 suits shorter tasks.

Choose your language

All languages are equal. Pick the one you want to browse in.

Europe

Middle East & North Africa

South Asia

Southeast Asia

East Asia

Central Asia & Caucasus

Africa

Oceania

Constructed & Classical