x-api-key: pyai_live_... is an accepted alias for environments where setting an
Authorization header is awkward.
Environments
Create either in the console. The key is shown once, store it as a secret (environment variable), never in source control.
Scopes
Keys carry scopes that gate which products they can call:GET /v1/models and GET /v1/voices are catalog reads, any active key may call
them. A request whose key lacks the required scope returns 403 forbidden.
WebSocket authentication
Browsers can’t set headers on a WebSocket upgrade, so pass the key as a subprotocol:?api_key=... to the URL. Never put the
key in any other query parameter.
Rotation & revocation
Each key in the console has rotate and revoke controls.- Rotate issues a new secret and invalidates the old one.
- Revoke disables the key everywhere within 60 seconds.
401 unauthorized.