What should I do if my API Key is invalid?
An invalid API Key is usually caused by an incorrect Key, an incorrectly formatted authentication header, a deleted, disabled, or expired Token, an exhausted quota, or the client not actually using the Key you entered.
Quick Checks
- Is the request header
Authorization: Bearer sk-...? - Is there a space between
Bearerand the Key? - Was the Key copied completely, without extra spaces, line breaks, or Chinese punctuation?
- Does the Token still exist, remain enabled, have not expired, and remain within its quota?
- Is the client caching an old Key? Did you restart or reload it after saving?
- Did you mix up the login Access Token, panel PAT, and model API Token?
How to Resolve It
First, use cURL to test the same Key. If cURL also returns 401, return to the console and create a new Token. If cURL succeeds but the client fails, check the client fields, proxy, and configuration cache.
