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
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
Step 1: Put the key in an environment variable
Codex reads the key from the variable named in
env_key. We call itFLUXCDN_API_KEY.~/.zshrc · ~/.bashrcexport FLUXCDN_API_KEY="flux_live_YOUR_KEY"Then open a new terminal (on Windows, close PowerShell and open it again).
Step 2: Pick a model setup and write
config.tomlIf you already have the file, add these lines to it. The top lines must come before any
[…]section.model_context_windowis only there for models that aren't OpenAI's. If you setCODEX_HOME, the file lives in that folder.Price per million tokens. Free plan prices, in Toman at today's rate. Routers (
router/autoand 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.tomlmodel = "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"Step 3: Start Codex
Run
codexin your project folder. To use another model once, give its id when you start; the/modelmenu only lists models Codex itself knows.Terminalcodex # 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 execruns 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.Step 4: Several setups side by side: profiles
Make one file per setup, such as
~/.codex/deepseek.config.tomlwith the content above and another model, and start Codex withcodex --profile deepseek.[profiles.x]tables inside the main file are no longer read.Step 5: In the editor
The Codex extension reads the same
~/.codex/config.toml. The editor must seeFLUXCDN_API_KEYtoo: on macOS and Linux open it from a terminal that has the variable (for examplecode .); on Windowssetxis 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/responsesitself. 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;
chatis no longer accepted. name= FluxCDN- The name Codex shows in
/statusand 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
Step 1: Look at the status
Type
/statusin Codex. It should show your model and the provider “FluxCDN”.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 printflux_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.tomlignores 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, notgpt-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.5also gets Codex's own patch tool.model_context_windowtells Codex the real size. /modeldoesn't list FluxCDN's models- That's expected. Set the model in
config.tomlor 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_exceededorbudget_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.

