Back to Eliza

Stream API

packages/docs/rest/stream.md

2.0.19.4 KB
Original Source

Endpoints

MethodPathDescription
POST/api/stream/liveStart streaming (destination-managed)
POST/api/stream/offlineStop the active stream
GET/api/stream/statusCurrent stream health and configuration
POST/api/stream/startStart streaming (direct RTMP)
POST/api/stream/stopStop FFmpeg process
POST/api/stream/framePipe a raw image frame to FFmpeg
POST/api/stream/volumeSet audio volume
POST/api/stream/muteMute audio
POST/api/stream/unmuteUnmute audio
GET/api/streaming/destinationsList configured streaming destinations
POST/api/streaming/destinationSet active streaming destination
GET/api/stream/overlay-layoutGet overlay layout
POST/api/stream/overlay-layoutSave overlay layout
GET/api/stream/voiceGet voice (TTS) configuration
POST/api/stream/voiceSave voice settings
POST/api/stream/voice/speakManually trigger TTS on live stream
GET/api/stream/settingsGet visual stream settings
POST/api/stream/settingsSave visual stream settings

Stream Control

Start Stream (Destination-Managed)

POST /api/stream/live

Starts streaming using the configured destination adapter. Fetches RTMP credentials automatically from the active destination plugin.

Response:

json
{
  "ok": true,
  "live": true,
  "rtmpUrl": "rtmp://live.twitch.tv/app",
  "inputMode": "pipe",
  "audioSource": "tts",
  "destination": "twitch"
}

Stop Stream

POST /api/stream/offline

Stops the active stream and notifies the destination plugin.

Response:

json
{ "ok": true, "live": false }

Stream Status

GET /api/stream/status

Returns current stream health and configuration.

Response:

json
{
  "ok": true,
  "running": true,
  "ffmpegAlive": true,
  "uptime": 3742,
  "frameCount": 112260,
  "volume": 80,
  "muted": false,
  "audioSource": "tts",
  "inputMode": "pipe",
  "destination": "twitch"
}

Start Stream (Direct RTMP)

POST /api/stream/start

Backward-compatible explicit RTMP start with full parameter control. Prefer POST /api/stream/live for destination-managed starts.

Request body:

json
{
  "rtmpUrl": "rtmp://live.twitch.tv/app",
  "rtmpKey": "live_abc123",
  "inputMode": "testsrc",
  "resolution": "1280x720",
  "bitrate": "2500k",
  "framerate": 30
}
FieldTypeRequiredDefaultNotes
rtmpUrlstringyesMust start with rtmp:// or rtmps://
rtmpKeystringyesStream key
inputModestringno"testsrc""testsrc", "avfoundation", or "pipe"
resolutionstringno"1280x720"Must match /^\d{3,4}x\d{3,4}$/
bitratestringno"2500k"Must match /^\d+k$/
frameratenumberno30Integer 1–60

Response:

json
{ "ok": true, "message": "Stream started" }

Stop Stream (Direct)

POST /api/stream/stop

Stops the active FFmpeg process and returns session uptime.

Response:

json
{ "ok": true, "uptime": 3742 }

uptime is in seconds.

Send Frame

POST /api/stream/frame

Pipes a raw JPEG/image frame buffer to FFmpeg. Used in pipe capture mode (desktop runtime page capture).

Request: Raw binary body (max 2 MB).

Response: 200 with empty body.

Errors: 400 empty body; 503 stream not running.

Stream Source

Get Stream Source

GET /api/stream/source

Returns the current stream capture source configuration.

Response:

json
{
  "source": {
    "type": "stream-tab",
    "url": "https://example.com"
  }
}
FieldTypeDescription
source.typestringSource type: "stream-tab", "screen", "custom", etc.
source.urlstring|undefinedCustom URL when applicable

Set Stream Source

POST /api/stream/source

Switch the stream capture source.

Request body:

json
{
  "sourceType": "stream-tab",
  "customUrl": "https://example.com"
}
FieldTypeRequiredDescription
sourceTypestringnoSource type (default: "stream-tab")
customUrlstringnoCustom URL for the source

Response:

json
{
  "ok": true,
  "source": {
    "type": "stream-tab"
  }
}

Audio

Set Volume

POST /api/stream/volume

Request body:

json
{ "volume": 80 }

volume is an integer 0–100.

