- Asset ID. Upload the file first, then send its asset ID. Uploads take images, video, and audio of up to 5 GiB.
- URL. Send an
httpsURL, and ZeroGen imports it into your Library before it quotes the request. URLs take smaller images and video.
role and exactly one of asset or url. The model’s
request schema lists the roles it takes and the media each accepts; for
details, see Models.
Upload a file
Uploading takes three requests. Each needs theuploads:create scope.
1
Start the upload
Send the file’s name, media type, and size to If you sent
POST /v1/uploads:The response is
201 with status: "upload_required", an upload target,
and a Location header for the upload:sha256 and the project already has an identical file, the
response is 200 with status: "ready" and that file’s assetId, and
you can skip the next two steps.2
Send the bytes
PUT the file’s exact bytes to upload.url with every header in
upload.headers, before expiresAt. The target is valid for 15 minutes.
Don’t send your API key to it.3
Complete the upload
Complete the upload by its ZeroGen verifies the stored file and returns
id, with no request body:status: "ready" with the
assetId to send as an input. If the project already has an identical
file, assetId is that file’s. Completing again returns the same asset.GET /v1/uploads/{id} returns an upload as it stands, without its upload
target. You can read only uploads you started.
When you name a folderId, a ready response from POST /v1/uploads or
POST /v1/uploads/{id}/complete carries a folder object that reports whether
the asset was filed there: filed is true or false, and error explains a
refusal. An upload_required response has no folder object yet. The asset
stays usable either way.
Use a URL as an input
Sendurl in place of asset:
- The URL uses
httpson port 443 and a domain name, and is at most 2,048 characters long. - The file is a PNG, JPEG, or WebP image of up to 50 MiB, or an MP4 or MOV video of up to 100 MiB. ZeroGen checks the type from the file’s bytes, not from its name or headers.
- Each download must finish within 30 seconds.
- Audio inputs can’t be URLs. Upload audio first.
uploads:create scope in addition to
generations:create. Without it, the request fails with
403 permission_denied before ZeroGen downloads anything.
If ZeroGen can’t use a URL, the request fails with 400 input_import_failed,
param names the input, such as inputs[1].url, and nothing is charged. The
error doesn’t say whether a host exists or refused the connection. Your
organization’s URL imports also have rate limits.
Supported files
Uploads accept the following media types:
Each model accepts a subset. Its request schema’s
x-roles lists the media
types for each role, and urlAccept lists the ones a URL input can be.
Test keys
A test key uploads and imports only into its API sandbox project. AprojectId for any other
project returns 404 not_found.