PixMind Docs
API Guides

Temporary Media Uploads

Stage reliable image, video, and audio inputs on PixMind R2 and clean them up with the generation task.

Use temporary media uploads for image-to-image, image-to-video, first/last-frame, and reference-media requests. This is recommended for local files and third-party URLs that may be slow, private, or block model-provider datacenter IPs.

1. Request a presigned upload

Send the exact file name, MIME type, and byte size. Files may be up to 200 MB.

FILE="./first-frame.png"

LEASE=$(curl https://aihub-admin.aimix.pro/api-platform/v1/files/presign \
  -H "Authorization: Bearer $PIXMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"fileName\":\"first-frame.png\",\"contentType\":\"image/png\",\"fileSize\":$(wc -c < \"$FILE\")}")

UPLOAD_URL=$(echo "$LEASE" | jq -r '.data.uploadUrl')
FILE_URL=$(echo "$LEASE" | jq -r '.data.fileUrl')
UPLOAD_ID=$(echo "$LEASE" | jq -r '.data.uploadId')

The upload URL is valid for 15 minutes. fileUrl is the URL to pass to the generation API.

2. PUT the file bytes

The Content-Type must match the value used to request the lease.

curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: image/png" \
  --data-binary "@$FILE"

3. Create the generation task

Use fileUrl in the appropriate media field. Include temporaryUploadIds for explicit ownership validation; matching temporary URLs are also detected automatically.

curl https://aihub-admin.aimix.pro/api-platform/v1/generations \
  -H "Authorization: Bearer $PIXMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"type\": \"video\",
    \"model\": \"minimax-h3\",
    \"prompt\": \"A slow cinematic camera push-in\",
    \"firstFrameUrl\": \"$FILE_URL\",
    \"temporaryUploadIds\": [$UPLOAD_ID],
    \"duration\": 5,
    \"resolution\": \"1080p\"
  }"

Lifecycle and limits

  • A temporary upload can be bound to only one generation task and must belong to the current API key user and application.
  • Before task creation, PixMind verifies that the object exists and that its actual size matches fileSize.
  • The R2 object is deleted after the task reaches ready or failed.
  • An upload that is never used is deleted after 24 hours.
  • Supported inputs are common image/*, video/*, and audio/* media files.
  • Do not pass the presigned uploadUrl to a model. Use fileUrl.

On this page