Start a speech session
Starts a realtime speech-to-speech conversation with an avatar over a
WebSocket, without video. The answer carries the WebSocket url and a
short-lived token: connect within 60 seconds (tokenExpiresAt).
- Connecting: present the token as
Authorization: Bearer <token>or as the WebSocket subprotocolsatmee-liveandatmee-token.<token>. The first connection holds the session for good; a client that loses it starts a new session. - Avatar:
avatarIdis required, and the session uses that avatar's persona and voice. An avatar without a voice is422 avatar_has_no_voice. - Pinned settings:
settingspinssession.startfields from your backend, over the client's. A clientsession.startorsession.updatethat sets a pinned field is refused, naming it; appends such assession.instructions.appendstill add to it. Pinned persona fields override the avatar's. - Length: the session ends at
endsAt(the reservation plusactualDurationSeconds), whenever the connection opened. - Billing: by the second, at a per-minute rate, from the first
usage report (within 30 seconds of connecting) until the end, always
to the account that owns the avatar. A session nobody connects to costs nothing and is closed
as
failed(no_user_joined). - Credentials: an API key with the
sessionsscope (an avatar-scoped key must name its avatar), or the owner's signed-in user token where the deployment accepts one (X-Account-Idpicks among several accounts). There are no anonymous speech sessions. Read and end a session with either credential of its account.
X-Api-Key<token>Your secret API key (sk_atmee_...; older keys start sk_live_),
sent as X-Api-Key. Keep it on your server and never send it to a
browser.
application/json- body
avatarId*stringAn avatar of this account, with a voice, whose persona and voice the session uses (an avatar-scoped key's own avatar).
uuidmaxDurationSeconds?integerThe session's length in seconds (default 600), counted from the reservation (this call), whenever the connection opens. Shortened when the balance or the plan allows less; the answer says what was granted (actualDurationSeconds).
60 <= value <= 3600language?stringBCP 47 language of the conversation (e.g. en, fr-FR); passed to the speech server as given.
^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$2 <= length <= 35settings?session.start fields pinned by your backend: the client cannot set them (see the operation).
The session is reserved; connect to url with token.
application/json- response
links?Absent when this deployment does not know the website's address.
sessionId*stringuuidurl*stringThe WebSocket URL to connect to (wss://...).
token*stringAdmits one connection to this session; valid for 60 seconds. Not a credential for anything else.
tokenExpiresAt*stringdate-timeactualDurationSeconds*integerThe length granted by the key's, the plan's and the balance's limits, counted from the reservation (this call), whenever the connection opens; the session ends at the reservation plus this many seconds (endsAt on GET).
requestedDurationSeconds?integerThe maxDurationSeconds you sent; omitted when you sent none.
durationCapped*booleanTrue when actualDurationSeconds is shorter than requestedDurationSeconds.
billingMode?stringDeprecatedDeprecated; always metered for a billed session (see EmbedSessionStartResponse.billingMode).
"reserve""metered"curl -X POST 'https://api.atmanity.us/v1/speech_sessions' \ -H 'Content-Type: application/json' \ -d '{ "avatarId": "ac572b6e-802b-4b9e-a602-0786d4441e67"}'{ "links": { "chat": "http://example.com" }, "sessionId": "f6567dd8-e069-418e-8893-7d22fcf12459", "url": "string", "token": "string", "tokenExpiresAt": "2019-08-24T14:15:22Z", "actualDurationSeconds": 0, "requestedDurationSeconds": 0, "durationCapped": true, "billingMode": "reserve"}
