Skip to content

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.

Updated October 31, 2026

Waiting for a test run on the staging stack before publishing

On this page

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#

  1. Install OpenCode#

    npm install -g opencode-ai

    Check it with opencode --version.

  2. Add the settings#

    Put these settings in opencode.json in your project folder, or in ~/.config/opencode/opencode.json to use them in every project. OpenCode reads the key from the KHABEER_API_KEY environment 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

  3. Run it#

    Terminal
    cd your-project
    opencode

    Ask for anything. If a reply comes back, you're set.

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.

per 1M tokens

Official price from the provider's page, checked October 19, 2026.

All models and prices

If you get an error#

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.