ZH

Search

Configure OpenCode with Earbowe API

Add Earbowe as an OpenAI-compatible custom provider in OpenCode (opencode.json).

Admin2 min read

Configure OpenCode with Earbowe API

OpenCode supports custom providers through opencode.json. You can point it at any OpenAI-compatible gateway — including Earbowe.

This guide follows the same pattern used by mature gateway docs (custom baseURL + @ai-sdk/openai-compatible).

1. Get a key

Create an API key in the Earbowe Console.

2. Choose base URL

Region Base URL
Global https://api.earbowe.com/v1
China direct https://api.3861343.xyz/v1

Always include /v1.

3. Verify models first

Terminal window
curl -s https://api.earbowe.com/v1/models \
-H "Authorization: Bearer sk-YOUR-KEY" | head -c 500

Copy exact model id values from the response. Do not invent marketing names.

4. Add a custom provider in OpenCode

Create or edit opencode.json (project or user config, depending on how you run OpenCode):

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"earbowe": {
"npm": "@ai-sdk/openai-compatible",
"name": "Earbowe",
"options": {
"baseURL": "https://api.earbowe.com/v1",
"apiKey": "{env:EARBOWE_API_KEY}"
},
"models": {
"gpt-4o-mini": {
"name": "GPT-4o mini"
},
"deepseek-v4-pro": {
"name": "DeepSeek V4 Pro"
}
}
}
},
"model": "earbowe/gpt-4o-mini"
}

Then export the key:

Terminal window
export EARBOWE_API_KEY="sk-YOUR-KEY"

Notes:

  • npm: @ai-sdk/openai-compatible is the usual adapter for OpenAI-compatible gateways.
  • Model keys under models should match IDs returned by /v1/models.
  • Default model format is often provider/modelearbowe/gpt-4o-mini.

5. China-direct variant

Only change baseURL:

"options": {
"baseURL": "https://api.3861343.xyz/v1",
"apiKey": "{env:EARBOWE_API_KEY}"
}

6. Common failures

Symptom Fix
Auth errors Check EARBOWE_API_KEY is exported and starts with sk-
Model missing Re-list /v1/models and update models map
Network timeout Try China-direct base URL
Adapter not found Ensure OpenCode can install @ai-sdk/openai-compatible