Codex cannot use third-party API keys
Resolved 💬 4 comments Opened Dec 17, 2025 by jiehai4 Closed Dec 20, 2025
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
0.48.9
What subscription do you have?
No OpenAI service
Which model were you using?
gpt5.1
What platform is your computer?
Microsoft Windows NT 10.0.22000.0 x64
What issue are you seeing?
- In Codex, I chose to provide my own API key instead of logging in with an OpenAI account. 2. I have configured config.toml, including the baseurl, model_providers, etc., as well as auth.json. I can confirm that I still have a balance with the third-party provider and that Claude Code can be paid normally. However, when I interact with Codex, it still shows 'Quota exceeded. Check your plan and billing details.'In fact, I feel that Codex didn't read the config.toml file. The GPT model I set there is not consistent with what the Codex interface shows. It's my first time using Codex, so I don't know if this situation is normal.
What steps can reproduce the bug?
。。
What is the expected behavior?
_No response_
Additional information
_No response_
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
This sounds like it's a config problem. Can you provide more details about your config.toml file (obviously omitting the actual API key)?
I'm glad you replied.
config-toml:
model = "gpt-5.1"
model_provider = "xxx"
model_reasoning_effort = "high"
disable_response_storage = true
[model_providers.xxx]
name = "xxx"
env_key = "CODEX_API_KEY"
wire_api = "responses"
base_url = "https://xxx/v1"
auth.json:
{
"CODEX_API_KEY": "xxx"
}
I also configured CODEX_API_KEY and its value in the environment variables.
result:Quota exceeded. Check your plan and billing details.
The
auth.jsonfile is specifically used for OpenAI auth method, but you're using the env-based auth method. That means you need to define an environment variable namedCODEX_API_KEY.The error you're seeing indicates that your API key is being recognized, but you have no credits available. You'll need to go into your account and purchase more credits.