A Codex CLI session through a custom endpoint
Codex CLI is a coding assistant that runs in your terminal. You start it inside a project, give it a task, and review the changes it proposes. Its connection settings determine which service receives those requests. A custom base URL lets you direct that connection to another provider.
Vana API offers one endpoint at https://api.vanaapi.com for several model families, with billing per real token and no monthly fee. Connecting Codex requires an API key, a model identifier, and a provider configuration. There is also one compatibility detail to check before starting.
§ Check the API that Codex needs
OpenAI compatibility can describe several different interfaces. Codex uses the Responses API, which supports the conversation and tool interactions a coding agent needs. An endpoint that accepts ordinary Chat Completions requests does not automatically support a full Codex session.
For this setup, confirm that Vana API supports Responses requests for your chosen model. Vana API also speaks Anthropic Messages and Gemini native protocols, but those interfaces are separate from the connection described here. Changing the base URL does not translate between them.
§ Prepare your key and model identifier
Create a Vana API account, generate an API key, and check the available balance before your first session. Keep the key outside your project files so it cannot accidentally enter version control.
Choose a model available through the service, such as GPT-6 Astra, and copy its exact API identifier from the model listing. A readable model name and its request identifier may differ. The identifier is what belongs in your Codex configuration.
On macOS or Linux, set a temporary environment variable in the terminal where you will run Codex:
1 export VANA_API_KEY='YOUR_API_KEY'
Replace YOUR_API_KEY with your actual key. This setting lasts for the current shell session. Avoid pasting the command into shared logs or screenshots, and remember that your shell may save it in command history.
§ Add a custom provider
Codex reads user configuration from ~/.codex/config.toml. Open that file in a text editor, creating it if necessary. If it already contains settings, edit the existing entries rather than adding duplicate keys.
The following example uses the standard OpenAI-compatible /v1 prefix. Confirm the complete base URL against Vana API’s current connection instructions. Replace MODEL_ID with the identifier you copied.
Place these two settings near the top of the file, before any bracketed section headings, with each setting on its own line:
1 model = "MODEL_ID" 2 model_provider = "vana"
Then add this provider section. Again, put each line in its own line in the file:
1 [model_providers.vana] 2 name = "Vana API" 3 base_url = "https://api.vanaapi.com/v1" 4 env_key = "VANA_API_KEY" 5 wire_api = "responses"
The provider name connects your top-level selection to the settings below it. The env_key setting tells Codex where to find your key. The wire_api setting selects the Responses protocol; it cannot add Responses support to an endpoint that lacks it.
§ Start with a small request
Open a terminal inside a project you trust and run codex. For the first prompt, ask it to explain the project structure without changing files. This gives you a simple way to check authentication, model access, and basic responses before requesting edits.
Next, try a small change that requires reading a file and proposing an edit. A successful text response alone does not verify the tool interactions needed for coding work. Keep Codex’s approval controls enabled and review changes before accepting them.
§ Read failures as connection clues
- Authentication error: Check that the key is valid and the environment variable exists in the same terminal session.
- Model unavailable: Check the exact API identifier and whether your account can access it.
- Route or protocol error: Check the /v1 prefix and Responses API support for the selected route.
- Tool interaction failure: Check the model’s support for Codex’s tool calls and streaming behavior.
Once a small session works, check its usage in Vana API. A coding task can involve several model requests, so its token consumption may be larger than the final answer suggests.