401 Unauthorized from v0.dev API when using Codex CLI (--provider vercel)
Account / Plan
- v0.dev account email: loai1@…
- Plan: ← (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
export V0_API_KEY="v1:2n................................................3"codex --provider vercel --model v0-1.0-md --verboseCLI 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}" \ -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# ⇒ 401What 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.
Expected
200 OK and a valid chat completion.
Actual
401 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!