Skip to content
Open CastalyConsole

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.

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.

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:

Terminal windowbash
curl -fsSL https://modelflare.dev/install/codex.sh | sh

When you are already logged in as root on a VPS or container, use:

Terminal windowbash
curl -fsSL https://modelflare.dev/install/codex.sh | MODELFLARE_ALLOW_ROOT=1 sh

Do 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.

The 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.

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.

Terminal windowPowerShell
irm https://chatgpt.com/codex/install.ps1 | iex
codex --version

Step 2: create and enter the .codex directory

Section titled “Step 2: create and enter the .codex directory”
Terminal windowPowerShell
New-Item -ItemType Directory -Force "$HOME\.codex" | Out-Null
Set-Location "$HOME\.codex"
Terminal windowPowerShell
$config = @'
cli_auth_credentials_store = "file"
model_provider = "modelflare"
model = "gpt-5.6-sol"
model_reasoning_effort = "xhigh"
disable_response_storage = true
model_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
)

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.

Terminal windowPowerShell
$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
)
Terminal windowPowerShell
Set-Location $HOME
New-Item -ItemType Directory -Force "my-codex-project" | Out-Null
Set-Location "my-codex-project"
codex --model gpt-5.6-sol

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:

Terminal windowbash
codex --model gpt-5.6-sol

After finishing setup, you can also download the Codex App.

Then ask Codex:

Text
Reply with one sentence confirming the active model and provider.

A normal response means setup is complete.

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.