All docs

OpenCode with 6bee.ai

OpenCode can use any OpenAI-compatible provider. Add 6bee.ai to its config file with the base URL and the model you want.

Before you start

  • OpenCode installed.
  • Create an account with a verified email address, add prepaid balance, then create a key on the console's API keys page. Keep the key secret.
  • Model IDs are listed in the console and returned by GET https://api.6bee.ai/v1/models. Replace <model id> with one of them.

Add the provider

Put this in ~/.config/opencode/opencode.jsonc, then export your key as SIXBEE_API_KEY:

~/.config/opencode/opencode.jsonc
// ~/.config/opencode/opencode.jsonc, then: export SIXBEE_API_KEY=<your key>
{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "sixbee": {
      "name": "6bee.ai",
      "env": ["SIXBEE_API_KEY"],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": { "baseURL": "https://api.6bee.ai/v1" },
      "models": {
        // set limit to the model's caps (see Limits)
        "<model id>": { "limit": { "context": 128000, "output": 16384 } }
      }
    }
  },
  "model": "sixbee/<model id>"
}

Set limit.context and limit.output to the caps of the model you chose, so OpenCode compacts the conversation before a request stops fitting:

Context
Input plus output up to the model’s window: 128K to 1M tokens, depending on the model.
Output
max_tokens up to the model’s output cap: 16,384 to 131,072, depending on the model. Larger values are lowered to the cap, not rejected. If omitted: 8,192 to 32,768.

Check that it works

  1. Run export SIXBEE_API_KEY=<your key>.
  2. Start opencode in a project folder and pick the sixbee/<model id> model if it is not already selected.
  3. Send a short message. The request shows up in the console’s usage log.

Troubleshooting

HTTP 401
The key is missing or wrong. Copy it again from the console, without spaces or quotes.
Model not found
The model ID does not match. List the valid IDs with GET /v1/models or check the console.
HTTP 429
You are over a per-account limit (requests, input tokens or concurrency). The Retry-After header says how long to wait.
HTTP 400 on long sessions
The request no longer fits the model’s context window. Compact or clear the conversation, or switch to a model with a larger window.
Request rejected for balance
Each request first reserves its input plus max_tokens of output. Top up, or lower max_tokens.