API reference
Reusable media API
Upload private image or video bytes once and reuse content-addressed media IDs.
SDK 0.1.0Private preview
Upload image or video bytes
Send raw bytes to POST /v1/media with an image or video Content-Type. The maximum object size is 256 MiB. The response returns a content-addressed ID; uploading identical content may return the same ID with created: false.
curl --fail-with-body "$OX_API_BASE_URL/v1/media" \
--request POST \
--header "Authorization: Bearer $OX_API_KEY" \
--header "Content-Type: video/mp4" \
--data-binary @inspection.mp4
{
"id": "media_EXAMPLE",
"object": "media",
"content_type": "video/mp4",
"bytes": 1048576,
"created": true
}
Reuse a media ID
Pass one or more IDs at the top level of a chat-completion request. This avoids uploading the same private object before each question.
{
"model": "MODEL_ID",
"media_ids": ["media_EXAMPLE"],
"messages": [{ "role": "user", "content": "Identify the first safety issue." }],
"temperature": 0
}
Check availability without downloading content by sending HEAD /v1/media/{media_id}. A 2xx response means the object exists; 404 means it is unavailable to the current API path.
curl --fail-with-body --head "$OX_API_BASE_URL/v1/media/media_EXAMPLE" \
--header "Authorization: Bearer $OX_API_KEY"