Create realtime client token
curl --request POST \
--url https://api.aircaps.com/v1/realtime/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_in": 60
}
'import requests
url = "https://api.aircaps.com/v1/realtime/token"
payload = { "expires_in": 60 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expires_in: 60})
};
fetch('https://api.aircaps.com/v1/realtime/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"object": "realtime_token",
"token": "aircaps_rt_...",
"expires_at": "2026-11-24T23:01:00Z",
"expires_in": 60
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "Input should be greater than or equal to 60",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "invalid API key",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}{
"error": {
"type": "permission_error",
"code": "api_key_required",
"message": "an API key is required to create realtime client tokens",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "internal error",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}{
"error": {
"type": "api_error",
"code": "client_tokens_unavailable",
"message": "realtime client tokens are not available",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}Realtime
Create realtime client token
Create a short-lived token on your backend using your API key, then give it to your browser to open the /v1/realtime WebSocket with ?token=.... Do not expose your API key in browser code. Tokens inherit the parent key’s account, model access, billing and session limits; they are not model-specific or single-use. They cannot call REST endpoints, including this endpoint or endpoint lookup. Expiry prevents new connections but does not close an already-authenticated stream. See Client-side streaming for examples and supported gateway addresses.
POST
/
v1
/
realtime
/
token
Create realtime client token
curl --request POST \
--url https://api.aircaps.com/v1/realtime/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_in": 60
}
'import requests
url = "https://api.aircaps.com/v1/realtime/token"
payload = { "expires_in": 60 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expires_in: 60})
};
fetch('https://api.aircaps.com/v1/realtime/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"object": "realtime_token",
"token": "aircaps_rt_...",
"expires_at": "2026-11-24T23:01:00Z",
"expires_in": 60
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "Input should be greater than or equal to 60",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "invalid API key",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}{
"error": {
"type": "permission_error",
"code": "api_key_required",
"message": "an API key is required to create realtime client tokens",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "internal error",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}{
"error": {
"type": "api_error",
"code": "client_tokens_unavailable",
"message": "realtime client tokens are not available",
"param": null,
"request_id": "req_01k6z3m4q8w7e5r2t1y0u9i8o7"
}
}See Client-side streaming with client tokens for the complete server-to-browser flow and supported WebSocket addresses.
Body
application/json
Optional. Omit the body or expires_in to use the 3,600-second default.
Response
Token created.

