How to use OpenCode with a 5abeer API key
Install OpenCode 1, add 5abeer as a provider in opencode.json and run it on Claude, GPT and Gemini models paid from your 5abeer balance.
On this page
- What you get
- Before you start
- With a subscription: the 5abeer AI app
- Manual setup
- Install OpenCode
- Add the settings
- Run it
- Pick a model
- If you get an error
- Questions
- Which OpenCode version does this guide cover?
- Why don't I see the 5abeer models?
- Can I use Claude and GPT models together?
- How is a request billed?
To use OpenCode with 5abeer, install OpenCode 1, add a khabeer provider to opencode.json with the 5abeer base URL, and save your 5abeer API key in the KHABEER_API_KEY environment variable. Run opencode in your project and pick a 5abeer model; every request is paid from your balance. With a subscription, the 5abeer AI app does this setup for you.
What you get#
- OpenCode as it ships, with 5abeer ready as a provider in its model list.
- The Claude, GPT and Gemini models available in OpenCode, below their official price.
- Usage and cost per key in your dashboard.
Before you start#
- A terminal on macOS, Linux or Windows.
- An API key for the provider of the model you will use (create one). The config below uses a Claude model, so it needs a key for Claude models.
With a subscription: the 5abeer AI app#
If you have a 5abeer subscription that includes OpenCode, the 5abeer AI app sets it up on your subscription in one click, with no API key and no files to edit. The app runs on Mac, Windows and Linux; details in What each plan runs. With an API key, follow the manual setup below.
Manual setup#
Add the settings#
Put these settings in
opencode.jsonin your project folder, or in~/.config/opencode/opencode.jsonto use them in every project. OpenCode reads the key from theKHABEER_API_KEYenvironment variable.{ "$schema": "https://opencode.ai/config.json", "provider": { "khabeer": { "npm": "@ai-sdk/openai-compatible", "name": "5abeer", "options": { "baseURL": "https://api.5abeer.ai/v1", "apiKey": "{env:KHABEER_API_KEY}" }, "models": { "claude-sonnet-5.5": { "name": "Claude Sonnet 5.5" } } } }, "model": "khabeer/claude-sonnet-5.5" }opencode.json
Pick a model#
These models run in OpenCode today. Add the model id to the models list in the config file, then pick it inside OpenCode with /models. Remember that each key works only with its own provider's models.
Claude Sonnet 5.5DefaultInput$0.60Output$3Context1M
Claude Opus 5.5Input$1.20Output$6Context1M
GPT-6.1 SolInput$0.60Output$3Context922K
Gemini 4 ArgonInput$0.60Output$3Context—Claude Fable 5.1Input$3Output$15Context—
Claude Fable 5Input$3Output$15Context1M
Claude Opus 4.6Input$1.50Output$7.50Context1M
Claude Opus 4.7Input$1.50Output$7.50Context1M
Claude Opus 5Input$1.50Output$7.50Context1M
Claude Sonnet 5Input$0.60Output$3Context1M
Claude Sonnet 4.6Input$0.90Output$4.50Context1M
Claude Haiku 4.5Input$0.30Output$1.50Context200K
GPT-6 AstraInput$3Output$15Context—
GPT-6 SolInput$0.60Output$3Context922K
GPT-6 LunaInput$0.03Output$0.15Context922K
GPT-5.6 LunaInput$0.06Output$0.36Context400K
GPT-5.6 TerraInput$0.60Output$3.60Context400K
GPT-5.6 SolInput$1.20Output$6Context400K
GPT-5.5Input$1.50Output$9Context1.05M
GPT-5.4Input$0.75Output$4.50Context1.05M
GPT-5.4 MiniInput$0.23Output$1.35Context400K
GPT-5.2Input$0.53Output$4.20Context272K
Gemini 2.5 ProInput$0.38Output$3Context1M
Gemini 3.8 FlashInput$0.23Output$1.13Context—
Gemini 3 FlashInput$0.15Output$0.90Context1M
Gemini 3.1 ProInput$0.60Output$3.60Context1M
Official price from the provider's page, checked October 19, 2026.
All models and pricesIf you get an error#
INVALID_API_KEY: the key is wrong, or the environment variable isn't set in the terminal you started OpenCode from.MODEL_PLATFORM_NOT_ALLOWED: you picked a model from a provider other than the key's.INSUFFICIENT_BALANCE: your balance doesn't cover this request.
Every code and what it means is in Errors and fixes.
Questions#
Which OpenCode version does this guide cover?#
OpenCode 1, installed from npm as opencode-ai, from the opencode.ai install script or from the anomalyco/tap Homebrew tap. OpenCode 2 uses a different config file, so these settings don't apply to it.
Why don't I see the 5abeer models?#
OpenCode lists only the models in the provider's models list. Check that the config file is in your project folder or in ~/.config/opencode/, then open /models again.
Can I use Claude and GPT models together?#
Yes, with one key for each provider. A key works only with its own provider's models, so add a second provider entry with the other key.
How is a request billed?#
Each request is paid from your balance by the tokens it uses, at the model's 5abeer price. Details in Pricing and balance.
Was this page helpful?