Start Stream Video Understanding
curl --request POST \
--url https://stream.memories.ai/v1/understand/streamConnect \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "rtmp://your.server:1935/live/stream",
"user_prompt": "What is happening right now?",
"system_prompt": "You are a real-time video monitoring system.",
"callback": "https://your.app/callback",
"thinking": false
}
'import requests
url = "https://stream.memories.ai/v1/understand/streamConnect"
payload = {
"url": "rtmp://your.server:1935/live/stream",
"user_prompt": "What is happening right now?",
"system_prompt": "You are a real-time video monitoring system.",
"callback": "https://your.app/callback",
"thinking": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'rtmp://your.server:1935/live/stream',
user_prompt: 'What is happening right now?',
system_prompt: 'You are a real-time video monitoring system.',
callback: 'https://your.app/callback',
thinking: false
})
};
fetch('https://stream.memories.ai/v1/understand/streamConnect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://stream.memories.ai/v1/understand/streamConnect",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'rtmp://your.server:1935/live/stream',
'user_prompt' => 'What is happening right now?',
'system_prompt' => 'You are a real-time video monitoring system.',
'callback' => 'https://your.app/callback',
'thinking' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stream.memories.ai/v1/understand/streamConnect"
payload := strings.NewReader("{\n \"url\": \"rtmp://your.server:1935/live/stream\",\n \"user_prompt\": \"What is happening right now?\",\n \"system_prompt\": \"You are a real-time video monitoring system.\",\n \"callback\": \"https://your.app/callback\",\n \"thinking\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://stream.memories.ai/v1/understand/streamConnect")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"rtmp://your.server:1935/live/stream\",\n \"user_prompt\": \"What is happening right now?\",\n \"system_prompt\": \"You are a real-time video monitoring system.\",\n \"callback\": \"https://your.app/callback\",\n \"thinking\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://stream.memories.ai/v1/understand/streamConnect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"rtmp://your.server:1935/live/stream\",\n \"user_prompt\": \"What is happening right now?\",\n \"system_prompt\": \"You are a real-time video monitoring system.\",\n \"callback\": \"https://your.app/callback\",\n \"thinking\": false\n}"
response = http.request(request)
puts response.read_body{
"status": 0,
"task_id": "5347085a-1747-4731-bdde-3856d09502c4",
"text": ""
}Live Video Understanding
Start Stream Video Understanding
Start a real-time AI analysis session on a live RTMP video stream with a custom prompt.
POST
/
v1
/
understand
/
streamConnect
Start Stream Video Understanding
curl --request POST \
--url https://stream.memories.ai/v1/understand/streamConnect \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "rtmp://your.server:1935/live/stream",
"user_prompt": "What is happening right now?",
"system_prompt": "You are a real-time video monitoring system.",
"callback": "https://your.app/callback",
"thinking": false
}
'import requests
url = "https://stream.memories.ai/v1/understand/streamConnect"
payload = {
"url": "rtmp://your.server:1935/live/stream",
"user_prompt": "What is happening right now?",
"system_prompt": "You are a real-time video monitoring system.",
"callback": "https://your.app/callback",
"thinking": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'rtmp://your.server:1935/live/stream',
user_prompt: 'What is happening right now?',
system_prompt: 'You are a real-time video monitoring system.',
callback: 'https://your.app/callback',
thinking: false
})
};
fetch('https://stream.memories.ai/v1/understand/streamConnect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://stream.memories.ai/v1/understand/streamConnect",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'rtmp://your.server:1935/live/stream',
'user_prompt' => 'What is happening right now?',
'system_prompt' => 'You are a real-time video monitoring system.',
'callback' => 'https://your.app/callback',
'thinking' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stream.memories.ai/v1/understand/streamConnect"
payload := strings.NewReader("{\n \"url\": \"rtmp://your.server:1935/live/stream\",\n \"user_prompt\": \"What is happening right now?\",\n \"system_prompt\": \"You are a real-time video monitoring system.\",\n \"callback\": \"https://your.app/callback\",\n \"thinking\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://stream.memories.ai/v1/understand/streamConnect")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"rtmp://your.server:1935/live/stream\",\n \"user_prompt\": \"What is happening right now?\",\n \"system_prompt\": \"You are a real-time video monitoring system.\",\n \"callback\": \"https://your.app/callback\",\n \"thinking\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://stream.memories.ai/v1/understand/streamConnect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"rtmp://your.server:1935/live/stream\",\n \"user_prompt\": \"What is happening right now?\",\n \"system_prompt\": \"You are a real-time video monitoring system.\",\n \"callback\": \"https://your.app/callback\",\n \"thinking\": false\n}"
response = http.request(request)
puts response.read_body{
"status": 0,
"task_id": "5347085a-1747-4731-bdde-3856d09502c4",
"text": ""
}Product: Visual Intelligence — Live Video Understanding
Use case: Apply a custom AI prompt continuously to a live RTMP stream (e.g. captioning, activity recognition, custom monitoring), results to your callback every 5s
Mode: Server-Pull (you give us an RTMP URL → we pull → results to your callback)
Host:
https://stream.memories.ai
Auth: Authorization: sk-mavi-... (no Bearer prefix)user_prompt, and pushes results to your callback URL every few seconds.
Each API key supports a maximum of 4 concurrent streaming tasks. Billing occurs every 5 seconds per active stream. If a credit deduction fails, the stream is automatically terminated.
Request Example
import requests
url = "https://stream.memories.ai/v1/understand/streamConnect"
headers = {
"Authorization": "sk-mavi-...",
"Content-Type": "application/json"
}
payload = {
"url": "rtmp://your.server/live/stream",
"user_prompt": "What stage is the food preparation at? Is it ready to eat?",
"system_prompt": "Track the current cooking progress.",
"callback": "https://your.app/callback",
"thinking": False
}
response = requests.post(url, headers=headers, json=payload)
print(response.json()) # {"status": 0, "task_id": "..."}
Parameters
string
required
RTMP stream URL for live video input (e.g.
rtmp://your.server:1935/live/stream).string
required
The analysis instruction applied to each frame window — e.g.
"What is happening right now?".string
required
Role or context for the AI — e.g.
"You are a real-time video monitoring system.".string
required
Public URL to receive continuous analysis results. Called repeatedly throughout the stream lifetime.
boolean
default:"false"
Enable reasoning mode for deeper analysis.
Start Stream Response
{
"status": 0,
"task_id": "5347085a-1747-4731-bdde-3856d09502c4",
"text": ""
}
task_id to stop the stream via Stop Stream Video Understanding.
Callback Payload
Results are pushed to yourcallback URL continuously while the stream is active:
{
"status": 0,
"task_id": "5347085a-1747-4731-bdde-3856d09502c4",
"data": {
"text": "The chef is frying vegetables. The dish appears to be halfway done.",
"timestamp": "2025-10-22T12:00:45Z"
}
}
integer
0 = success, -1 = failure.string
Identifies which stream this callback belongs to. Use this to stop the stream.
string
AI-generated analysis for the current frame window.
string
UTC timestamp of the analysis frame.
Error Codes
| Code | Meaning |
|---|---|
-1 | Invalid request or parameters |
1001 | Maximum concurrent streams reached (4 per key) |
2001 | Credit deduction failed — stream auto-terminated |
5000 | Internal server error |
Billing
- Charged every 5 seconds per active stream
- If credit deduction fails, the stream stops automatically — recharge and call this endpoint again to resume
- This API does not support video file uploads or historical playback — live RTMP only
Authorizations
Body
application/json
RTMP stream URL for live video input
Example:
"rtmp://your.server:1935/live/stream"
Analysis instruction applied to each frame window
Example:
"What is happening right now?"
Role or context for the AI
Example:
"You are a real-time video monitoring system."
Public URL to receive continuous analysis results
Example:
"https://your.app/callback"
Enable reasoning mode for deeper analysis
