About
The Serverless Video Streaming API uses WebRTC to stream video from webcams, RTSP cameras, or video files to Roboflow Cloud. You can run one model or a Workflow and receive processed frames plus prediction data in your application.
Use the Inference SDK WebRTC client for both models and Workflows. Set api_url to https://serverless.roboflow.com. The same client works with a self-hosted Inference Server when you change the URL.
Supported input sources:
- Webcam: a browser or device camera
- RTSP: an IP camera or other RTSP-compatible source
- Video file: a stored video uploaded through the data channel
When Serverless connects directly to an RTSP source, its URL must be publicly accessible. If the camera is available only on your local network, use LocalStreamSource to capture it on the client and forward the frames.
How it works
When you start a streaming session, the SDK calls Roboflow's API to initialize a WebRTC connection. The API spawns a serverless function that runs your Workflow. Once connected, data flows through two WebRTC channels:
Video track
Streams video frames bidirectionally. You send frames from your webcam or video file, and receive annotated/processed frames back. The Video Track is optimized for real-time display: it adjusts resolution and may drop frames based on available bandwidth. Quality ramps up as the connection stabilizes.
Due to WebRTC congestion control, it can take up to a minute for quality and FPS to ramp up to full capacity, especially at higher resolutions like 1920×1080 at 30 FPS.
Data channel
Sends structured inference results as JSON messages. This includes all Workflow output data like predictions, coordinates, and classifications. Unlike the Video Track, the Data Channel provides reliable, ordered delivery without any optimizations to keep up with the live camera feed. To process video files, you can upload the file via the Data Channel and consume results the same way to fully process the video.
You can use both channels simultaneously, for example displaying annotated video while also processing the structured prediction data in your application.
Regions and GPU plans
Specify requested_region and requested_plan in your configuration to control where and how your stream is processed.
Regions: us (United States), eu (Europe), ap (Asia Pacific)
Choose the region closest to your users or video source to minimize latency.
GPU plans:
webrtc-gpu-medium: Default and recommended for most workflowswebrtc-gpu-small: Lower cost. Try this after confirming Medium works well for your use case.webrtc-gpu-large: Required for SAM3 and Rapid Models that use SAM3 (expect ~5 FPS)
Concurrency limits
Each workspace is limited to 10 concurrent streams by default.
If you require a higher limit, please contact our sales team; we'll be happy to adjust it based on your needs.
Pricing
Billed per hour based on your selected GPU plan. Billing starts once the serverless function spawns and the WebRTC connection is established. See roboflow.com/credits for current rates.
SDKs
JavaScript
For web browsers and React Native applications.
npm install @roboflow/inference-sdkDo not expose your API key in frontend code. Use a backend proxy endpoint to keep it secure.
Python
For models and Workflows in Python applications:
pip install inference-sdk[webrtc]- PyPI package
- WebRTC Streaming reference
- Example scripts (webcam, RTSP, video file)
Configuration
When creating a streaming session, pass a StreamConfig object to control behavior:
stream_output: List of Workflow output names to stream via Video Trackdata_output: List of Workflow output names to send via Data Channelrequested_plan: GPU plan (see above)requested_region: Region code (us,eu, orap)realtime_processing: IfTrue(default), drop frames when processing can't keep upworkflow_parameters: Dictionary of parameters to pass to the Workflow
Test without code
You can test streaming directly in the Roboflow web interface:
- Go to app.roboflow.com
- Open the "Workflows" tab
- Select a Workflow and click "Test Workflow"
- Choose your source (Webcam, RTSP, or Video File) and configure GPU/region settings
- Click "Run"