Use eb1 with OpenCode

OpenCode is an open-source terminal coding agent with configurable model providers. Register Keiro as an OpenAI-compatible provider in OpenCode's own configuration, then select an enabled public eb1 model.

On this page 1 of 6

Before you configure#

A dedicated key lets you inspect and revoke OpenCode traffic independently from production application traffic.

  1. Open API keys.
  2. Create a dedicated key for this OpenCode installation.
  3. Keep the newly revealed secret available in your password manager until setup is complete.

Install and configure#

Install OpenCode with the opencode-ai package, or run it through npx:

Install with npm Shell
npm install --global opencode-ai@latest
# or
npx --yes opencode-ai@latest --help

OpenCode reads provider settings from opencode.json. Add a Keiro entry that uses the OpenAI-compatible provider package and the public Keiro API base URL:

JSON payload JSON
{
  "$schema": "https://opencode.ai/config.json",
  "model": "keiro/eb1-preview",
  "small_model": "keiro/eb1-preview",
  "provider": {
    "keiro": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Keiro",
      "options": {
        "baseURL": "https://api.keirolabs.ai/v1",
        "apiKey": "{env:KEIRO_API_KEY}",
        "timeout": 120000,
        "headerTimeout": 60000,
        "chunkTimeout": 60000
      },
      "models": {
        "eb1-preview": {
          "name": "eb1-preview",
          "limit": { "context": 400000, "output": 32000 }
        },
        "eb1-frontier-preview": {
          "name": "eb1-frontier-preview",
          "limit": { "context": 400000, "output": 32000 }
        },
        "eb1-fast-preview": {
          "name": "eb1-fast-preview",
          "limit": { "context": 240000, "output": 32000 }
        },
        "eb1-efficient-preview": {
          "name": "eb1-efficient-preview",
          "limit": { "context": 400000, "output": 32000 }
        }
      }
    }
  }
}

Set KEIRO_API_KEY only for the OpenCode process, or source it from your approved local secret manager. Do not place raw secret bytes in a shared project file or commit them to a repository. Avoid opencode debug config with a real key unless the output is fully controlled; it can print resolved secrets.

The limit.context values mirror each model's published context_window in /v1/models. limit.output is the generation cap OpenCode requests per turn; raise or lower it to match your plan's output-token budget.

Models#

Start with eb1-preview. Switch models when the task has a clear quality, latency, or cost requirement:

See Models for what each model is for.

  • eb1-preview
  • eb1-frontier-preview
  • eb1-fast-preview
  • eb1-efficient-preview

Authentication#

The key is sent as Authorization: Bearer, the same credential form as every other public endpoint. See API auth. A 401 means the configured key is missing, invalid, or revoked.

Requests from OpenCode appear in Keiro Usage and Logs like other API traffic. For local validation, prefer opencode run --format json or a sanitized session export for token totals. opencode stats can remain zero for custom model entries unless cost metadata is configured.

Rotate the OpenCode key#

  1. Create a replacement dedicated key in the console.
  2. Update the key in OpenCode's secret store or local configuration.
  3. Start OpenCode and verify a harmless request.
  4. Delete the old key in the console.

Search Keiro docs

Start typing to search pages and sections.

Start typing to search pages and sections.

Documentation

Console