Skip to content
FluxCDNFluxCDN
esc
On this page

DocsTools guide

Codex with FluxCDN AI

Codex (the terminal program and the editor extension) reads code, runs commands and makes changes. A new “provider” in its config.toml connects it to FluxCDN, and then it works with any model in our catalog.

Licence:
Apache-2.0, open source
Platforms:
macOS, Linux, Windows
Address (OpenAI Responses):
https://ai.fluxcdn.cloud/api/v1
The tool's own docs ↗

Before you start

  • Create an API key. On the API keys page press “Create key” and copy the key right away. It starts with flux_live_ and is never shown in full again.
  • Codex installed, and up to date if you installed it earlier.
  • Give agents a key of their own and set a daily or monthly spending limit on it with “Limits”. Agents send request after request by themselves; the limit stops spending you didn't expect.
  • Have some credit in the account (Billing).
  • In the examples, put your own key where it says flux_live_YOUR_KEY.

Set it up

  1. Step 1: Put the key in an environment variable

    Codex reads the key from the variable named in env_key. We call it FLUXCDN_API_KEY.

    ~/.zshrc · ~/.bashrc
    export FLUXCDN_API_KEY="flux_live_YOUR_KEY"

    Then open a new terminal (on Windows, close PowerShell and open it again).

  2. Step 2: Pick a model setup and write config.toml

    If you already have the file, add these lines to it. The top lines must come before any […] section. model_context_window is only there for models that aren't OpenAI's. If you set CODEX_HOME, the file lives in that folder.

    Pick a setup; the settings below change with it. Any id from the models page works in their place too.

    Price per million tokens. Free plan prices, in Toman at today's rate. Routers (router/auto and the like) are not recommended for agents: an agent needs a model that is sure to support tools.

    ~/.codex/config.toml · Windows: %USERPROFILE%\.codex\config.toml
    model = "openai/gpt-5.5"
    model_provider = "fluxcdn"
    web_search = "disabled"
    # model_reasoning_effort = "medium"
    
    [model_providers.fluxcdn]
    name = "FluxCDN"
    base_url = "https://ai.fluxcdn.cloud/api/v1"
    env_key = "FLUXCDN_API_KEY"
    wire_api = "responses"
  3. Step 3: Start Codex

    Run codex in your project folder. To use another model once, give its id when you start; the /model menu only lists models Codex itself knows.

    Terminal
    codex
    
    # another model, just this time
    codex -m deepseek/deepseek-v4-pro
    codex -c model="z-ai/glm-5.3"
    
    # one task without the interactive screen
    codex exec "Summarise the README"

    codex exec runs one task without the interactive screen (in a script, for example). Set its command approvals as Codex's own docs describe; don't use the options that bypass every approval.

  4. Step 4: Several setups side by side: profiles

    Make one file per setup, such as ~/.codex/deepseek.config.toml with the content above and another model, and start Codex with codex --profile deepseek. [profiles.x] tables inside the main file are no longer read.

  5. Step 5: In the editor

    The Codex extension reads the same ~/.codex/config.toml. The editor must see FLUXCDN_API_KEY too: on macOS and Linux open it from a terminal that has the variable (for example code .); on Windows setx is enough, just close and reopen the editor once.

What each setting does

model
The model Codex works with; any id from the models page.
model_provider= fluxcdn
Points Codex at the [model_providers.fluxcdn] section.
base_url= https://ai.fluxcdn.cloud/api/v1
The FluxCDN address, with /v1. Codex adds /responses itself.
env_key= FLUXCDN_API_KEY
The name of the variable holding the key; the key itself doesn't go here.
wire_api= responses
Codex only uses the Responses API with another provider; chat is no longer accepted.
name= FluxCDN
The name Codex shows in /status and its messages.
model_context_window
Optional: the model's context size, for models Codex doesn't know. The setups above fill it in from our catalog.
model_reasoning_effort
Optional: how hard to think (low, medium, high), for models that reason before answering.
web_search= disabled
Codex's built-in web search runs on OpenAI's servers and isn't available this way. Turn it off.

Check it works

  1. Step 1: Look at the status

    Type /status in Codex. It should show your model and the provider “FluxCDN”.

  2. Step 2: Give it a small task

    For example, “Summarise the README”. You'll see the request, its model and its cost under Activity in the console.

Troubleshooting

“unexpected status 401 Unauthorized: This API key is not valid.”, or Codex can't find the key
The key is wrong, or the variable isn't set in that terminal. Check its start without showing the whole key: echo ${FLUXCDN_API_KEY:0:10} (in PowerShell: $env:FLUXCDN_API_KEY.Substring(0,10)). It should print flux_live_.
Codex complains about wire_api
It must be "responses". "chat" was removed from recent versions of Codex.
The provider doesn't change
The [model_providers.fluxcdn] section must be in the home file ~/.codex/config.toml. A project's .codex/config.toml ignores providers.
“No model named ….”
The model id isn't in FluxCDN or is misspelled. Copy it exactly from the models page, with the maker's prefix: openai/gpt-5.5, not gpt-5.5.
“Model metadata for … not found. Defaulting to fallback metadata”
Harmless; the work goes on. Codex runs models it doesn't know with general settings and edits files through its shell. openai/gpt-5.5 also gets Codex's own patch tool. model_context_window tells Codex the real size.
/model doesn't list FluxCDN's models
That's expected. Set the model in config.toml or give it at start: codex -m qwen/qwen3-coder.
“Quota exceeded. Check your plan and billing details.”
These are Codex's own words; they mean your FluxCDN credit isn't enough for this request. Before each request, the most it could cost is set aside, then only the real cost is taken. Add credit or pick a cheaper model. Codex stops on this error instead of retrying.
Error 429: rate_limit_exceeded or budget_exceeded
Either requests per minute went over the limit (wait a little; most tools retry by themselves), or this key's spending today or this month reached its limit. See it on API keys under “Limits”.
Error 502, 503, 504 or 529
The model's service was briefly unavailable. Send again; most tools do it themselves. A request that fails before answering costs nothing. If it lasts, switch to another model for a while.

Limits

  • Codex's built-in web search (web_search) runs on OpenAI's servers and isn't available this way.
  • FluxCDN doesn't store the conversation; Codex sends the whole conversation each time, as it does with any other provider.

What doesn't work this way →