Docs Authentication
How keys are created, what they carry, and every way a request is refused before it reaches the GPU.
Keys
A key looks like this:
nxs_tts_k4p9wq2m8xrk3zt7vnh5cab1de6fu0gy
- Prefix
nxs_tts_identifies the service in logs and secret scanners. - 32 characters follow, drawn from an unambiguous alphabet.
- The console shows the first 13 characters as the key's public identifier.
- Only
SHA-256(key)is stored. Nothing can reverse it; a lost key is rotated.
Sending it
Either header works. Bearer is the documented one:
Authorization: Bearer nxs_tts_…
x-api-key: nxs_tts_…
Both are accepted on every /v1 route except /v1/health, which needs no key. Do not put the key in a
query string: query strings land in proxies, access logs and browser history.
What a key carries
| attribute | meaning |
|---|---|
| Name | A label for the consumer. Only for humans and the ledger. |
| Rate | Requests per rolling 60 seconds. Default 30. |
| Budget | Input characters per calendar month, UTC. Default 200,000. |
| Status | active or revoked. Revocation is immediate. |
| Owner | The GitHub account that minted it. |
There are no scopes. A key may call /v1/audio/speech, /v1/voices, /v1/usage and nothing else. It
cannot mint keys, read another key's usage, or reach the console.
The checks, in order
- Key present and known → otherwise
401 invalid_key. - Key not revoked → otherwise
401 revoked_key. - Rate under the limit → otherwise
429 rate_limitedwithRetry-After: 60. - Budget covers the input → otherwise
429 quota_exceeded. - Input within the size cap → otherwise
400 input_too_long. - Worker reachable → otherwise
503 worker_unreachable.
Rejected requests are still recorded, with zero characters, so the rate window is honest. The characters of a request that fails at the worker are not charged: the ledger counts a request only when the audio path starts.
Rotate and revoke
Rotate mints a replacement with identical limits, shows it once, and revokes the old key in the same transaction. Use it when a key might have leaked into a log or a repository.
Revoke stops the key immediately and leaves its history in place. The next call answers
401 revoked_key. Nothing is deleted, so last month's numbers still add up.
Both actions live on the key page in the console.
Sessions
The console is a separate credential from the API. Sign-in uses GitHub OAuth and stores a signed session
cookie (HttpOnly, Secure, SameSite=Lax, 30 days). Signing out deletes the session row; a stolen
cookie stops working at that moment.
The console refuses a sign-in when the GitHub account is not a member of Nexis-ai-tech. The one exception is the very first account, which bootstraps as owner so the gateway can be set up.
Common mistakes
| mistake | symptom |
|---|---|
Bearer missing the space |
401 invalid_key |
| Key copied with a trailing newline | 401 invalid_key |
| Using the console session cookie as a key | 401 invalid_key — the two are not interchangeable |
Sending the key as ?api_key= |
401 invalid_key; query keys are not read |
| Rotating while a client still holds the old value | 401 revoked_key |