401 Unauthorized from v0.dev API when using Codex CLI (`--provider vercel`)
Resolved 💬 3 comments Opened Jun 15, 2025 by loaishar Closed Aug 7, 2025
What version of Codex is running?
v0.1.2505172129
Which model were you using?
Codex
What platform is your computer?
_No response_
What steps can reproduce the bug?
401 Unauthorized from v0.dev API when using Codex CLI (--provider vercel)
Account / Plan
- v0.dev account email: loai1@…
- Plan: <Premium / Team> ← (confirm what Billing shows)
- API key last 4 chars:
...eT3(beginsv1:)
---
| Config path | /home/<user>/.codex/config.json (see contents below) |
~/.codex/config.json
{
"providers": {
"vercel": {
"name": "Vercel",
"baseURL": "https://api.v0.dev/v1",
"envKey": "V0_API_KEY"
}
}
}
````
**Session Reproduction**
```bash
export V0_API_KEY="v1:2n................................................3"
codex --provider vercel --model v0-1.0-md --verbose
CLI output
● OpenAI Codex (research preview) v0.1.2505172129
...
POST https://api.v0.dev/v1/chat/completions
→ 401 Unauthorized
⚠️ OpenAI rejected the request. Status: 401, Message: "Unauthorized"
Direct cURL test
curl -s -o /dev/null -w "%{http_code}\n" \
-H "Authorization: Bearer $V0_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"v0-1.5-md","messages":[{"role":"user","content":"ping"}]}' \
https://api.v0.dev/v1/chat/completions
# ⇒ 401
---
What I’ve tried
- Regenerated API key twice and re-exported it.
- Confirmed key length (53 chars incl.
v1:prefix). - Ensured
OPENAI_API_KEYis unset to avoid provider mix-up. - Placed config file inside WSL
$HOME(not Windows path). - Tested both
v0-1.0-mdandv0-1.5-mdmodels. - Verified billing page shows active usage-based billing.
Still receive 401 for every request.
---
Expected200 OK and a valid chat completion.
Actual401 Unauthorized with message "Unauthorized".
Please advise on any missing configuration or backend-side flag that needs to be enabled.
Happy to provide extra logs or run further diagnostics.
Thanks a lot!
What is the expected behavior?
_No response_
What do you see instead?
_No response_
Additional information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