Skip to content

How to set up Codex CLI with a 5abeer API key

Add 5abeer as a provider in Codex CLI's config.toml, save your key in one environment variable and run GPT models at about 70% below the official price.

Updated October 31, 2026
On this page

To run Codex CLI with 5abeer, install Codex, add a khabeer provider with the 5abeer base URL to ~/.codex/config.toml, and save your 5abeer API key in the KHABEER_API_KEY environment variable. Then run codex in your project; every request is paid from your 5abeer balance. With a subscription, the 5abeer AI app does this setup for you.

What you get#

  • Codex CLI exactly as it ships, with its commands and settings.
  • The GPT models 5abeer serves, at about 70% 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 GPT models (create one).

With a subscription: the 5abeer AI app#

If you have a 5abeer subscription that includes Codex, the 5abeer AI app sets it up on your subscription for you, 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 Codex CLI#

    Run the official installer for your system:

    curl -fsSL https://chatgpt.com/codex/install.sh | sh

    If you have Node.js, you can install it with npm instead, or with Homebrew on macOS:

    npm install -g @openai/codex
  2. Add the settings#

    Put these settings in ~/.codex/config.toml. Codex reads the key from the KHABEER_API_KEY environment variable, so save your key there with the tab for your system.

    model = "gpt-6.1-sol"
    model_provider = "khabeer"
    
    [model_providers.khabeer]
    name = "5abeer"
    base_url = "https://api.5abeer.ai/v1"
    env_key = "KHABEER_API_KEY"
    wire_api = "responses"
    

    ~/.codex/config.toml

    The terminal commands above set the key only in the current terminal. To keep it in every new terminal, save it once:

    echo 'export KHABEER_API_KEY="YOUR_5ABEER_API_KEY"' >> ~/.zshrc

    Then open a new terminal. The saved key only reaches terminals you open after saving it.

  3. Run it#

    Terminal
    cd your-project
    codex

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

Pick a model#

These models run in Codex today. Change the model line in the config file, or pick a model inside Codex with /model.

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#

Do I need a ChatGPT or OpenAI account?#

No. The khabeer provider in the config reads your 5abeer key from KHABEER_API_KEY, so Codex sends that key and you don't sign in to OpenAI.

Why does Codex say the key is missing?#

The variable isn't set in the terminal that started Codex. Set it again, or save it permanently and open a new terminal, then run codex again.

What does wire_api = "responses" do?#

It makes Codex send requests in the OpenAI Responses format, which 5abeer serves for GPT models. It's the only value Codex supports, and the default if you leave the line out. Details in the Responses reference.

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.

Sources#

Checked on 2026-11-01: