Skip to main content

Create Realtime Client Secret

POST 

https://api.knox.chat/v1/realtime/client_secrets

Mint a Knox ephemeral secret for a browser Realtime client. The response is not an OpenAI ek_ key. Use value immediately to open /v1/realtime or /v1/realtime/calls on Knox, not api.openai.com.

TTL is 60 seconds. Secrets live in memory on the Knox process that minted them: a different replica, a restart, or waiting too long invalidates the key.

Request

This endpoint requires a JSON object. An empty body is accepted and uses Knox defaults.

Request Headers

NameTypeRequiredDescription
AuthorizationStringYesBearer authentication in the form Bearer sk-….
Content-TypeStringYesMust be application/json.

Request Body

NameTypeRequiredDescription
sessionObjectNoRealtime session config to attach to the secret. If omitted, Knox applies the default session (type realtime, model gpt-realtime-2.1, audio PCM 24 kHz, voice marin, reasoning.effort low).
session.typeStringNoMust be realtime when set. Knox fills this in if missing.
session.modelStringNogpt-realtime-2.1 or gpt-realtime-2.1-mini. Defaults to gpt-realtime-2.1.
session.audioObjectNoInput/output audio format, VAD, voice.
session.reasoningObjectNoDefaults to { "effort": "low" } when omitted.

You can also pass ?model= on the URL. The same routes are mounted under /api/v1.

cURL Example

curl -s https://api.knox.chat/v1/realtime/client_secrets \
-H "Authorization: Bearer $KNOXCHAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session": {
"type": "realtime",
"model": "gpt-realtime-2.1",
"audio": { "output": { "voice": "marin" } }
}
}'

Response

Success Response (200)

{
"value": "ek_knox_…",
"expires_at": 1750000000,
"session": {
"type": "realtime",
"model": "gpt-realtime-2.1"
}
}

Response Schema

NameTypeDescription
valuestringKnox ephemeral key (ek_knox_…). Send it as Authorization: Bearer ek_knox_… on the next Realtime connect.
expires_atintegerUnix timestamp when the secret expires (~60 seconds from mint).
sessionobjectSession config stored with the secret, including Knox defaults and hosted web_search injection when enabled.

Error Responses

StatusWhen
400Invalid JSON body.
401Missing or invalid Knox API key.
402Account balance is not greater than $0.01.
403The token's model allow-list does not include the requested realtime model (gpt-realtime-2.1 or gpt-realtime-2.1-mini).
502No OpenAI-compatible Realtime channel is available.