Speech to Text
Realtime Client Secrets API
A short-lived secret a browser opens the realtime WebSocket with, so your API key stays on your server.
POST
Create a realtime client secret
A browser cannot put an
Authorization header on a WebSocket, and anything a page sends, its visitors can read. So your server makes a client secret with its API key and hands it to the page, and the page connects straight to wss://api.morphllm.com/v1/realtime with it. Audio never passes through your server.
This is OpenAI’s POST /v1/realtime/client_secrets, for transcription sessions: the same request, the same response, and the same browser connection. Sessions take audio/pcm input (24 kHz, or 16 kHz as an extension) with server_vad or manual turns; audio/pcmu, audio/pcma and semantic_vad are refused, and noise_reduction and include have no effect. See Connect from a browser for the page side.
- The secret opens new sessions until
expires_at(10 seconds to 2 hours, default 10 minutes). It is not single use, and a session already open keeps running after it expires. - A
sessiongiven here is where every connection on the secret starts. The URL’smodelandchunk_ms, andsession.updateevents, change it as usual. - Sessions on the secret are authenticated, rate limited and billed as the API key that made it. Making a secret is free.
- A client secret cannot make another one, and it works only on the realtime WebSocket.
Authorizations
Morph API key, passed as Authorization: Bearer sk-.... Create keys at https://www.morphllm.com/dashboard/api-keys.
Body
application/json
How long the secret lasts and the session it opens. Both optional.
Response
The secret, when it expires, and the session it opens.
A client secret, when it expires, and the session it opens.