Upload a file (path or base64) to Replicate
replicate_upload_fileUpload a file to Replicate storage by absolute local path or base64 data and receive a temporary URL (valid ~24h) to use as model input.
Instructions
Upload a file to Replicate's file storage and get back a URL valid for ~24 hours. Pass the returned URL as a model input (e.g. image for upscale/inpaint/vision, image_url for video, reference_audio_url for voice clone).
Two input modes — provide EXACTLY ONE:
file_path: absolute local path of a file on the machine running the server.
base64_data: the file's bytes as base64 (a bare base64 string OR a full "data:;base64,..." URI). Use this when you hold bytes in memory but have no local path — e.g. an image a user dropped into the chat that a code container can read and base64-encode. NOTE: an MCP client (Claude Desktop) generally cannot reproduce a large dragged-in image's exact bytes as a tool argument — base64 mode is for callers that genuinely have the bytes (web container, programmatic clients).
Args:
file_path (string, optional): Absolute local path. Provide this OR base64_data.
base64_data (string, optional): base64 contents or data: URI. Provide this OR file_path.
mime_type (string, optional): MIME override (e.g. 'image/png'). Auto-detected from the path extension or a data: URI; defaults to application/octet-stream for raw base64.
file_name (string, optional): Name for a base64 upload.
Returns structuredContent: { url, file_id, name }
url: Replicate-hosted URL (~24h expiry) — pass this as a model input.
Examples:
file_path="C:/Users/me/photo.png"
base64_data="data:image/png;base64,iVBORw0KG...", → uploads, returns URL
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_name | No | Optional name for a base64 upload. Ignored when file_path is used (the basename is taken from the path). | |
| file_path | No | Absolute local path of the file to upload. Provide either this OR base64_data. | |
| mime_type | No | MIME type override (e.g. 'image/png'). Auto-detected from file extension (file_path) or the data URI; defaults to application/octet-stream for raw base64. | |
| base64_data | No | File contents as base64 (a bare base64 string or a full 'data:<mime>;base64,...' URI). Use this when you have bytes in memory but no local path — e.g. a code container that read a chat-uploaded image. Provide either this OR file_path. |