Integrationsanleitungen
Aufgaben-Lebenszyklus
Ablauf einer Anfrage
- 1Create
Partner sends X-API-Key plus task parameters to a B2B create endpoint.
- 2Authenticate
Backend validates the API key and attaches the owning user plus optional billing account.
- 3Freeze credits
Worker calculates cost and freezes credits from the dedicated account or user credit pool.
- 4Execute
The selected worker calls internal or external generation capability and stores task output.
- 5Get result
Partner polls /tasks/get or /tasks/get_result until the task is completed or failed.
- 6Webhook
If webhook_url is supported and provided, backend POSTs the final task payload and settles credits.
Antwortstruktur
HTTP-Status und Antwort prüfen. code=0 bestätigt die Anfrage; Generierung erst bei data.status=COMPLETED erfolgreich. Auch FAILED kann code=0 haben.
JSON
{
"code": 0,
"message": "Success",
"data": {
"task_id": "00000000-0000-0000-0000-000000000000",
"status": "PENDING",
"queue_position": 2,
"generation_params": {
"prompt": "anime engineer debugging an API dashboard",
"watermark": false
}
}
}JSON
{
"code": 0,
"message": "Success",
"data": {
"task_id": "00000000-0000-0000-0000-000000000000",
"status": "FAILED",
"error_message": "Generation failed"
}
}