Skip to main content
OpenCode is an open source AI coding agent for the terminal, desktop, and IDEs. For AIOHub, configure a separate provider so AIOHub API keys stay isolated from your official OpenAI, Anthropic, or other provider credentials.

Prerequisites

  • OpenCode installed
  • An AIOHub sk- API key
  • A group assigned to the API key that can access the model you want to use
  • A positive account balance
Check that OpenCode is available:

Config location

OpenCode supports global and project config. Use global config for your personal defaults and project config when you want to share model IDs with a repository.
Project opencode.json overrides matching fields from global config. Do not commit real API keys. For shared project config, save credentials locally with /connect or reference an environment variable.

Configure Chat Completions models

OpenCode uses @ai-sdk/openai-compatible for OpenAI Chat Completions-compatible models. Set the Base URL to https://api.aiohub.org/v1, not a full endpoint URL.

1. Add the credential

In the OpenCode TUI, run:
Choose Other, enter this provider ID:
Then enter your full AIOHub API key.

2. Add the provider config

Add this to opencode.json:
Replace gpt-4o with a Chat Completions model available to the group assigned to your API key. If you want a lightweight model for smaller tasks, add small_model:

Configure Responses models

If you want to use a model or workflow that requires OpenAI Responses, use @ai-sdk/openai. A separate provider ID keeps the Chat Completions and Responses paths clear. Put the API key in an environment variable:
Then configure a Responses provider:
You can keep multiple providers in one OpenCode config. Chat Completions and Responses use different request paths. If a model fails with endpoint or response-format errors, check that the npm package matches the model protocol.

Verify

Open OpenCode:
Run this in the TUI:
Choose a model under aiohub/... or aiohub-responses/..., then send a short message. A normal reply means the setup is working. You can also verify API key and model visibility with HTTP:

Troubleshooting

Confirm the provider ID entered through /connect exactly matches the provider key in opencode.json, for example aiohub. Restart OpenCode after editing config.
Set the Base URL to https://api.aiohub.org/v1. Do not set it to https://api.aiohub.org/v1/chat/completions or https://api.aiohub.org/v1/responses.
If you use /connect, confirm the credential is saved under the same provider ID. If you use an environment variable, run test -n "$AIOHUB_API_KEY" && echo "api key configured" before starting OpenCode.
Confirm the provider uses @ai-sdk/openai, not @ai-sdk/openai-compatible. If you only need basic chat, verify basic connectivity with a Chat Completions model first.

Official references