Failura
Modelura so len kipo, video vaj audio prihvatin len ande trin forma. Sakono modelosko lil sikavel lesqe fajlonqe parametra (sar image, images, videos, audios).
1. Jekh publiku URL
Savo https:// (vaj http://) URL so o modelo shaj downloadil:
{ "image": "https://example.com/photos/product.jpg" }
O fajlo trubul te avel resno bi cookies vaj login, thaj te ačhel resno dži o mangipen startisardilo. Sakono modelosko lil sikavel o limitura e fajlongo barehipnasko thaj dimensionongo.
2. Jekh data URI
Tikne fajlo shaj aven inline sar jekh data: URI dži 10 MB:
{ "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." }
Base64 kerel o body ande jekh trito maj baro katar o fajlo, kadaleste preferin uploadura pентru sa so si baro.
3. Jekh upload
Pентru lokalno fajlo, mang jekh upload URL, PUT o bytes odothe, thaj de o palpale-kerdo file_url ko modelo. Keripen e upload URL-esko si bi pais.
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": "..."}'
- Lijarde uploadura:
.jpg,.jpeg,.png,.webp(dži 15 MB) thaj.mp4,.mov,.webm(dži 200 MB). O extension kidel o tipo;content_typetrubul te matchil les. - O upload URL validno si pентru jekh ora. O
file_urlačhel validno. - Pентru audio, labar jekh publiku URL vaj data URI.
Rezultatosqe fajlo
Tu kidel sar dugo te ačhen o rezultatosqe fajlo:
- Vično (
permanent, o standardno): dži tu borrares len, pентru 100 API krediti ($0.10) per GB per minuta, charge-ime jekhvar ande dives katar o API balanso (1 GB = 1024³ bytes). - 7 divesa (
temporary): bi pais, palal borrarime amare arakhipnestar.
Kerdol o standardno le "Astar fajlura sa dživdipe" switch-esa ande dashboard vaj le PATCH /account/storage-esa, thaj override-isar les per run le ?storage=temporary-sa (vaj 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"}'
Sakono mangipen sikavel lesko korkoro storage (mode, bytes, expires_at, expired). O setipen applies ko neve mangipena; fajlo so tu već arakhes vično ačhen dži tu borrares len le DELETE /requests/{id}/files-sa (dikh Mangipena). Kana o API balanso na del te paisol pентru arakhipen, reses email thaj 30 divesa te pheres tiro balanso anglal o arakhade fajlo aven temporary.