Use Codex CLI with Qorebit
Codex CLI is OpenAI’s open-source local coding agent that runs in your terminal. Configure it to route seamlessly through Qorebit to use state-of-the-art models for terminal-driven agentic coding workflows.
1. Install & Authenticate Codex CLI
Install the Codex CLI globally on your system using npm, verify the installation, and force API key authentication:
npm install -g @openai/codex
codex --version
# Force API key mode (bypasses ChatGPT web authentication)
codex login --with-api-key2. Configure Qorebit Backend
Select your preferred way to connect Codex CLI to Qorebit. You can configure Qorebit as an OpenAI-compatible backend using global environment variables, or write a custom provider configuration inside Codex's configuration file.
# Set environment variables
export OPENAI_API_KEY="your_qorebit_api_key"
export OPENAI_BASE_URL="https://api.qorebit.ai"
# Confirm configuration
echo $OPENAI_BASE_URL💡 Note: Replacing your_qorebit_api_key with your actual live Qorebit API key (e.g. qb_live_xxxxxxxxxxxxx) will authenticate your CLI requests immediately.
3. Start Codex CLI
Navigate to your active project folder and launch Codex CLI. It will index and interact with the local context securely:
# Navigate to project folder and launch interactive agent
cd /path/to/your/project
codexOr test the Codex agent directly by requesting a one-off snippet:
# Execute a one-off prompt directly in your shell
codex "write a python function to reverse a string"Configuration Reference
Configure behavior, model provider selections, and trust properties in your global ~/.codex/config.toml configuration.
Core Settings
| Setting | Description | Example |
|---|---|---|
model_provider | Provider to use for model requests | "qorebit" |
model | Qorebit-supported model slug | "gpt-4o" or "claude-3-5-sonnet" |
model_reasoning_effort | Reasoning effort depth for compatible models | "low", "medium", "high", "xhigh" |
show_raw_agent_reasoning | Show deep thinking tokens raw inside CLI output | true or false |
personality | Select preferred tone preset for coding assistant | "pragmatic" or "helpful" |
Qorebit Provider Block
This block defines custom API details:
| Parameter | Description | Value |
|---|---|---|
base_url | Endpoint URL. Route it through the Qorebit gateway. | "https://api.qorebit.ai/v1" |
env_key | Shell environment variable containing your Qorebit API key. | "QOREBIT_API_KEY" |
Project Trust Levels
Manage safety permissions per directory. Restrict untrusted paths from running shell commands automatically:
# ~/.codex/config.toml
[projects."/path/to/trusted/project"]
trust_level = "trusted"
[projects."/path/to/untrusted/project"]
trust_level = "untrusted"| Trust Level | Description |
|---|---|
"trusted" | Allows agent full read, write, and CLI execution permissions. |
"untrusted" | Locks down write actions and prevents automated shell executions. |
Why Use Qorebit with Codex CLI?
Unified Wallet Billing
Say goodbye to separate recurring API accounts. Keep a single balance inside your Qorebit account and pay only for tokens used during coding tasks.
Model Flexibility
Switch models instantly by editing your local config.toml settings. Point the model key to any flagship or open-weight AI agent model.
Unrestricted Access
Leverage advanced coding models, high context capabilities, and reasoning-effort layers within one unified interface.
Strict Sandbox Control
Securely control directory trust limits in your config to prevent risky automated commands inside sensitive code repos.
Troubleshooting
ChatGPT Authentication Prompt
By default, Codex CLI attempts to authenticate via the ChatGPT web interface. Run codex login --with-api-key in your terminal to force it into API-key-only mode.
Authentication Errors
Ensure your active API key starts with qb_live_. If you are using the Custom Provider config option, make sure the variable exported matches your env_key definition (e.g. QOREBIT_API_KEY).
Model Not Found
Double check that the model name configured in config.toml is active and supported on the Qorebit Models catalog. Common options include gpt-4o and claude-3-5-sonnet.
Host or Connection Refused
Ensure the base_url in your custom provider block inside ~/.codex/config.toml is set to https://api.qorebit.ai/v1, and OPENAI_BASE_URL in shell environment settings is set to https://api.qorebit.ai.