Integrations

OpenCode

OpenCode supports custom providers. Point it at the ApiHub OpenAI Compatible endpoint with your API Key to access all available models.

Last updated: 2026-08-03

1

Install OpenCode

Install per the official docs and confirm the command runs.

2

Configure the ApiHub provider

Store the key in an environment variable and add an OpenAI Compatible provider with an explicit model.

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apihub": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "ApiHub",
      "options": {
        "baseURL": "https://www.apihub.ink/v1",
        "apiKey": "{env:APIHUB_KEY}"
      },
      "models": {
        "deepseek-v4-flash": { "name": "DeepSeek V4 Flash" }
      }
    }
  }
}
Environment variable
export APIHUB_KEY="your-apihub-key"
3

Select the provider and send a request

Launch OpenCode, select the apihub provider, and choose a model.

Verification

  • OpenCode sends requests via the apihub provider successfully.

Common Errors

  • Using a provider schema from another OpenCode version or another tool.
  • `options.baseURL` is missing `/v1`, or `APIHUB_KEY` is not set.