Files
Models that take images, video or audio accept them in any of three forms. Each model page marks its file
parameters (for example image, images, videos, audios).
1. A public URL
Any https:// (or http://) URL that the model can download:
{ "image": "https://example.com/photos/product.jpg" }
The file must be reachable without cookies or login, and stay reachable until the request has started. Each model page lists the size and dimension limits of its file parameters.
2. A data URI
Small files can go inline as a data: URI of up to 10 MB:
{ "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." }
Base64 makes the body about a third larger than the file, so prefer uploads for anything big.
3. An upload
For local files, ask for an upload URL, PUT the bytes there, and pass the returned file_url to the model.
Creating the upload URL is free.
curl -X POST "https://api.doitong.com/v1/files" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filename": "product.jpg", "content_type": "image/jpeg", "size": 482113}'
{
"object": "upload",
"upload_url": "https://…signed upload URL…",
"file_url": "https://content.doitong.com/…/product.jpg",
"method": "PUT",
"headers": { "Content-Type": "image/jpeg" },
"content_type": "image/jpeg",
"expires_in": 3600,
"max_bytes": 15728640
}
curl -X PUT "<upload_url>" -H "Content-Type: image/jpeg" --data-binary @product.jpg
curl -X POST "https://api.doitong.com/v1/run/{model_id}?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image": "https://content.doitong.com/…/product.jpg", "prompt": "..."}'
- Supported uploads:
.jpg,.jpeg,.png,.webp(up to 15 MB) and.mp4,.mov,.webm(up to 200 MB). The extension sets the type;content_typemust match it. - The upload URL is valid for one hour. The
file_urlstays valid. - For audio, use a public URL or a data URI.
Output files
You choose how long output files are kept:
- Forever (
permanent, the default): until you delete them, for 100 API credits ($0.10) per GB per month, charged once a day from the API balance (1 GB = 1024³ bytes). - 7 days (
temporary): free, then deleted from our storage.
Set the default with the "Keep files forever" switch in the dashboard or with
PATCH /account/storage, and override it per run with ?storage=temporary (or permanent):
curl -X PATCH "https://api.doitong.com/v1/account/storage" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mode": "temporary"}'
Each request shows its own storage (mode, bytes, expires_at, expired). The setting applies to new requests;
files you already keep forever stay until you delete them with DELETE /requests/{id}/files (see
Requests). If the API balance cannot pay for storage, you get an email
and 30 days to top up before kept files become temporary.