Skip to main content
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 session given here is where every connection on the secret starts. The URL’s model and chunk_ms, and session.update events, 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

Authorization
string
header
required

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.

Both fields are optional; an empty body makes a 10-minute secret for the default session.

expires_after
object
Example:
session
object

A transcription session in the shape session.update takes. The URL's model and chunk_ms, and later session.update events, change it.

Example:

Response

The secret, when it expires, and the session it opens.

A client secret, when it expires, and the session it opens.

value
string
required

The client secret: ek_ and 32 hex characters. A browser passes it as the WebSocket protocol openai-insecure-api-key.<value> beside realtime. It opens sessions until expires_at; it is not single use.

Example:

"ek_68af296e8e408191a1120ab6383263c2"

expires_at
integer
required

When the secret stops opening sessions, in Unix seconds.

Example:

1796020133

session
object
required

The session a connection on this secret starts with, as session.created reports it.

Example: