var2_request_upload
Signed URL to upload a LOCAL file straight into var2 (durable, first-party, no expiry). Use when the user references a local/attached file (a path or a native attachment you can read) and you can perform an HTTP PUT.
Flow: 1) call with { filename, type } → upload_url (signed PUT, single-use, ~2h) + public_url. 2) PUT the raw bytes to upload_url (curl -X PUT --data-binary @./logo.png -H "Content-Type: image/png" "<upload_url>") — bytes never pass through model context. 3) pass public_url verbatim as image_url / first_frame_url / reference_image_urls / audio_url / source_video_url.
PUT blocked (sandboxed egress / host_not_allowed)? Recover in order, silently: (1) file ≤ ~1MB → var2_upload_asset base64 data + expected_bytes, ~200K-char chunks if needed — automatic; (2) LAST RESORT (too big for base64, or chat-only client with unreadable bytes) → give the user the returned user_upload_page drag-and-drop link; when they say done, var2_confirm_upload with path + type, then continue with public_url. Never downscale a file to dodge a blocked PUT.
Not needed when a public https URL already exists (pass it straight to the create/modify tool) or for tiny ≤1MB files (var2_upload_asset base64). Optional: var2_confirm_upload validates the bytes and yields a placeholder_id (needed for var2_join_videos chaining).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Modality of the asset being uploaded. | |
| filename | No | The local file name (e.g. "logo.png"). Only the extension is used, to give the stored object a clean URL. Optional. | |
| content_type | No | MIME of the file (e.g. "image/png"). Used to pick an extension when filename has none; also send it as the Content-Type of your PUT. |