API ReferenceRealtime
Create a Realtime client secret
POST
/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 AuthorizationBearer <token>
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 }}