Sozdai LogoDocs
Docs/Image/Texte vers image

Nano Banana Pro· Texte vers image

Texte vers image
POSThttps://api.foxwire.ai/v1/media/generations

#Soumettre une tâche

La génération de médias est asynchrone : vous obtenez immédiatement un identifiant de tâche, sans attendre.

bash
curl https://api.foxwire.ai/v1/media/generations \
  -H "Authorization: Bearer $CORRY_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "nano-banana-pro", "prompt": "a cute robot mascot, flat vector logo" }'
# → { "id": "cmus7q0x9000108l3f5g2abcd", "status": "queued" }

#Paramètres de la requête

ParamètreTypeObligatoirePar défautDescription
promptstringOui
Text prompt describing the image to generate (max 20000 chars).
image_inputstring[]Non
Optional reference/source image URLs to transform (max 8, ≤30MB each; jpeg/png/webp).
aspect_ratiostringNon1:1
Aspect ratio of the output image.
Options: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, auto
resolutionstringNon1K
Output resolution. Higher resolutions take longer to generate.
Options: 1K, 2K, 4K
output_formatstringNonpng
Format of the output image.
Options: png, jpg
callback_urlstringNon
Optional public http(s) URL. We POST the task result here the moment generation finishes (success or failure).

#Poll for the result

Generation runs asynchronously — the submit call returns immediately with a task id. Poll this endpoint with that id every few seconds until status becomes succeeded (result ready) or a terminal error (failed / timeout).

GEThttps://api.foxwire.ai/v1/media/generations/{id}
bash
# take the id from the submit response, then poll every ~3s
curl https://api.foxwire.ai/v1/media/generations/cmus7q0x9000108l3f5g2abcd \
  -H "Authorization: Bearer $CORRY_KEY"
# repeat until "status" is "succeeded" (or "failed" / "timeout")

#Exemple de réponse

À la soumission

json
{
  "id": "cmus7q0x9000108l3f5g2abcd",
  "status": "queued",
  "type": "image",
  "model": "nano-banana-pro"
}

En cas de succès (après interrogation)

json
{
  "id": "cmus7q0x9000108l3f5g2abcd",
  "status": "succeeded",
  "type": "image",
  "model": "nano-banana-pro",
  "result": { "urls": ["https://cdn.sozdai.ai/image/1782537315223-b49c0c1b771f.png"] },
  "cost": "0.0500",
  "currency": "USD"
}

Champs de réponse

ChampTypeDescription
statusstringStatut de la tâche : queued / submitted / succeeded / failed / timeout.
typestringType de média : image / video / music.
modelstringLe modèle que vous avez demandé.
resultobjectPrésent en cas de succès. result.urls est un tableau d'URL de fichiers permanentes.
errorstringMessage d'erreur, présent lorsque la tâche a échoué.
coststringMontant facturé pour cette tâche — une chaîne en USD (ex. "0.1200"). Voir le champ currency.
currencystringCurrency of cost — always "USD".