Skip to main content
Never ship an API key to a browser or a device. Your server mints a short-lived, single-use token with an API key that has the tts scope, and hands only the token over.

Mint a token on your server

Use it

In a browser, the TypeScript client runs without dangerouslyAllowBrowser when it holds a token.

How tokens behave

  • A token carries the tts scope only.
  • It works for one speech.create / speech.stream call, or one realtime session.
  • It dies when the key that minted it is revoked or expires.
  • A request refused before it runs (a 429 rate limit, a plan check) keeps its token, so you can retry with it.
The HTTP endpoint is Create an access token.