/api/v1/full-live-swap/sessionLive Body Swap
Restyle a person in a live video stream.
This one is a session, not a job. Open a session, connect to the stream it gives you over a WebSocket, and stream. You're billed for the seconds you actually stream.
- A live sessionStream over a WebSocket
- Billed by the secondOnly for what you stream
- Nothing if it never startsThe meter starts at the first frame
curl -X POST https://api.kreatorsfactory.com/api/v1/full-live-swap/session \ -H "Authorization: Bearer $KREATORSFACTORY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "duration_minutes": 10 }'
How it works
- 1Open a sessionFund up to duration_minutes. You get a stream URL and a token.
- 2ConnectOpen a WebSocket to stream_url with your session_token.
- 3StreamBilled by the second, from the first converted frame.
- 4DisconnectClosing the socket ends the session and settles the bill.
Request parameters
Send JSON with Content-Type: application/json. Job endpoints also accept an optional Idempotency-Key header. See Safe Retries.
| Field | Type | Required | Description |
|---|---|---|---|
duration_minutes | int | Yes | Minutes to fund, 1–240. The stream stops at the granted limit. |
prompt | string | No | Optional instruction for the swap, up to 2,000 characters. A default is used if you leave it out. |
Connecting and streaming
Read max_duration_sec: you may get less than you asked for
max_duration_sec is what you have, and max_cost_usd is worked out from it. Don’t assume duration_minutes × 60.Connect to {stream_url}?session_token={session_token} over a WebSocket. The promptcomes back filled in, so you can see the default when you didn’t send one.
Close the socket to end it
max_duration_sec, so a dropped client can’t run up a bill beyond what you funded.You pay for seconds streamed, not the block reserved
max_cost_usdavailable to start. The meter starts at the first converted frame, so a session that connects and never streams costs nothing. Live sessions don’t send webhooks.Response
{ "session_id": "c41d8e2a-…", "stream_url": "wss://api.kreatorsfactory.com/realtime", "session_token": "rt_…", "prompt": "…", "max_duration_sec": 600, "max_cost_usd": 25.00}max_cost_usdis the most this session can cost: the full block reserved. You’re billed only for the seconds you stream.
Errors
Every error arrives as {"error": {"code", "message"}}. Branch on code; the message may change. All errors.
| HTTP | Code | What it means |
|---|---|---|
| 401 | unauthorized | Missing, unknown or revoked key. |
| 402 | insufficient_balance | Your balance won't cover the estimated hold. Top up to continue. |
| 400 | invalid_input | A field failed validation, or a file_key doesn't start with api/. |
| 400 | capability_unavailable | This capability is switched off right now. |
| 429 | rate_limited | You're sending too fast. Back off and retry. |
| 429 | at_capacity | The platform is briefly full. Retry shortly. |
| 502 | capacity_unavailable | No capacity for a live session right now. |
| 502 / 500 | internal_error | Failed on our side. Nothing is charged; retry, and tell us if it keeps happening. |