POST/api/v1/full-live-swap/session

Live 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  }'
A person on a live video call, being restyled as the stream runs.

How it works

  1. 1Open a sessionFund up to duration_minutes. You get a stream URL and a token.
  2. 2ConnectOpen a WebSocket to stream_url with your session_token.
  3. 3StreamBilled by the second, from the first converted frame.
  4. 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.

FieldTypeRequiredDescription
duration_minutesintYesMinutes to fund, 1–240. The stream stops at the granted limit.
promptstringNoOptional 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

When capacity is tight the session is sized to what we can fund and steps down rather than failing, so you get a shorter session instead of an error. 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

There’s no stop endpoint. Disconnecting ends the session and bills the seconds streamed so far. It also stops by itself at 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

Keep at least 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

Response200
{  "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.

HTTPCodeWhat it means
401unauthorizedMissing, unknown or revoked key.
402insufficient_balanceYour balance won't cover the estimated hold. Top up to continue.
400invalid_inputA field failed validation, or a file_key doesn't start with api/.
400capability_unavailableThis capability is switched off right now.
429rate_limitedYou're sending too fast. Back off and retry.
429at_capacityThe platform is briefly full. Retry shortly.
502capacity_unavailableNo capacity for a live session right now.
502 / 500internal_errorFailed on our side. Nothing is charged; retry, and tell us if it keeps happening.