Primate Intelligence Streams API
The streams API from Primate Intelligence — 4 operation(s) for streams.
The streams API from Primate Intelligence — 4 operation(s) for streams.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/primateintelligence-ai:primateintelligence-ai-streams-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Primate Vision Streams API
version: 1.0.0-alpha
description: Public API v1 for Primate Vision — video understanding for the agentic web. P1 (PRI-430) publishes resource schemas; endpoints ship from P3 onward.
contact:
email: support@primateintelligence.ai
servers:
- url: https://api.primateintelligence.ai
description: Production
- url: https://dev-api.primateintelligence.ai
description: Development
tags:
- name: Streams
paths:
/v1/streams:
post:
summary: Create a real-time analysis stream
description: 'Returns the signaling WS URL, ephemeral ICE servers, and session limits. Signaling protocol v1: join → ready|queued(position) → offer/answer/ice → live; mid-stream update_prompt {prompt} (client→server; server confirms with prompt_updated), metering (5s ticks), warning, end {reason}. WS auth: ?token= accepts a client token (pvct_) or first-party session JWT — never a secret key. Billed per second of live clock time (join/negotiation free) from the same credit ledger as uploads. options.narrative: true adds (a) a narrative_update object ({t_s, text}) to result-frame detections whenever the engine emits a new sentence — event-driven, absent otherwise — and (b) an additive server→client status event {type: "status", status: "prompt_context"|"combined_prompt"|"recalculating", message?} for ordering/annotating narrative entries (closed vocabulary; non-opted-in streams never receive status events). No extra cost.'
tags:
- Streams
security:
- bearerAuth: []
parameters:
- name: Idempotency-Key
in: header
required: false
schema:
type: string
minLength: 1
maxLength: 255
description: '§16.1: first request wins; 24h replay window; same key + different body → 409 idempotency_key_reused.'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateStreamRequest'
responses:
'201':
description: Stream created (queued or ready). Response carries signaling.url + ice_servers + limits.
content:
application/json:
schema:
$ref: '#/components/schemas/Stream'
'400':
description: validation_failed / url_forbidden / prompt errors (§15)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'401':
description: invalid_api_key / key_revoked / key_expired
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'402':
description: insufficient_credits — positive balance required.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'404':
description: resource_not_found (account-scoped; no existence oracle)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'409':
description: stream_already_active — one queued|ready|live stream per account (also the un-keyed-retry guard, §31-F2) / idempotency_key_reused.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'429':
description: rate_limit_exceeded / concurrency_limit_exceeded / quota_exceeded (always with Retry-After)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'503':
description: capacity_exhausted (with Retry-After) — slot queue beyond the hard cap.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
operationId: postV1Streams
x-operation-id-source: derived
get:
summary: List streams (cursor pagination, created_at desc)
tags:
- Streams
security:
- bearerAuth: []
parameters:
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 100
default: 20
- name: starting_after
in: query
schema:
type: string
description: Cursor — mutually exclusive with ending_before.
- name: ending_before
in: query
schema:
type: string
- name: status
in: query
schema:
type: string
- name: created_after
in: query
schema:
type: string
format: date-time
- name: created_before
in: query
schema:
type: string
format: date-time
- name: status
in: query
schema:
type: string
enum:
- queued
- ready
- live
- ended
responses:
'200':
description: List envelope (§13.4).
content:
application/json:
schema:
$ref: '#/components/schemas/StreamList'
'400':
description: validation_failed / url_forbidden / prompt errors (§15)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'401':
description: invalid_api_key / key_revoked / key_expired
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'404':
description: resource_not_found (account-scoped; no existence oracle)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'409':
description: resource_conflict / idempotency_key_reused / idempotency_unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'429':
description: rate_limit_exceeded / concurrency_limit_exceeded / quota_exceeded (always with Retry-After)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
operationId: getV1Streams
x-operation-id-source: derived
/v1/streams/{id}:
get:
summary: Fetch a stream (usage + results summary once ended)
tags:
- Streams
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: The stream. Terminal streams carry usage {billed_seconds, credit_balance_after} + duration_s + results_summary.
content:
application/json:
schema:
$ref: '#/components/schemas/Stream'
'400':
description: validation_failed / url_forbidden / prompt errors (§15)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'401':
description: invalid_api_key / key_revoked / key_expired
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'404':
description: resource_not_found (account-scoped; no existence oracle)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'409':
description: resource_conflict / idempotency_key_reused / idempotency_unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'429':
description: rate_limit_exceeded / concurrency_limit_exceeded / quota_exceeded (always with Retry-After)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
operationId: getV1StreamsById
x-operation-id-source: derived
/v1/streams/{id}/recording:
get:
summary: Fetch the session recording (signed URL, sign-on-read)
description: 'PRI-496: returns a signed playback URL for the server-side session recording. Requires the stream to have been created with recording: true and to have ended with a stored recording. 404 resource_not_found when recording was not enabled; 409 resource_conflict while the stream is still active, when capture failed, or when no recording was stored. URL TTL 1h — re-fetch for a fresh one.'
tags:
- Streams
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Signed recording URL.
content:
application/json:
schema:
$ref: '#/components/schemas/StreamRecording'
'400':
description: validation_failed / url_forbidden / prompt errors (§15)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'401':
description: invalid_api_key / key_revoked / key_expired
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'404':
description: resource_not_found (account-scoped; no existence oracle)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'409':
description: resource_conflict / idempotency_key_reused / idempotency_unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'429':
description: rate_limit_exceeded / concurrency_limit_exceeded / quota_exceeded (always with Retry-After)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
operationId: getV1StreamsByIdRecording
x-operation-id-source: derived
/v1/streams/{id}/end:
post:
summary: End a stream (idempotent)
description: 'Graceful end: settles the credit reservation for the billed live-clock seconds (releases it entirely when the stream never went live). Ending an already-ended stream returns the terminal resource unchanged.'
tags:
- Streams
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: The ended stream with final usage.
content:
application/json:
schema:
$ref: '#/components/schemas/Stream'
'400':
description: validation_failed / url_forbidden / prompt errors (§15)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'401':
description: invalid_api_key / key_revoked / key_expired
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'404':
description: resource_not_found (account-scoped; no existence oracle)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'409':
description: resource_conflict / idempotency_key_reused / idempotency_unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'429':
description: rate_limit_exceeded / concurrency_limit_exceeded / quota_exceeded (always with Retry-After)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
operationId: postV1StreamsByIdEnd
x-operation-id-source: derived
components:
schemas:
Stream:
type: object
properties:
id:
type: string
pattern: ^st_[0-9A-HJKMNP-TV-Z]{26}$
description: Stream resource id (prefixed ULID). P6 §4.8.
example: st_01KX12XX3BNM688AWHX7406HCF
object:
type: string
enum:
- stream
status:
$ref: '#/components/schemas/StreamStatus'
metering_rule:
allOf:
- $ref: '#/components/schemas/MeteringRule'
- description: 'PRI-552: settlement rule pinned at create time. Streams created before the cutover report per_second.'
end_reason:
$ref: '#/components/schemas/StreamEndReason'
prompt:
type:
- string
- 'null'
minLength: 1
maxLength: 2000
query:
type:
- object
- 'null'
additionalProperties: {}
model:
type: string
example: Darwin-preview-1.3B
queue_position:
type:
- integer
- 'null'
minimum: 1
estimated_start_s:
type:
- integer
- 'null'
minimum: 0
signaling:
$ref: '#/components/schemas/StreamSignaling'
ice_servers:
type:
- array
- 'null'
items:
type: object
additionalProperties: {}
limits:
$ref: '#/components/schemas/StreamLimits'
duration_s:
type:
- integer
- 'null'
minimum: 0
description: Live-clock duration. Terminal only.
results_summary:
type:
- object
- 'null'
additionalProperties: {}
description: 'Terminal summary: {result_frames, frames (deprecated alias of result_frames — removed ~2026-08-28), last_detections}. result_frames counts result EVENTS emitted (results are sampled, not per-source-frame). Detection rows use the same enums/casing as the file-API result contract (answer: yes|no|indeterminate, lowercase; prompt echoed exactly as submitted).'
failure_diagnostic:
type:
- object
- 'null'
additionalProperties: {}
description: 'Present when end_reason is ice_failed (and some media_timeout cases): ICE candidate summary from the server side — {local_candidates: string[], hint}. Use it to distinguish "server advertised only private/host candidates" from "client could not reach relay".'
recording:
$ref: '#/components/schemas/StreamRecordingState'
usage:
$ref: '#/components/schemas/StreamUsage'
metadata:
type: object
additionalProperties:
type: string
maxLength: 500
default: {}
description: Free-form key/value metadata. ≤16 keys, key ≤40 chars [a-zA-Z0-9_.-], value ≤500 chars.
created_at:
type: string
format: date-time
example: '2026-07-08T14:00:00Z'
live_started_at:
type:
- string
- 'null'
format: date-time
example: '2026-07-08T14:00:00Z'
ended_at:
type:
- string
- 'null'
format: date-time
example: '2026-07-08T14:00:00Z'
required:
- id
- object
- status
- end_reason
- prompt
- query
- model
- queue_position
- estimated_start_s
- signaling
- ice_servers
- limits
- duration_s
- results_summary
- failure_diagnostic
- usage
- created_at
- live_started_at
- ended_at
description: A real-time analysis stream (§4.8).
StreamLimits:
type:
- object
- 'null'
properties:
max_session_s:
type: integer
exclusiveMinimum: 0
description: Plan entitlement (max_session_s) — hard session cutoff.
warn_at_remaining_s:
type: integer
exclusiveMinimum: 0
description: The `warning {remaining_s}` threshold surfaced mid-stream.
required:
- max_session_s
- warn_at_remaining_s
StreamRecordingState:
type:
- object
- 'null'
properties:
status:
type: string
enum:
- recording
- available
- failed
- none
required:
- status
description: 'PRI-496: recording state — null unless the stream opted in with recording: true at create.'
ErrorObject:
type:
- object
- 'null'
properties:
code:
type: string
example: video_unreadable
message:
type: string
required:
- code
- message
StreamEndReason:
type:
- string
- 'null'
enum:
- completed
- canceled
- insufficient_credits
- error
- timeout
- ice_failed
- media_timeout
description: Why the stream ended. completed — normal end after live. canceled — ended before going live (client action). insufficient_credits — balance exhausted. error — server-side failure. timeout — max_session_s cutoff. ice_failed — WebRTC ICE never connected (see failure_diagnostic). media_timeout — connected but no media/results within the first-frame window. A stream that never went live is never `completed`.
StreamSignaling:
type:
- object
- 'null'
properties:
url:
type: string
description: 'Versioned signaling WS. Auth: ?token= accepts a client token (pvct_) or first-party Clerk JWT — NEVER a secret key.'
example: wss://api.primateintelligence.ai/v1/streams/st_01KX…/signal
expires_at:
type: string
format: date-time
example: '2026-07-08T14:00:00Z'
required:
- url
- expires_at
description: Present while the stream is joinable; null once ended.
StreamUsage:
type:
- object
- 'null'
properties:
billed_seconds:
type: integer
minimum: 0
description: 'Settled ledger amount. per_frame streams (PRI-552, the default): derived from the processed-frame count. Historical per_second streams: LIVE-clock derived (join/negotiation free).'
credit_balance_after:
type:
- integer
- 'null'
metering_rule:
allOf:
- $ref: '#/components/schemas/MeteringRule'
- description: 'PRI-552: the rule this stream settled under. Mirrors the top-level metering_rule for a self-contained terminal summary.'
frames:
type:
- integer
- 'null'
minimum: 0
description: 'PRI-552: processed-frame count (results_summary.result_frames). Present for both metering rules — frame counting predates the billing cutover; null when unknown.'
required:
- billed_seconds
- credit_balance_after
description: Terminal only. Same ledger as uploads — one balance.
ErrorEnvelope:
type: object
properties:
error:
allOf:
- $ref: '#/components/schemas/ErrorObject'
- type: object
properties:
status:
type: integer
required:
- status
required:
- error
CreateStreamRequest:
type: object
properties:
prompt:
type: string
minLength: 1
maxLength: 2000
description: Free text — compiled server-side. Exactly one of prompt/query.
query:
type: object
additionalProperties: {}
description: Structured CompiledQuery JSON.
model:
type: string
example: Darwin-preview-1.3B
options:
type: object
properties:
narrative:
type: boolean
default: false
description: 'narrative: true — opt into live narrative. Result-frame detections then carry a narrative_update object ({t_s, text}) whenever the engine produces a new sentence (event-driven, not per frame; absent on frames without one). Included in the metered price — no surcharge.'
recording:
type: boolean
description: 'PRI-496: true — opt into retrieval of the server-side session recording. The ended stream then carries recording: {status} and GET /v1/streams/{id}/recording returns a signed 1h playback URL (raw H.264 elementary stream; lossless remux: ffmpeg -i in.h264 -c copy out.mp4). Default false.'
metadata:
type: object
additionalProperties:
type: string
maxLength: 500
description: Free-form key/value metadata. ≤16 keys, key ≤40 chars [a-zA-Z0-9_.-], value ≤500 chars.
webhook:
type: object
properties:
url:
type: string
format: uri
events:
type: array
items:
type: string
required:
- url
- events
description: Per-request webhook override (delivery ships P7). Write-only.
description: Requires positive credit balance. One queued|ready|live stream per account by default (409 stream_already_active otherwise).
StreamList:
type: object
properties:
object:
type: string
enum:
- list
data:
type: array
items:
$ref: '#/components/schemas/Stream'
has_more:
type: boolean
required:
- object
- data
- has_more
StreamRecording:
type: object
properties:
object:
type: string
enum:
- stream_recording
stream_id:
type: string
pattern: ^st_[0-9A-HJKMNP-TV-Z]{26}$
description: Stream resource id (prefixed ULID). P6 §4.8.
example: st_01KX12XX3BNM688AWHX7406HCF
url:
type: string
format: uri
description: Signed playback URL — fresh on every GET, 1h TTL. Re-fetch for a new one.
expires_at:
type: string
description: RFC 3339 expiry of the signed URL.
content_type:
type: string
enum:
- video/h264
container:
type: string
enum:
- h264-annex-b
description: 'Raw H.264 Annex-B elementary stream. Lossless remux to MP4: ffmpeg -i in.h264 -c copy out.mp4.'
required:
- object
- stream_id
- url
- expires_at
- content_type
- container
MeteringRule:
type: string
enum:
- per_second
- per_frame
description: 'PRI-552: settlement rule pinned at admission. Resources created before the cutover report per_second.'
StreamStatus:
type: string
enum:
- queued
- ready
- live
- ended
description: 'Stream lifecycle state (§4.8): queued → ready → live → ended. Terminal immutable.'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: API key (pv_live_… / pv_test_…). Clerk session JWTs are accepted on the same endpoints for first-party clients.