Coding agents
Codex setup
Use the installer or configure Codex manually with a Modelflare key and a Responses-compatible model.
This guide gets Codex connected to Modelflare and running its first request. Use Option A for automated setup. Use Option B to install Codex first, then create each required file yourself.
1. Create an API key
Section titled “1. Create an API key”Sign in to the Modelflare console, open API Keys, and create a key that can access gpt-5.6-sol. Choose any available non-default group that lists the model; there is no single required group.
Keep the key ready. You can use the installer or configure the same files manually.
2. Choose a setup method
Section titled “2. Choose a setup method”Option A: run the installer
Section titled “Option A: run the installer”Not comfortable with the terminal yet? Start with the interactive first-run guide. It is only a visual rehearsal and does not change your computer.
Run this command as your normal user:
curl -fsSL https://modelflare.dev/install/codex.sh | shWhen you are already logged in as root on a VPS or container, use:
curl -fsSL https://modelflare.dev/install/codex.sh | MODELFLARE_ALLOW_ROOT=1 shDo not add sudo on a normal personal computer. The script installs or updates Codex, backs up existing files, asks for your Modelflare API key, and writes the provider configuration under ~/.codex.
Open PowerShell as your normal Windows user and run:
irm https://modelflare.dev/install/codex.ps1 | iexThe installer asks for a language and your Modelflare API key, verifies access to gpt-5.6-sol, and backs up existing files before changing them. When it finishes, continue to Verify the connection.
Option B: create each Codex file yourself
Section titled “Option B: create each Codex file yourself”Use this option when you do not want to run the Modelflare setup script. Follow the steps in order and use the command block for your operating system in every step.
Option B creates two files under your user-level .codex directory: config.toml and auth.json.
Step 1: install Codex CLI
Section titled “Step 1: install Codex CLI”irm https://chatgpt.com/codex/install.ps1 | iexcodex --versioncurl -fsSL https://chatgpt.com/codex/install.sh | shcodex --versioncurl -fsSL https://chatgpt.com/codex/install.sh | shcodex --versionStep 2: create and enter the .codex directory
Section titled “Step 2: create and enter the .codex directory”New-Item -ItemType Directory -Force "$HOME\.codex" | Out-NullSet-Location "$HOME\.codex"mkdir -p ~/.codexcd ~/.codexmkdir -p ~/.codexcd ~/.codexStep 3: create config.toml
Section titled “Step 3: create config.toml”$config = @'cli_auth_credentials_store = "file"model_provider = "modelflare"model = "gpt-5.6-sol"model_reasoning_effort = "xhigh"disable_response_storage = truemodel_supports_reasoning_summaries = true
[model_providers.modelflare]name = "Modelflare"base_url = "https://modelflare.dev/v1"wire_api = "responses"requires_openai_auth = true'@$utf8NoBom = New-Object System.Text.UTF8Encoding -ArgumentList $false[System.IO.File]::WriteAllText( (Join-Path (Get-Location) "config.toml"), $config, $utf8NoBom)cat > config.toml << 'EOF'cli_auth_credentials_store = "file"model_provider = "modelflare"model = "gpt-5.6-sol"model_reasoning_effort = "xhigh"disable_response_storage = truemodel_supports_reasoning_summaries = true
[model_providers.modelflare]name = "Modelflare"base_url = "https://modelflare.dev/v1"wire_api = "responses"requires_openai_auth = trueEOFchmod 600 config.tomlcat > config.toml << 'EOF'cli_auth_credentials_store = "file"model_provider = "modelflare"model = "gpt-5.6-sol"model_reasoning_effort = "xhigh"disable_response_storage = truemodel_supports_reasoning_summaries = true
[model_providers.modelflare]name = "Modelflare"base_url = "https://modelflare.dev/v1"wire_api = "responses"requires_openai_auth = trueEOFchmod 600 config.tomlStep 4: create auth.json
Section titled “Step 4: create auth.json”Replace YOUR_MODELFLARE_API_KEY in the JSON object with the complete API key you created in the Modelflare console. This file must remain valid JSON and use the OPENAI_API_KEY field; do not add a provider auth command block. Current Codex releases require requires_openai_auth = true for this API-key path.
$authJson = @'{ "auth_mode": "apikey", "OPENAI_API_KEY": "YOUR_MODELFLARE_API_KEY"}'@$utf8NoBom = New-Object System.Text.UTF8Encoding -ArgumentList $false[System.IO.File]::WriteAllText( (Join-Path (Get-Location) "auth.json"), $authJson, $utf8NoBom)cat > auth.json << 'EOF'{ "auth_mode": "apikey", "OPENAI_API_KEY": "YOUR_MODELFLARE_API_KEY"}EOFchmod 600 auth.jsoncat > auth.json << 'EOF'{ "auth_mode": "apikey", "OPENAI_API_KEY": "YOUR_MODELFLARE_API_KEY"}EOFchmod 600 auth.jsonStep 5: start Codex
Section titled “Step 5: start Codex”Set-Location $HOMENew-Item -ItemType Directory -Force "my-codex-project" | Out-NullSet-Location "my-codex-project"codex --model gpt-5.6-solcd ~mkdir -p my-codex-projectcd my-codex-projectcodex --model gpt-5.6-solcd ~mkdir -p my-codex-projectcd my-codex-projectcodex --model gpt-5.6-sol3. Verify the connection
Section titled “3. Verify the connection”If you used the installer, fully close any Codex CLI, IDE, or desktop session that was already open. Open a new terminal, enter a project directory, and run:
codex --model gpt-5.6-solAfter finishing setup, you can also download the Codex App.
Then ask Codex:
Reply with one sentence confirming the active model and provider.A normal response means setup is complete.
Common problems
Section titled “Common problems”| Symptom | What to do |
|---|---|
401 |
Recopy the API key and confirm that it has not been deleted or disabled. |
model_not_found |
Edit the API key and choose a group that can access gpt-5.6-sol. |
| ChatGPT login appears | Fully quit every Codex session and reopen the CLI. |
codex is not found |
Open a new terminal. On Windows, try codex.cmd. |