{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/primateintelligence-ai/json-schema/primateintelligence-ai-create-stream-request-schema.json",
  "title": "CreateStreamRequest",
  "description": "Requires positive credit balance. One queued|ready|live stream per account by default (409 stream_already_active otherwise).",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/primateintelligence-ai-openapi.json#/components/schemas/CreateStreamRequest",
  "type": "object",
  "properties": {
    "prompt": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000,
      "description": "Free text — compiled server-side. Exactly one of prompt/query."
    },
    "query": {
      "type": "object",
      "additionalProperties": {},
      "description": "Structured CompiledQuery JSON."
    },
    "model": {
      "type": "string"
    },
    "options": {
      "type": "object",
      "properties": {
        "narrative": {
          "type": "boolean",
          "default": false
        }
      },
      "description": "narrative: true — opt into live narrative. Result-frame detections then carry a narrative_update object ({t_s, text}) whenever the engine produces a new sentence (event-driven, not per frame; absent on frames without one). Included in the metered price — no surcharge."
    },
    "recording": {
      "type": "boolean",
      "description": "PRI-496: true — opt into retrieval of the server-side session recording. The ended stream then carries recording: {status} and GET /v1/streams/{id}/recording returns a signed 1h playback URL (raw H.264 elementary stream; lossless remux: ffmpeg -i in.h264 -c copy out.mp4). Default false."
    },
    "metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "maxLength": 500
      },
      "description": "Free-form key/value metadata. ≤16 keys, key ≤40 chars [a-zA-Z0-9_.-], value ≤500 chars."
    },
    "webhook": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "url",
        "events"
      ],
      "description": "Per-request webhook override (delivery ships P7). Write-only."
    }
  }
}