Camera monitoring
Sample a short clip from a camera and ask whether something happened. Simo sees the frames with their timestamps and answers each question with a calibrated probability, so alerts fire only when it is sure.
from simoai import Client, Fill, Noul, video_file # pip install "simoai[video]"
c = Client()
def check_clip(path: str) -> list[str]:
clip = video_file(path, fps=1.0) # 1 frame per second, at most 32 frames
r = c.ask(
{"camera": "Loading dock, rear door. Only staff in hi-vis vests may enter.", "clip": "<video:1>"},
{
"entered": Noul("A person without a hi-vis vest enters through the door"),
"fall": Noul("Someone falls or is lying on the ground"),
"blocked": Noul("The fire exit is blocked by an object"),
"people": Fill("the largest number of people visible at once", kind="int"),
},
media=[clip],
)
return [name for name in ("entered", "fall", "blocked") if r[name].noul > 0.9]
print(check_clip("dock-2026-10-18-1405.mp4")) # ['entered']{
"model": "simo-1-pro",
"state": {"camera": "Loading dock, rear door. Only staff in hi-vis vests may enter.", "clip": "<video:1>"},
"media": [{"type": "video", "fps": 1.0,
"frames": ["data:image/png;base64,...", "data:image/png;base64,...", "data:image/png;base64,..."]}],
"questions": {
"entered": {"type": "noul", "instructions": "A person without a hi-vis vest enters through the door"},
"fall": {"type": "noul", "instructions": "Someone falls or is lying on the ground"},
"blocked": {"type": "noul", "instructions": "The fire exit is blocked by an object"},
"people": {"type": "fill", "instructions": "the largest number of people visible at once", "kind": "int", "max_tokens": 16}
}
}Good to know
- The service keeps at most 16 frames per video, spread evenly. For a 10-second clip, 1 frame per second is plenty.
- Ask whether something happened, not at which exact frame.
- Describe the scene in the state ("Only staff in hi-vis vests may enter"): rules there make the questions short and precise.
- Frames count toward the 16 pictures per request and the 25 MB body limit. See Limits.