eroq

Media

Live calls

A live video call with one of your characters: their face, their voice, in real time.

100 credits per minute, bought ahead (the first minute when the call opens)

A live call puts the caller face to face with a character: the character hears them, answers in their own voice and their portrait talks, lip-synced, at 25 frames per second (512×512). The media runs over WebRTC between the caller's browser and eroq's call worker; eroq only relays the signalling. The character needs a portrait (avatarUrl); their persona and voice (voiceId, else their gender's roster voice) are the ones the chat and /v1/audio/speech use.

The flow. POST /v1/live/sessions with character buys the first minute and returns ice_servers. Create an RTCPeerConnection with them, add the microphone track (sendrecv) then a video transceiver (sendrecv, no track: the face comes back on it), gather ICE, and send the local description to POST /v1/live/sessions/{id}/offer. Poll GET /v1/live/sessions/{id} (about once a second) until answer is set and pass it to setRemoteDescription — a warm worker answers in a second or two, a cold one boots first (up to ~40 s). A call nobody picks up within 150 s fails and gives its minute back.

Billing, minute by minute. Time is bought ahead: the call goes on while the connected seconds stay within paid_seconds, and the worker ends it a few seconds after. Buy the next minute with POST /v1/live/sessions/{id}/extend before the current one runs out (the studio does it 20 s ahead); 402 insufficient_credits there means the call ends when the bought time is over. POST /v1/live/sessions/{id}/end hangs up; a call that never connected gives its first minute back.

Captions. Open a data channel on the connection before the offer (createDataChannel('eroq')): the call sends on it, as JSON, {"type":"eroq-live","event":"heard","text":…} once the caller's words are transcribed and {"type":"eroq-live","event":"said","text":…} for each sentence the character speaks — for captions, or to act on what the caller asks. eroq keeps none of it.

The caller's words meet the same content policy as the chat (fiction between adults, nothing involving minors): a refused line is answered by the character changing the subject. A workspace holds two open calls at a time; a call lasts two hours at most.

Autorização

Authorizationstringheaderobrigatório

Sua chave de API como bearer token: Bearer eroq_sk_…. Crie uma na página de chaves.

Open a call with a character

Open a call with a character: buys the first minute, returns the ICE servers.

POST/v1/live/sessions

Corpo

application/json
characterstringobrigatório

One of your characters (GET /v1/characters) — it needs a portrait.

userstring

Your end user (an opaque id), kept on the call and the ledger.

Open a call with a character
curl https://eroq.ai/v1/live/sessions \
  -H "Authorization: Bearer $EROQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "character": "9c1e2d4a-6b7f-4c3d-9e8a-1f2b3c4d5e6f"
}'
{
"id": "live_3f9a1c2b7d8e4f60", "object": "live.session", "status": "created",
"character": "9c1e…", "answer": null,
"ice_servers": [{ "urls": ["stun:stun.cloudflare.com:3478", "turn:turn.cloudflare.com:3478?transport=udp"], "username": "…", "credential": "…" }],
"credits_per_minute": 100, "paid_seconds": 60, "seconds": 0, "credits_spent": 100,
"credits_remaining": 1700
}

Send the browser's WebRTC offer

Send the browser's WebRTC offer: the call starts ringing.

POST/v1/live/sessions/{id}/offer

Parâmetros de caminho

idstringobrigatório

The session's id, as listed or created.

Corpo

application/json
sdpstringobrigatório

The RTCPeerConnection local description, ICE gathered.

typestring

offer.

Send the browser's WebRTC offer
curl https://eroq.ai/v1/live/sessions/SESSION_ID/offer \
  -H "Authorization: Bearer $EROQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "offer",
  "sdp": "v=0\r\no=- 4611731400430051336 2 IN IP4 127.0.0.1\r\n…"
}'
{ "id": "live_3f9a1c2b7d8e4f60", "object": "live.session", "status": "ringing", "answer": null, "paid_seconds": 60 }

The call as it stands

The call as it stands — the worker's answer once it picks up.

GET/v1/live/sessions/{id}

Parâmetros de caminho

idstringobrigatório

The session's id, as listed or created.

The call as it stands
curl https://eroq.ai/v1/live/sessions/SESSION_ID \
  -H "Authorization: Bearer $EROQ_API_KEY"
{
"id": "live_3f9a1c2b7d8e4f60", "object": "live.session", "status": "live",
"answer": { "type": "answer", "sdp": "v=0\r\n…" },
"credits_per_minute": 100, "paid_seconds": 120, "seconds": 74.2, "credits_spent": 200,
"end_reason": null, "refunded": false
}

Buy more time before the bought minutes run out

POST/v1/live/sessions/{id}/extend

Parâmetros de caminho

idstringobrigatório

The session's id, as listed or created.

Corpo

application/json
minutesinteger

1 to 10 (default 1).

Buy more time before the bought minutes run out
curl https://eroq.ai/v1/live/sessions/SESSION_ID/extend \
  -H "Authorization: Bearer $EROQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "minutes": 1
}'
{ "id": "live_3f9a1c2b7d8e4f60", "status": "live", "paid_seconds": 180, "credits_spent": 300, "credits_remaining": 1500 }

Hang up

Hang up. A call that never connected gives its minute back.

POST/v1/live/sessions/{id}/end

Parâmetros de caminho

idstringobrigatório

The session's id, as listed or created.

Hang up
curl -X POST https://eroq.ai/v1/live/sessions/SESSION_ID/end \
  -H "Authorization: Bearer $EROQ_API_KEY"
{ "id": "live_3f9a1c2b7d8e4f60", "status": "ended", "seconds": 131.5, "end_reason": "hangup", "refunded": false }