Windows Codex CLI custom provider setup and 404 fixes

To connect Codex CLI on Windows to Elysia API, set your custom provider's base_url to https://api.elysia.earth/v1. Codex appends /responses when it sends a request. If you get a 404, first check for a duplicated /v1 or a full endpoint pasted into the base URL.

Configure a custom provider in PowerShell

Open PowerShell 7.2 or later and run codex --version to check that Codex CLI is installed. Sign in to Elysia, check your balance and key limits, and create an API key for the test. Create an account and an API key

Paste this block into PowerShell. It creates a config.toml in a new temporary directory so you can keep your usual configuration. The key prompt masks your input and puts the key in the ELYSIA_API_KEY environment variable for this run. Codex starts in an empty working directory and sends a short prompt. API usage is billed to your Elysia balance.

& {
    $runDir = Join-Path ([IO.Path]::GetTempPath()) "elysia-codex-$([guid]::NewGuid())"
    $workDir = Join-Path $runDir 'work'
    New-Item -ItemType Directory -Path $runDir, $workDir -ErrorAction Stop | Out-Null

    @'
model = "gpt-6.2-sol"
model_provider = "elysia"
web_search = "disabled"

[model_providers.elysia]
name = "Elysia API"
base_url = "https://api.elysia.earth/v1"
env_key = "ELYSIA_API_KEY"
wire_api = "responses"
supports_websockets = false
'@ | Set-Content -LiteralPath (Join-Path $runDir 'config.toml') -Encoding utf8 -ErrorAction Stop

    $previousCodexHome = $env:CODEX_HOME
    $previousElysiaKey = $env:ELYSIA_API_KEY
    try {
        $env:CODEX_HOME = $runDir
        $env:ELYSIA_API_KEY = (Read-Host 'Elysia API key' -MaskInput).Trim()
        if ([string]::IsNullOrWhiteSpace($env:ELYSIA_API_KEY)) {
            throw 'Enter an Elysia API key.'
        }

        $codexArgs = @(
            'exec', '--strict-config', '--ephemeral'
            '--sandbox', 'read-only'
            '--skip-git-repo-check', '--cd', $workDir
            'Reply with OK.'
        )
        codex @codexArgs
    } finally {
        $env:CODEX_HOME = $previousCodexHome
        $env:ELYSIA_API_KEY = $previousElysiaKey
    }
}

Match the elysia value in model_provider to the name in [model_providers.elysia]. Use the exact model ID shown on the pricing page. This example selects gpt-6.2-sol. Set env_key to the name of the environment variable. wire_api = "responses" selects the Responses API and supports_websockets = false keeps this configuration on HTTP.

For regular use, merge the settings into your existing config.toml. It usually lives at %USERPROFILE%\.codex\config.toml or in the directory set by CODEX_HOME. Update the top-level model and model_provider, and edit the existing [model_providers.elysia] table if it is already present. Before starting Codex, run $env:ELYSIA_API_KEY = Read-Host "Elysia API key" -MaskInput in that PowerShell window.

Troubleshoot 404, 401, and 429 errors

Check token usage and model pricing

Note the time and model ID, then open the matching entry in Usage Logs. Check the input and output tokens and the amount charged. To practice matching a request by ID, use the Python example to send a separate short non-streaming request. Match the value printed from X-Oneapi-Request-Id to the Request ID in that usage entry. Usage Logs · Python example and usage checks

Use the model pricing page to check current input, output, and cache rates for the model and group you use. Models and pricing

What we tested

On Windows with PowerShell 7.6.9 and Codex CLI 0.169.0, we checked that the CLI reads the temporary configuration, accepts a model override, and appends /responses in requests to a local test server. The configuration checks also covered the base URL and whether the key environment variable was set. On the live Elysia API, we matched one short non-streaming request for each of gpt-6.2-sol and gpt-6.2-astra to its usage entry. Streaming and tool calls from Codex CLI to Elysia remain unverified.

OpenAI Codex config reference