OpenAI APIRunbook 0/2 done
invalid_api_key
OpenAI API Error invalid_api_key: Incorrect API key provided
Critical✕ Not retryable · fix the payloadHTTP 401 UnauthorizedAI Provider
TL;DR · 10-second read
The key is wrong, revoked or has stray whitespace. Generate a new key in the right project and check the env var actually loads at runtime.
Identify: does your log match?
What you see · exact log / response
{"error":{"message":"Incorrect API key provided: sk-proj-****Xa9Q. You can find your API key at https://platform.openai.com/account/api-keys.","type":"invalid_request_error","param":null,"code":"invalid_api_key"}}Fix
Being written
Copy-paste fixes for invalid_api_key are in the enrichment queue
The summary above is verified. Paste your full trace into the decoder for a diagnosis now.
Open the decoder →Related errors
Last verified 2026-10-22 · Source: OpenAI error-code guide + SDK exception classes · Official docs ↗ · ~8,100 searches/mo