Codex CLI with a Custom Base URL and Live Replies
§1 Codex CLI, custom endpoints, and live output
Codex CLI brings an AI coding assistant into your terminal. You can ask it to explain a project, investigate an error, or help change files. With streaming, its visible response appears progressively instead of arriving as one finished block. That makes longer tasks easier to follow, although tool execution can still create pauses.
A custom base URL points Codex at an API provider other than its default service. Fluxio fits this setup as a streaming-first, pay-per-token AI API relay with one key for multiple model families. However, endpoint compatibility matters more than the phrase OpenAI-compatible: Codex needs the API interface its configured provider expects.
§2 Install Codex CLI and choose a trusted folder
Install a current Node.js LTS release, then run npm install -g @openai/codex in your terminal. Check the installation with codex --version. If installation fails, resolve the Node.js or package-manager issue before troubleshooting API settings.
Open a small project you trust before launching Codex. A coding assistant may inspect files, propose edits, and request permission to execute commands. Keep approval protections enabled while learning, and avoid exposing credentials or unrelated private files in your first test.
§3 Store the Fluxio key outside your configuration file
Create your Fluxio API key in your account, then supply it through an environment variable named FLUXIO_API_KEY. This keeps the secret out of the Codex configuration and makes accidental sharing less likely.
In Bash, run read -rs FLUXIO_API_KEY, paste the key, and press Enter. Then run export FLUXIO_API_KEY. The first command accepts the secret without displaying it or placing the literal key in your command history. These settings last only for the current shell session.
For persistent storage, use your operating system's credential tools or a carefully protected local setup. Never commit a real API key to a repository.
§4 Configure the Fluxio base URL in config.toml
Codex normally reads its user configuration from ~/.codex/config.toml. Create the directory and file if needed. The following entries form a basic custom-provider configuration; place each entry on its own line in the order shown, without the list bullets.
- – model_provider = "fluxio"
- – model = "YOUR_MODEL_ID"
- – [model_providers.fluxio]
- – name = "Fluxio"
- – base_url = "https://api.fluxioapi.com/v1"
- – env_key = "FLUXIO_API_KEY"
- – wire_api = "responses"
Replace YOUR_MODEL_ID with the exact API identifier supplied by Fluxio for a model that supports this workflow. A display name such as GPT-6 Astra is not necessarily its API identifier. Confirm availability, Responses API support, and coding-tool compatibility before choosing it.
Fluxio's API host is https://api.fluxioapi.com; OpenAI-style clients use the /v1 base path. Do not append /responses to the base URL yourself. Codex constructs the endpoint path.
§5 Check Responses API support before testing streams
The wire_api = "responses" setting tells Codex which API protocol to use. A relay that supports streaming chat completions does not automatically support the Responses API or the tool events Codex needs. Confirm that Fluxio supports these features for your selected model and account.
Launch codex from the same shell where you exported the key. Start with a read-only request, such as asking for a brief explanation of the project structure without changing files. A successful session should show progressive assistant output as the model produces it.
§6 Recognize SSE streams and common connection errors
Streaming commonly uses server-sent events, or SSE, to deliver incremental events over an HTTP connection. Those events can contain text fragments, status information, or tool activity. A visible update is not necessarily one token, and silence during a tool operation does not necessarily mean streaming failed.
- – An authentication error usually calls for checking the exported key and account access.
- – A missing-endpoint error calls for checking the base path and Responses API availability.
- – A model error calls for checking the exact identifier and supported capabilities.
- – Output arriving all at once can indicate buffering in a proxy, network gateway, or provider.
Sign up for Fluxio to try live replies.