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.

One character, many calls. scenario gives one call its situation (an interview for a given role, a customer with a given complaint, a feedback talk) and language holds the character to one language, and picture puts them somewhere (any of your images of them) — so a product creates its characters once (POST /v1/characters, a portrait and a voice) and runs every drill, learner and language through them. With the captions above, it has the whole conversation to score or summarise after the call.

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.

Autorizzazione

Authorizationstringheaderobbligatorio

La tua chiave API come bearer token: Bearer eroq_sk_…. Creane una nella pagina delle chiavi.

Open a call with a character

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

POST/v1/live/sessions

Body

application/json
characterstringobbligatorio

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.

scenariostring

The situation of THIS call, on top of the character — « You are interviewing them for a junior product designer role: ask about one past project, push back once on a vague answer. » The character opens on it and keeps to it; the character itself is not changed. Up to 2,000 characters, read by the same content policy as a persona.

picturestring

The picture the call shows instead of the character's card portrait — the character somewhere (their office, a café, a stage): one of your images, creation:<id> (a Library image, GET /v1/creations) or upload:<id> (a Storage upload), JPEG, PNG or WebP. Its face is framed and made to talk; without a sure face to animate (turned away, too small), the call falls back on the card portrait. Read for minors before anything is bought.

languagestring

The language the character speaks the whole call — a code (es, pt-BR, ja) or a name (Spanish) — even when the caller answers in another one. Without it, the character answers in the language of the caller's last sentence.

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

Parametri di percorso

idstringobbligatorio

The session's id, as listed or created.

Body

application/json
sdpstringobbligatorio

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}

Parametri di percorso

idstringobbligatorio

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

Parametri di percorso

idstringobbligatorio

The session's id, as listed or created.

Body

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

Parametri di percorso

idstringobbligatorio

The session's id, as listed or created.

Body

application/json
diagnosticsobject

Optional. When the call never connected, what your side saw (ICE and DTLS states, candidate pairs, errors, under 8 KB, no addresses): kept with the session so support can tell why.

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 }