Start with one session
A session contains one continuous story. Create it with a natural-language setup, then keep the returnedid and control object.
1
Upload the image material
Upload an image to your workspace first. Keep both For an audio asset, use the matching upload endpoint and keep the returned
file_id and url from the response. The file_id is used for named assets; the returned url is used by opening_image.file_id:2
Create the session
3
Connect the control channel
Use the
control.url and the session-specific control.client_secret to open the WebSocket. The secret is only for this session; keep it private.4
Load the player
Wait for
session.ready. Its playback.url is an HLS address. Give that URL to an HLS-capable player and start playback.Create request
Generation details are selected by the service. There is no public inference-parameter object in this API.
References and opening images
An opening image answers “where should the story begin visually?” A named asset answers “which image or sound should later story segments refer to?” They are different inputs and can be used together. Assets can be registered before the first frame or added during playback. A session asset pool may be larger than the number of references used in one generated segment. The service selects the references needed for each segment; applications should use stable names and descriptions so the story can refer to them naturally. Each asset uses exactly one source:
The public response contains an opaque
asset_id, name, and type. It does not return source URLs or storage details.
Initial state and numeric rules
Usestate for values that your application needs to display or enforce. For example, a fighting game can start with both characters at 100 health points, then attach a state update to an instruction that describes a hit.
The service sends the full current state in every state.updated event. Your client can replace its local copy with that object instead of trying to reconstruct state from individual changes.
Response
Successful creation returns HTTP201:
What happens next
- The service prepares the opening media.
- The control channel emits
session.readywith an HLS playback URL. - Your client starts the player and listens for instruction and state events.
- New instructions affect future story content; already published video is not rewritten.