Response:

json
{ "ok": true, "volume": 80, "muted": false }

Mute

POST /api/stream/mute

Response:

json
{ "ok": true, "muted": true, "volume": 80 }

Unmute

POST /api/stream/unmute

Response:

json
{ "ok": true, "muted": false, "volume": 80 }

Destinations

List Destinations

GET /api/streaming/destinations

Returns all configured streaming destinations from the multi-destination registry. Each destination indicates whether it is the currently active target.

Response:

json
{
  "ok": true,
  "destinations": [
    { "id": "twitch", "name": "Twitch", "active": true },
    { "id": "youtube", "name": "YouTube", "active": false },
    { "id": "pumpfun", "name": "pump.fun", "active": false },
    { "id": "x", "name": "X/Twitter", "active": false }
  ]
}
FieldTypeDescription
destinations[].idstringUnique destination identifier
destinations[].namestringHuman-readable destination name
destinations[].activebooleanWhether this destination is currently selected for streaming

The active destination defaults to the first registered destination when no explicit selection has been made.

Set Active Destination

POST /api/streaming/destination

Switches the active streaming destination at runtime. The selected destination is used for subsequent POST /api/stream/live calls to resolve RTMP credentials automatically.

Request body:

json
{ "destinationId": "twitch" }
FieldTypeRequiredDescription
destinationIdstringyesID of the destination to activate (must match a registered destination)

Response (200):

json
{
  "ok": true,
  "destination": { "id": "twitch", "name": "Twitch" }
}

Errors:

StatusBodyCondition
400{ "error": "destinationId is required" }Missing or empty destinationId
404{ "error": "Unknown destination: <id>" }No registered destination matches the provided ID
500{ "error": "<message>" }Unexpected server error

Overlays

Get Overlay Layout

GET /api/stream/overlay-layout

Query params:

ParamTypeRequiredDescription
destinationstringnoDestination ID for per-destination layouts

Response:

json
{
  "ok": true,
  "layout": {
    "version": 1,
    "widgets": [...]
  },
  "destinationId": "twitch"
}

Save Overlay Layout

POST /api/stream/overlay-layout

Request body:

json
{
  "layout": {
    "version": 1,
    "widgets": [...]
  }
}

Response:

json
{ "ok": true }

Voice (TTS-to-RTMP)

Get Voice Config

GET /api/stream/voice

Returns voice configuration and current speaking status.

Response:

json
{
  "ok": true,
  "enabled": true,
  "autoSpeak": true,
  "provider": "elevenlabs",
  "configuredProvider": "elevenlabs",
  "hasApiKey": true,
  "isSpeaking": false,
  "isAttached": true
}

Save Voice Settings

POST /api/stream/voice

Request body:

json
{
  "enabled": true,
  "autoSpeak": true,
  "provider": "elevenlabs"
}

Response:

json
{ "ok": true }

Speak Text

POST /api/stream/voice/speak

Manually trigger TTS on the live stream.

Request body:

json
{ "text": "Hello, stream!" }
ConstraintValue
Max text length2000 characters
Rate limitOne at a time (429 if speaking)
RequiresStream must be live, TTS bridge attached

Response:

json
{ "ok": true }

Errors: 400 text missing/too long; 429 already speaking; 503 bridge not attached.

Stream Source

Get Stream Source

GET /api/stream/source

Returns the current stream input source configuration.

Response:

json
{
  "source": {
    "type": "stream-tab",
    "url": null
  }
}

Set Stream Source

POST /api/stream/source

Switch the stream input source.

Request body:

json
{
  "sourceType": "custom-url",
  "customUrl": "https://example.com/stream"
}
FieldTypeRequiredDescription
sourceTypestringnoSource type (default: "stream-tab")
customUrlstringnoCustom URL for the source (only used with custom-url type)

Response:

json
{
  "ok": true,
  "source": {
    "type": "custom-url",
    "url": "https://example.com/stream"
  }
}

Visual Settings

Get Stream Settings

GET /api/stream/settings

Response:

json
{
  "ok": true,
  "settings": {
    "theme": "eliza",
    "avatarIndex": 0
  }
}

Save Stream Settings

POST /api/stream/settings

Request body:

json
{
  "settings": {
    "theme": "eliza",
    "avatarIndex": 2
  }
}

Response:

json
{ "ok": true }