Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.edgee.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Edgee’s OpenAI-compatible API works seamlessly with OpenCode, allowing you to leverage OpenCode’s powerful CLI agent capabilities while maintaining control over your LLM infrastructure.

Configuration

To use Edgee with OpenCode, you need to configure the opencode.json configuration file. Open or create ~/.config/opencode/opencode.json and add the following configuration:
{
  "$schema": "https://opencode.ai/config.json",
  // Theme configuration
  "theme": "opencode",
  "autoupdate": true,
  "provider": {
    "edgee": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "edgee",
      "options": {
        "baseURL": "https://api.edgee.ai/v1",
        "apiKey": "sk-edgee-..."
      },
      "models": {
        "mistral-small": {
          "name": "mistral small (edgee)"
        },
        "gpt-4": {
          "name": "gpt-4 (edgee)"
        },
        "claude-3-haiku": {
          "name": "claude 3 haiku (edgee)"
        }
      }
    }
  }
}
Make sure to replace "sk-edgee-..." with your actual Edgee API key.

Usage

Once configured, you can select the configured models directly within the OpenCode CLI interface. When you launch OpenCode, you will be able to choose from the models you defined in the models section of your configuration (e.g., “mistral small (edgee)”, “gpt-4 (edgee)”, etc.).

Authentication

Edgee uses standard Bearer token authentication. Your API key configured in opencode.json is automatically used to authenticate requests to the Edgee API.
Token compression is only available when routing through Edgee. You can use your own provider keys via BYOK — compression still applies as long as requests go through Edgee.

Benefits of Using OpenCode with Edgee

Unified Infrastructure

Access all LLM providers through Edgee while using OpenCode’s developer-friendly CLI.

Cost Control

Leverage Edgee’s cost tracking and routing while building applications with OpenCode.

Reliability

Combine OpenCode’s agent capabilities with Edgee’s automatic failover and load balancing.

Observability

Monitor your OpenCode sessions with Edgee’s built-in observability features.

Next Steps