Trio Stream Vision — Analyze Any Livestream with Natural Language
Paste a YouTube Live URL, RTSP camera feed, or HLS stream — ask questions about what's happening in plain English. Detect events, monitor conditions, and get periodic summaries, all without writing ML pipelines. Powered by Trio's Reality-as-an-API.
When to Use
- - User asks what's happening on a camera, stream, or video feed ("is anyone at my front door?")
- User wants smart alerts for specific events ("tell me when a package is delivered", "alert me if my dog gets on the couch")
- User wants to monitor something they can't watch themselves (construction site, parking spot, warehouse)
- User wants periodic summaries of a live feed ("summarize this stream every 10 minutes")
- User provides any live stream URL: YouTube Live, Twitch, RTSP/RTSPS cameras, HLS streams
Prerequisites
- - A Trio API key. Get one free (100 credits) at https://console.machinefi.com
- Set the key: INLINECODE0
- Base URL: INLINECODE1
Available Actions
1. Check Once (Quick Snapshot)
Ask a yes/no question about what's currently visible on a stream. Costs 1 credit ($0.01).
CODEBLOCK0
Optional parameters:
- -
"include_frame": true — returns the analyzed frame as base64 image - INLINECODE3 — analyze a short video clip instead of a single frame (better for motion detection)
- INLINECODE4 — clip length (1-10 seconds, only with clip/hybrid mode)
Response fields:
- -
triggered (boolean) — whether the condition matched - INLINECODE6 (string) — VLM's reasoning about what it sees
- INLINECODE7 — processing time in milliseconds
Input mode guidance:
- - Use
"frames" (default) for static objects: "Is there a car in the driveway?", "Is the door open?" - Use
"clip" for motion/actions: "Is someone walking?", "Did a package get delivered?" - Use
"hybrid" for maximum accuracy (costs more)
2. Live Monitor (Continuous Event Detection)
Monitor a stream continuously and get alerted when a condition becomes true. Costs 2 credits/min ($0.02/min).
CODEBLOCK1
Optional parameters:
- -
"webhook_url": "https://your-server.com/webhook" — receive HTTP POST notifications on trigger - INLINECODE12 — check frequency (5-300 seconds)
- INLINECODE13 — how long to monitor (min 5 seconds)
- INLINECODE14 — minimum seconds between triggers
- INLINECODE15 — set to null for unlimited triggers
- INLINECODE16 — default for live-monitor, good for motion
Response: Returns a job_id. Use it to check status or cancel.
Delivery modes (automatic based on request):
- - If
webhook_url is set → events POST to your webhook - If
Accept: text/event-stream header is set (no webhook) → SSE stream - Otherwise → poll with INLINECODE20
3. Live Digest (Periodic Summaries)
Get narrative summaries of what's happening on a stream at regular intervals. Costs 2 credits/min ($0.02/min).
CODEBLOCK2
Optional parameters:
- -
"window_minutes": 10 — summary window length (1-60 minutes) - INLINECODE22 — frame capture frequency (10-300 seconds)
- INLINECODE23 — receive summaries via webhook
- INLINECODE24 — number of summary windows before stopping
- INLINECODE25 — embed frames in summaries
Response: Returns a job_id.
4. Check Job Status
CODEBLOCK3
Job statuses: pending, running, stopped, completed, INLINECODE31
5. List All Jobs
CODEBLOCK4
Optional query params: status=running, type=live-monitor, limit=20, INLINECODE35
6. Cancel a Job
CODEBLOCK5
Recommended Workflows
Quick Check Workflow
- 1. Run check-once with the user's question and stream URL
- Report the
triggered result and explanation to the user - If the API returns an error about the stream, show the error and remediation
Monitoring Workflow
- 1. Test the condition with check-once first to verify it works
- If the condition works, start live-monitor with appropriate settings
- Return the jobid and inform user how to check status or cancel
- If webhookurl is available, set it up for push notifications
Summary Workflow
- 1. Start live-digest with the stream URL and appropriate window/interval
- Return the job_id so the user can check results later
Condition Writing Tips
- - Frame as binary yes/no questions: "Is there a person visible in the frame?"
- Be specific: "Is there smoke rising from the building roof?" not "Is there smoke?"
- One intent per condition — don't combine multiple checks
- Use positive phrasing: "Are vehicles visible?" not "Is the parking lot not empty?"
- Always test conditions with check-once before starting live-monitor
Error Handling
All errors return this structure:
CODEBLOCK6
Common error codes:
- -
NOT_LIVESTREAM — URL is not a live stream. Confirm it's actively broadcasting. - INLINECODE39 — Cannot reach the stream. Check URL and network.
- INLINECODE40 — Stream exists but is offline. Wait for it to go live.
- INLINECODE41 — Too many concurrent jobs. Cancel old ones with DELETE /jobs/{id}.
If you get an error, always show the remediation field to the user — it contains actionable guidance.
Pricing Reference
| Action | Cost |
|---|
| Check once | $0.01 / request |
| Live monitor |
$0.02 / minute |
| Live digest | $0.02 / minute |
Free tier: 100 credits ($1.00) on signup at https://console.machinefi.com
Rules
- - NEVER expose or log the $TRIOAPIKEY value in output shown to the user.
- ALWAYS show the
explanation field from check-once responses — it provides the VLM's reasoning. - ALWAYS test conditions with check-once before starting a live-monitor job.
- When a user provides a stream URL, auto-detect whether they want a quick check, monitoring, or digest based on their intent.
- For monitoring jobs, always return the job_id so the user can check status or cancel later.
- If the API returns an error, show the error code and remediation to the user.
- Inform users about credit costs before starting live-monitor or live-digest jobs (they charge per minute).
Trio Stream Vision — 用自然语言分析任意直播流
粘贴YouTube直播链接、RTSP摄像头源或HLS流——用通俗英语提问正在发生什么。检测事件、监控状态、获取定期摘要,无需编写机器学习流水线。由Trio的现实即API提供支持。
适用场景
- - 用户询问摄像头、直播流或视频源上正在发生什么(我家前门有人吗?)
- 用户希望针对特定事件设置智能提醒(包裹送达时通知我、如果我的狗跳上沙发就提醒我)
- 用户想监控自己无法实时查看的内容(建筑工地、停车位、仓库)
- 用户希望定期获取直播摘要(每10分钟总结一次这个直播)
- 用户提供任意直播流URL:YouTube直播、Twitch、RTSP/RTSPS摄像头、HLS流
前提条件
- - Trio API密钥。在https://console.machinefi.com免费获取(100积分)
- 设置密钥:export TRIOAPIKEY=yourkeyhere
- 基础URL:https://trio.machinefi.com/api
可用操作
1. 单次检查(快速快照)
对直播流当前可见内容提出是/否问题。消耗1积分($0.01)。
bash
curl -s -X POST https://trio.machinefi.com/api/check-once \
-H Authorization: Bearer $TRIOAPIKEY \
-H Content-Type: application/json \
-d {
streamurl: STREAMURL_HERE,
condition: NATURALLANGUAGECONDITION_HERE
} | python3 -m json.tool
可选参数:
- - includeframe: true — 返回分析帧的base64图像
- inputmode: clip — 分析短视频片段而非单帧(更适合运动检测)
- clipdurationseconds: 5 — 片段长度(1-10秒,仅限clip/hybrid模式)
响应字段:
- - triggered(布尔值)— 条件是否匹配
- explanation(字符串)— VLM关于所见内容的推理
- latency_ms — 处理时间(毫秒)
输入模式指南:
- - 静态对象使用frames(默认):车道上有一辆车吗?、门是开着的吗?
- 运动/动作使用clip:有人在走路吗?、包裹送达了吗?
- 最大精度使用hybrid(成本更高)
2. 实时监控(持续事件检测)
持续监控直播流,当条件变为真时发出警报。消耗2积分/分钟($0.02/分钟)。
bash
curl -s -X POST https://trio.machinefi.com/api/live-monitor \
-H Authorization: Bearer $TRIOAPIKEY \
-H Content-Type: application/json \
-d {
streamurl: STREAMURL_HERE,
condition: NATURALLANGUAGECONDITION_HERE,
interval_seconds: 10,
monitordurationseconds: 600,
max_triggers: 1
} | python3 -m json.tool
可选参数:
- - webhookurl: https://your-server.com/webhook — 触发时接收HTTP POST通知
- intervalseconds: 10 — 检查频率(5-300秒)
- monitordurationseconds: 600 — 监控时长(最少5秒)
- triggercooldownseconds: 60 — 触发之间的最小间隔秒数
- maxtriggers: null — 设为null表示无限触发
- inputmode: clip — 实时监控默认值,适合运动检测
响应: 返回job_id。用于检查状态或取消。
传递模式(基于请求自动选择):
- - 如果设置了webhookurl → 事件POST到您的webhook
- 如果设置了Accept: text/event-stream头(无webhook)→ SSE流
- 否则 → 使用GET /jobs/{jobid}轮询
3. 实时摘要(定期总结)
按固定间隔获取直播流的叙述性摘要。消耗2积分/分钟($0.02/分钟)。
bash
curl -s -X POST https://trio.machinefi.com/api/live-digest \
-H Authorization: Bearer $TRIOAPIKEY \
-H Content-Type: application/json \
-d {
streamurl: STREAMURL_HERE,
window_minutes: 10,
captureintervalseconds: 60
} | python3 -m json.tool
可选参数:
- - windowminutes: 10 — 摘要窗口长度(1-60分钟)
- captureintervalseconds: 60 — 帧捕获频率(10-300秒)
- webhookurl: https://... — 通过webhook接收摘要
- maxwindows: 3 — 停止前的摘要窗口数量
- includeframes: true — 在摘要中嵌入帧
响应: 返回job_id。
4. 检查任务状态
bash
curl -s https://trio.machinefi.com/api/jobs/JOBIDHERE \
-H Authorization: Bearer $TRIOAPIKEY | python3 -m json.tool
任务状态: pending(待处理)、running(运行中)、stopped(已停止)、completed(已完成)、failed(失败)
5. 列出所有任务
bash
curl -s https://trio.machinefi.com/api/jobs?limit=20&offset=0 \
-H Authorization: Bearer $TRIOAPIKEY | python3 -m json.tool
可选查询参数:status=running、type=live-monitor、limit=20、offset=0
6. 取消任务
bash
curl -s -X DELETE https://trio.machinefi.com/api/jobs/JOBIDHERE \
-H Authorization: Bearer $TRIOAPIKEY | python3 -m json.tool
推荐工作流程
快速检查工作流程
- 1. 使用用户的问题和直播流URL运行check-once
- 向用户报告triggered结果和explanation
- 如果API返回关于直播流的错误,显示错误和修复建议
监控工作流程
- 1. 先用check-once测试条件以验证其有效性
- 如果条件有效,使用适当设置启动live-monitor
- 返回jobid并告知用户如何检查状态或取消
- 如果有webhookurl,设置推送通知
摘要工作流程
- 1. 使用直播流URL和适当的窗口/间隔启动live-digest
- 返回job_id以便用户稍后检查结果
条件编写技巧
- - 表述为二元是/否问题:画面中是否有人可见?
- 具体明确:建筑物屋顶是否有烟雾升起?而非有烟雾吗?
- 每个条件一个意图——不要组合多个检查
- 使用肯定表述:车辆是否可见?而非停车场不是空的吗?
- 在启动live-monitor前始终用check-once测试条件
错误处理
所有错误返回此结构:
json
{
error: {
code: ERROR_CODE,
message: 人类可读的描述,
remediation: 可操作的修复建议
}
}
常见错误代码:
- - NOTLIVESTREAM — URL不是直播流。确认其正在直播。
- STREAMFETCHFAILED — 无法访问直播流。检查URL和网络。
- STREAMOFFLINE — 直播流存在但离线。等待其上线。
- MAXJOBSREACHED — 并发任务过多。使用DELETE /jobs/{id}取消旧任务。
如果遇到错误,始终向用户显示remediation字段——其中包含可操作的指导。
定价参考
$0.02 / 分钟 |
| 实时摘要 | $0.02 / 分钟 |
免费层:在https://console.machinefi.com注册时获得100积分($1.00)
规则
- - 绝不在向用户展示的输出中暴露或记录$TRIOAPIKEY值。
- 始终显示check-on