Connect Codex
Use Codex with AlpRouter
If we replace the address that Codex uses with AlpRouter’s address, then we can use AlpRouter’s credit to pay for Codex.
Adding suppliers to the configuration file
Please enter the following content into ~/.codex/config.toml.
model = "openai/gpt-6.2-sol"
model_provider = "alprouter"
[model_providers.alprouter]
name = "AlpRouter"
base_url = "https://alprouter.com/api/v1"
env_key = "ALPROUTER_API_KEY"
wire_api = "responses"Set the API key as an environment variable.
export ALPROUTER_API_KEY="alp-your-key"
codexModels that can be used
| Models | In the Codex |
|---|---|
| openai/gpt-6.2-sol, openai/gpt-6.1-sol, openai/gpt-6-luna, openai/gpt-5.4-mini, openai/gpt-5.4-nano, openai/gpt-5.2, openai/gpt-5.1, openai/gpt-5, openai/gpt-5-mini, openai/gpt-5-nano, openai/gpt-4.1, openai/gpt-4.1-mini, openai/gpt-4.1-nano, openai/gpt-4o, openai/gpt-chat-latest, openai/gpt-5.3-codex, openai/gpt-5.2-codex, openai/gpt-5.1-codex-max, openai/gpt-5.1-codex, openai/gpt-5.1-codex-mini, openai/gpt-5-codex, openai/gpt-5.4-pro, openai/gpt-5-pro | Okay. I’ll keep the request unchanged. All the tools in Codex will remain the same. |
| Claude model (e.g., anthropic/claude-haiku-5.5) | Okay. The Codex will be replaced by a function tool. |
| Other GPT models | It’s not yet ready. The Codex isn’t able to switch to the new format of tools that are used in these models. |
Things to know:
- Tools like creating and reading files, as well as executing commands, remain unchanged in Codex.
- It’s not possible to use this tool without including web search functionality in it.
- If the conversation exceeds 400KB, an
input_too_longerror will occur. Please reduce the size of the conversation to/compactbefore that. - If you create a password for the Codex and set limits on it, you can see the amount of money that has been spent separately.
- For more detailed information on how it’s processed, please refer to Responses API.
This connection was confirmed in Codex CLI 0.171 for both file writing and reading operations.