Realtime comms
Realtime audio/video rooms, per-participant access tokens, server-side recording and participant management across LiveKit / Agora / Zego.
Overview
https://api.infrai.cc/v1/rtcAuthorization: Bearer $INFRAI_API_KEY# Call any /v1/rtc capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/rtc/... \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json"Methods
rtc.room.create
Create a live audio/video room on the selected RTC vendor. Some vendors (Agora/Zego) have no persistent room object — the room materializes on first join and the record is synthesized.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | Room name (unique per account). |
max_participants | number | Optional | Maximum concurrent participants. |
empty_timeout_s | number | Optional | Auto-close after this many seconds empty. |
metadata | Record<string, unknown> | Optional | Arbitrary key/value metadata. |
enable_recording | boolean | Optional | Enable recording for the room. |
region | string | Optional | Edge region to host the room. |
vendor | string | Optional | Explicit vendor pin. |
idempotency_key | string | Optional | Client-supplied key to make the call idempotent. |
Returns
Room { room, name, max_participants, created_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/rtc/room/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "..."}'import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/rtc/room/create",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'name': '...'},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"name": "..."}),
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"name": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);rtc.room.get
Fetch a single RTC room's state and live occupancy.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
room | string | Required | The room id. |
Returns
RoomExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/rtc/room/get/ROOM \
-H "Authorization: Bearer $INFRAI_API_KEY"import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/rtc/room/get/ROOM",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/get/ROOM",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/get/ROOM",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);rtc.room.list
List active RTC rooms / channels for the account.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | Opaque pagination cursor. |
limit | number | Optional | Maximum number of items to return. |
Returns
{ items: Room[], next_cursor?: string }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/rtc/room/list \
-H "Authorization: Bearer $INFRAI_API_KEY"import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/rtc/room/list",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);rtc.room.delete
Close an RTC room (vendors without a delete API auto-close when empty).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
room | string | Required | The room id. |
Returns
{ ok: boolean }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/rtc/room/delete/ROOM \
-H "Authorization: Bearer $INFRAI_API_KEY"import os, requests
resp = requests.delete(
"https://api.infrai.cc/v1/rtc/room/delete/ROOM",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/delete/ROOM",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/delete/ROOM",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);rtc.token.issue
Mint a per-participant join token (vendor-native JWT/AccessToken2/token04, signed locally). Billed per participant-minute conceptually; bandwidth/egress floored at cost.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
room | string | Required | The room id. |
identity | string | Required | Unique per-participant identity / uid. |
display_name | string | Optional | Human-readable participant name. |
ttl_s | number | Optional | Token time-to-live in seconds. |
can_publish | boolean | Optional | Allow the participant to publish media. |
can_subscribe | boolean | Optional | Allow the participant to subscribe to media. |
can_publish_data | boolean | Optional | Allow the participant to publish data messages. |
is_admin | boolean | Optional | Grant the participant admin privileges. |
vendor | string | Optional | Explicit vendor pin. |
metadata | Record<string, unknown> | Optional | Arbitrary key/value metadata. |
Returns
AccessToken { token, room, identity, expires_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/rtc/token/issue \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"room": "...", "identity": "..."}'import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/rtc/token/issue",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'room': '...', 'identity': '...'},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/rtc/token/issue",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "...", "identity": "..."}),
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/rtc/token/issue",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "...", "identity": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);rtc.recording.start
Start a server-side composite recording of a room (LiveKit Egress); other vendors return an honest unsupported error.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
room | string | Required | The room id. |
layout | string | Optional | Recording composition layout. |
audio_only | boolean | Optional | Record audio only. |
output_uri | string | Optional | Storage destination (s3://, gs://, ...). |
vendor | string | Optional | Explicit vendor pin. |
metadata | Record<string, unknown> | Optional | Arbitrary key/value metadata. |
idempotency_key | string | Optional | Client-supplied key to make the call idempotent. |
Returns
Recording { recording, room, status }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/rtc/recording/start \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"room": "..."}'import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/rtc/recording/start",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'room': '...'},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/rtc/recording/start",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "..."}),
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/rtc/recording/start",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);rtc.recording.stop
Stop an in-progress recording.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
recording | string | Required | The recording id. |
Returns
Recording { recording, status, output_uri? }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/rtc/recording/stop/RECORDING \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/rtc/recording/stop/RECORDING",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/rtc/recording/stop/RECORDING",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/rtc/recording/stop/RECORDING",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);rtc.participant.list
List participants currently in a room.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
room | string | Required | The room id. |
Returns
{ items: Array<{ identity, display_name?, joined_at }> }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/rtc/participant/list/ROOM \
-H "Authorization: Bearer $INFRAI_API_KEY"import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/rtc/participant/list/ROOM",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/rtc/participant/list/ROOM",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/rtc/participant/list/ROOM",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);rtc.participant.kick
Forcibly remove (kick) a participant from a room.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
room | string | Required | The room id. |
identity | string | Required | Unique per-participant identity / uid. |
vendor | string | Optional | Explicit vendor pin. |
Returns
{ ok: boolean }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/rtc/participant/kick/ROOM \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"room": "...", "identity": "..."}'import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/rtc/participant/kick/ROOM",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'room': '...', 'identity': '...'},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/rtc/participant/kick/ROOM",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "...", "identity": "..."}),
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/rtc/participant/kick/ROOM",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "...", "identity": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);Advanced: pin a vendor
By default infrai routes each call to the best available provider — you do not pick a vendor. As an escape hatch, this capability accepts an optional vendor parameter to pin one specific provider. Every live vendor for this capability is available in real time from the discovery endpoint for the capability id — see the discovery API.
GET /v1/discovery/{capability}rtc.room.create
rtc.token.issue
rtc.recording.start
rtc.participant.kick
All capabilities
Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.
| Capability | Endpoint | Description |
|---|---|---|
rtc.participant.kick | POST /v1/rtc/participant/kick/{room} | Forcibly remove (kick) a participant from a room. |
rtc.participant.list | GET /v1/rtc/participant/list/{room} | List participants currently in a room. |
rtc.recording.start | POST /v1/rtc/recording/start | Start a server-side composite recording of a room (LiveKit Egress); other vendors return an honest unsupported error. |
rtc.recording.stop | POST /v1/rtc/recording/stop/{recording} | Stop an in-progress recording. |
rtc.room.create | POST /v1/rtc/room/create | Create a live audio/video room on the selected RTC vendor. Some vendors (Agora/Zego) have no persistent room object — the room materializes on first join and the record is synthesized. |
rtc.room.delete | DELETE /v1/rtc/room/delete/{room} | Close an RTC room (vendors without a delete API auto-close when empty). |
rtc.room.get | GET /v1/rtc/room/get/{room} | Fetch a single RTC room's state and live occupancy. |
rtc.room.list | GET /v1/rtc/room/list | List active RTC rooms / channels for the account. |
rtc.token.issue | POST /v1/rtc/token/issue | Mint a per-participant join token (vendor-native JWT/AccessToken2/token04, signed locally). Billed per participant-minute conceptually; bandwidth/egress floored at cost. |
End-to-end example
A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.
A copy-paste-runnable single-file Python program (stdlib only, no SDK): set your INFRAI_API_KEY, run it, and walk this module's core flow with REAL billed calls — later steps reuse real fields returned by earlier ones. The 12-line helper is the entire integration.
#!/usr/bin/env python3
"""Infrai · rtc — runnable real-app example (single file, zero deps).
Copy this file, set your key, run it: every step is a REAL call to
api.infrai.cc, billed at the real (tiny) per-call price, printing the
live JSON response. Get a key at https://console.infrai.cc (Google/
GitHub sign-in grants $2 free credit). No SDK — the 12-line helper
below is the entire integration."""
import json
import os
from urllib import error, request
KEY = os.environ.get("INFRAI_API_KEY") or "ifr_pk_proj_..." # <- your key
BASE = "https://api.infrai.cc"
# Same raw HTTPS POST/GET as every per-method example on this page —
# wrapped once for reuse. There is nothing else to it: no SDK.
def infrai(method, path, body=None):
req = request.Request(
BASE + path, method=method,
data=json.dumps(body).encode() if body is not None else None,
headers={"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json"})
try:
with request.urlopen(req, timeout=60) as r:
return json.loads(r.read())
except error.HTTPError as e:
return json.loads(e.read())
def show(label, resp):
print(f"\n== {label} ==")
print(json.dumps(resp, indent=2, ensure_ascii=False))
return resp
# 1) rtc.room.create — POST /v1/rtc/room/create · Create a live audio/video room on the selected RTC vendor. Some vendors (Agora/Zego) have no persistent room object — the room materializes on first join and the record is synthesized.
r1 = show("rtc.room.create", infrai("POST", "/v1/rtc/room/create", {"name":"..."}))
# 2) rtc.token.issue — POST /v1/rtc/token/issue · Mint a per-participant join token (vendor-native JWT/AccessToken2/token04, signed locally). Billed per participant-minute conceptually; bandwidth/egress floored at cost.
r2 = show("rtc.token.issue", infrai("POST", "/v1/rtc/token/issue", {"room":"...","identity":"..."}))
# 3) rtc.recording.start — POST /v1/rtc/recording/start · Start a server-side composite recording of a room (LiveKit Egress); other vendors return an honest unsupported error.
r3 = show("rtc.recording.start", infrai("POST", "/v1/rtc/recording/start", {"room":"..."}))
# 4) rtc.room.list — GET /v1/rtc/room/list · List active RTC rooms / channels for the account.
r4 = show("rtc.room.list", infrai("GET", "/v1/rtc/room/list"))
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."# 1) Auth: every call is a raw HTTPS request to the Infrai gateway carrying
# only your project key. No SDK, no install.
# Get your key: sign in with Google/GitHub at the console for a project key
# + $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..." # from the console
# 2) rtc.room.create
curl -X POST https://api.infrai.cc/v1/rtc/room/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "..."}'
# 3) rtc.room.get
curl -X GET https://api.infrai.cc/v1/rtc/room/get/ROOM \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 4) rtc.room.list
curl -X GET https://api.infrai.cc/v1/rtc/room/list \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 5) rtc.room.delete
curl -X DELETE https://api.infrai.cc/v1/rtc/room/delete/ROOM \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 6) rtc.token.issue
curl -X POST https://api.infrai.cc/v1/rtc/token/issue \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"room": "...", "identity": "..."}'
# 7) rtc.recording.start
curl -X POST https://api.infrai.cc/v1/rtc/recording/start \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"room": "..."}'
# 8) rtc.recording.stop
curl -X POST https://api.infrai.cc/v1/rtc/recording/stop/RECORDING \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
# 9) rtc.participant.list
curl -X GET https://api.infrai.cc/v1/rtc/participant/list/ROOM \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 1) Auth: every call is a raw HTTPS request carrying only your project key.
# No SDK to install — just the `requests` library.
import os, requests
BASE = "https://api.infrai.cc"
HEADERS = {
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
"Content-Type": "application/json",
}
# 2) rtc.room.create
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/rtc/room/create",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'name': '...'},
)
resp.raise_for_status()
print(resp.json())
# 3) rtc.room.get
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/rtc/room/get/ROOM",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())
# 4) rtc.room.list
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/rtc/room/list",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())
# 5) rtc.room.delete
import os, requests
resp = requests.delete(
"https://api.infrai.cc/v1/rtc/room/delete/ROOM",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())
# 6) rtc.token.issue
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/rtc/token/issue",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'room': '...', 'identity': '...'},
)
resp.raise_for_status()
print(resp.json())
# 7) rtc.recording.start
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/rtc/recording/start",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'room': '...'},
)
resp.raise_for_status()
print(resp.json())
# 8) rtc.recording.stop
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/rtc/recording/stop/RECORDING",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={},
)
resp.raise_for_status()
print(resp.json())
# 9) rtc.participant.list
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/rtc/participant/list/ROOM",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())
// 1) Auth: every call is a raw HTTPS request carrying only your project key.
// No SDK to install — just the built-in fetch().
const BASE = "https://api.infrai.cc";
const HEADERS = {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
};
// 2) rtc.room.create
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"name": "..."}),
},
);
console.log(await resp.json());
// 3) rtc.room.get
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/get/ROOM",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 4) rtc.room.list
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 5) rtc.room.delete
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/delete/ROOM",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 6) rtc.token.issue
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/token/issue",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "...", "identity": "..."}),
},
);
console.log(await resp.json());
// 7) rtc.recording.start
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/recording/start",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "..."}),
},
);
console.log(await resp.json());
// 8) rtc.recording.stop
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/recording/stop/RECORDING",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
},
);
console.log(await resp.json());
// 9) rtc.participant.list
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/participant/list/ROOM",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 1) Auth: every call is a raw HTTPS request carrying only your project key.
// No SDK to install — just the built-in fetch(), typed.
const BASE = "https://api.infrai.cc";
const HEADERS: Record<string, string> = {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
};
// 2) rtc.room.create
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"name": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 3) rtc.room.get
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/get/ROOM",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 4) rtc.room.list
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 5) rtc.room.delete
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/room/delete/ROOM",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 6) rtc.token.issue
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/token/issue",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "...", "identity": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 7) rtc.recording.start
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/recording/start",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"room": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 8) rtc.recording.stop
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/recording/stop/RECORDING",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 9) rtc.participant.list
const resp = await fetch(
"https://api.infrai.cc/v1/rtc/participant/list/ROOM",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);