v1
latestOpenAPI 3.1.02026-07-171921144.8 KBrealtime
Create a real-time VLM alert rule
Start monitoring a live RTSP stream for a single alert_type. On success returns the rule's id, which you pass as alert_rule_id to GET / DELETE /api/v1/realtime/{alert_rule_id}.
Stream sharing
Provide sensor_id to share one underlying RTVI stream across multiple rules:
- If RTVI already has a stream registered with that id, it is reused — no extra connection to the camera.
- Otherwise a new stream is opened.
- The stream is only torn down when the last rule using it is deleted.
How a create is validated
- The rule is persisted (if persistence is enabled).
- The RTVI stream is opened (or reused).
- The service waits briefly for caption generation to start and, for new streams, polls RTVI until the stream is visible.
- If the RTSP source cannot be opened, you get a 502 with rtvi_stream_not_readable — no silent late failure.
When you might get blocked
While POST /api/v1/realtime/replay is running, this endpoint returns 503 replay_in_progress. Retry once the replay finishes.
post/api/v1/realtime
Request body
Example request
{
"alert_type": "collision",
"chunk_duration": 30,
"chunk_overlap_duration": 5,
"enable_reasoning": true,
"live_stream_url": "rtsp://localhost:8554/media/video1",
"model": "nvidia/cosmos3-nano-reasoner",
"num_frames_per_second_or_fixed_frames_chunk": 10,
"place_lat": "37.3706",
"place_lon": "-121.9672",
"place_name": "Dock Entrance-East",
"place_type": "warehouse-bay",
"prompt": "Detect vehicle collisions or near-miss events in this traffic camera feed.",
"sensor_id": "cc06804c-7f11-4865-bb00-6b2db072086f",
"sensor_name": "Camera_123",
"system_prompt": "You are a traffic safety monitoring assistant.",
"use_fps_for_chunking": true,
"vlm_input_height": 256,
"vlm_input_width": 256
}Response
Alert rule created successfully.
Example response
{
"created_at": "2025-06-01T12:00:00Z",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"message": "Realtime alert rule created",
"status": "success"
}