Skip to main content
POST
Create Session
A browser must not open control.url without a token. Append the credential as the token query parameter:
URL.searchParams preserves the existing session_id and encodes the credential. The query parameter name must be token, not client_secret. Server-side WebSocket clients may instead send Authorization: Bearer CONTROL_CLIENT_SECRET. Keep the credential and the complete URL out of logs.
Direct Create Session accepts an optional top-level auto_close object. The response returns the effective rules under the same name.An explicit nonzero value cannot exceed the effective maximum session duration. See Automatic session closure for setup and closing conditions.
Error responses use the same {code, message, data} envelope; a non-zero code identifies the error.

Authorizations

Authorization
string
header
required

Your Vivix API key. Keep it on your server.

Body

application/json
model
string
required

Use vivix-a1-stream. A lightweight variant vivix-a1-stream-lite is also available.

output
object
required

Create-time avatar video output settings for the session. Required for video_avatar mode and applied when session.mode is video_avatar; ignored in text_chat mode.

avatars
object[]
required

Session-local avatars available for conversation and rendering. A full create request requires a nonempty list with unique avatar_id values. An avatar used for video rendering needs a visual definition with a usable source image; a text-only avatar does not. Configure the session-wide voice in pipeline_config.tts_config.

idempotency_key
string

Client-generated key used to prevent duplicate session allocation when a create request is retried. On a 429/5xx/timeout, retry the create call with the same idempotency_key; it is safe and will not allocate a duplicate session.

region
string

Optional deployment region hint. Returned back on the session object; may be empty if not provided. It does not currently affect scheduling or guarantee data residency.

session
object

Initial mutable session state for mode, active avatar, and optional video source image. Use session.update to change these values after the session starts.

pipeline_config
object

Session-scoped pipeline configuration. For normal generated speech, provide tts_config here with a non-empty tts_voice_id; tts_provider and tts_model_id may be omitted and then default to the Qwen Audio pair. It applies to every avatar and cannot be changed after session creation. See Speech recognition configuration.

conversation
object

Initial conversational defaults such as instructions, tools, turn handling, and response defaults.

assets
object

Session-scoped reusable assets for response.script. Asset ids must be unique across audio, speech_text, and visual_prompts. Avatar source images stay under avatars[].visual.source_images. On the REST side the visual prompt text field is prompt; on the WSS asset.add side the same asset uses text — the two shapes differ.

delivery
object

Media delivery settings used when session.mode is video_avatar. If omitted, the media transport defaults to TRTC. It is not used for text_chat.

max_duration_seconds
integer

Requested maximum session duration in seconds. If omitted, the service-configured default applies. An explicit value must be greater than 3 (minimum 4); 0 is rejected. The service may still close the session for account limits, idle timeout, failures, or maintenance.

auto_close
object

Automatic close policy fixed when the session is created. The response returns the effective values after platform defaults are applied.

recording_mode
string

on or off. Send off to disable recording.

Response

200 - application/json

Success

code
integer
required

0 on success; any other value is an error code.

message
string
required

success, or an English error description.

data
object
required