Configure Codex CLI
This page explains how to use Codex CLI with Cubicspaces through the OpenAI-compatible API.
Prerequisites
- Codex CLI is installed.
- You have created a Cubicspaces API key.
- Your account can access a model suitable for coding tasks.
Set the API Key
powershell
$env:OPENAI_API_KEY="YOUR_API_KEY"bash
export OPENAI_API_KEY="YOUR_API_KEY"For long-term use, save this variable in your shell profile or system environment variables.
Configure Codex
Edit the Codex config file:
text
~/.codex/config.tomlAdd a Cubicspaces model provider and set it as the default provider:
toml
model_provider = "cubicspaces"
model = "gpt-5.5"
[model_providers.cubicspaces]
name = "Cubicspaces"
base_url = "https://cubicspaces.cloud/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"Replace model with a model available to your account and suitable for coding tasks.
Verify the Setup
Run this in any project directory:
bash
codex "Read the current project structure and summarize the main directories."If Codex returns a project summary, the Cubicspaces connection is working.
Troubleshooting
401 or authentication failed
Check that OPENAI_API_KEY is set to your Cubicspaces API key and is available in the current terminal session.
404 or wrong request path
Codex needs /v1 in base_url when using the OpenAI-compatible API:
text
https://cubicspaces.cloud/v1