Create a Realtime client secret
Creates credentials for an untrusted client, such as a browser or mobile app, to connect directly to AllModels without receiving your API key.
/v1/realtime/client-secretsCreates credentials for an untrusted client, such as a browser or mobile app, to connect directly to AllModels without receiving your API key.
Authorization
BearerAuth Tenant key supplied as the Authorization Bearer token.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
import { writeFile } from "node:fs/promises";const response = await fetch("https://api.allmodels.io/v1/realtime/client-secrets", { method: "POST", headers: { ...{ Authorization: `Bearer ${process.env.ALLMODELS_API_KEY}` }, "Content-Type": "application/json" }, body: JSON.stringify({ "profile_id": "$REALTIME_PROFILE_ID", "expires_in_seconds": 300})});if (!response.ok) throw new Error(`AllModels request failed: ${response.status}`);console.log(await response.json());import osimport requestspayload = { "profile_id": "$REALTIME_PROFILE_ID", "expires_in_seconds": 300}response = requests.post( "https://api.allmodels.io/v1/realtime/client-secrets", headers={"Authorization": f"Bearer {os.environ['ALLMODELS_API_KEY']}"}, json=payload, timeout=60,)response.raise_for_status()print(response.json())curl -X POST https://api.allmodels.io/v1/realtime/client-secrets \ -H "Authorization: Bearer $ALLMODELS_API_KEY" \ -H "Content-Type: application/json" \ --data '{ "profile_id": "$REALTIME_PROFILE_ID", "expires_in_seconds": 300}'{ "session_id": "string", "profile_id": "string", "client_secret": { "value": "string", "expires_at": 0 }, "url": "string", "property1": null, "property2": null}{ "error": "missing_api_key"}{ "detail": { "message": "this organization has insufficient prepaid balance", "status": "insufficient_balance" }}{ "error": "tenant_disabled"}{ "error": { "type": "string", "code": "string", "message": "string", "property1": null, "property2": null }}{ "error": { "type": "string", "code": "string", "message": "string", "property1": null, "property2": null }}Delete a Realtime profile DELETE
Previous Page
Native streaming TTS (WebSocket) GET
Opens a WebSocket using the selected provider's text-to-speech protocol. The request must include `Upgrade: websocket`. After connecting, send provider-specific JSON messages and receive binary audio. For example, Grok accepts `{"type":"text","text":"..."}` plus optional `{"type":"flush"}` / `{"type":"close"}` frames. Use `provider_options` for provider-specific settings. You can also pass supported options directly as query parameters. If both forms set the same option, `provider_options[<name>]=<value>` takes precedence. Recognized enum and boolean option values are case-insensitive and are normalized to each provider's wire spelling; free-form values such as prompts, keyterms, and voice IDs retain their original case. Authentication failures close the connection with code `4401` or `4403`. The close reason contains `{ "error": "<code>" }`. The message-level protocol is documented at [the realtime WebSocket reference](/realtime-reference) (AsyncAPI spec: [/asyncapi.yaml](/asyncapi.yaml)).
