/generationsCreate a generation
Starts a generation and returns it at once with status queued. The cost is charged when the request is accepted and refunded in full if the generation fails or is canceled; a result with fewer outputs than params.count refunds the missing share.
The work runs in the background. Poll GET /generations/{id} until status is succeeded, failed or canceled, then download each outputs[].url. There are no webhooks.
Send an Idempotency-Key header to make retries safe: repeating the same request with the same key returns the original generation (200, Idempotent-Replayed: true) and charges nothing more. The same key with a different request is a 409.
By default an account can have 4 generations in progress at once (too_many_active); the limit is details.limit.
For a picture or a clip the prompt and the negative prompt have no length limit. The only bound is the size of the body: 2 MiB by default (the deployment can change it with MAX_GENERATION_BODY_MB), answered with 413 payload_too_large before anything is read. A model's provider may still refuse a very long prompt (limits.providerPromptChars of GET /models says how long it documents); the generation then ends as failed with error.code prompt_too_long, and the cost is refunded in full.
Sound and transcripts use the same endpoint. text-to-speech reads prompt as the script, sound-effects and music as the description of the sound; speech-to-speech and speech-to-text work on a recording you uploaded (inputAssetId, an audio asset) and take no prompt (send none, or an empty one).
A sound model prices by a unit (pricing.type is metered) and the price is known before anything is charged: the characters of the script, the seconds you choose with params.durationSec, or the length of your recording as the server measured it, never as the file claims. limits.maxInputChars and limits.maxInputSec are enforced: a longer text is a 422 out_of_range and a longer recording is refused, in both cases before anything is charged.
params.voiceId must be one of the curated voices of the model’s provider (a 422 not_allowed otherwise); left out, the first voice is used. There is no voice cloning. params.speed, params.tone and params.pitch are accepted only by a model that lists limits.speed, limits.tones and limits.pitch (a 422 unsupported otherwise), within the model’s own range. A tone fills in the speed and stability you leave out; on a model with limits.toneTags it is also written as an audio tag ahead of your script, which is priced and capped like the script. For speech to speech, params.rightsConfirmed: true confirms you may use an uploaded recording. The results of sound, transcripts and montage exports are private: isPublic: true is a 422 for them.
الترويسات
| الحقل | النوع | الوصف |
|---|---|---|
| Idempotency-Key | string | Makes a retry safe: 1 to 128 visible ASCII characters, unique per request you intend to make once (a UUID works). The same key with the same request returns the original generation; with a different request it is a 409. example "0b7f3c52-8f3e-4a52-9a5e-3c1d6f5c9e10" |
جسم الطلب application/json
What to create.
| الحقل | النوع | الوصف |
|---|---|---|
| toolمطلوب | string | The tool to run. The model must serve it (see إحدى القيم |
| modelIdمطلوب | string | A model whose 1 to 100 characters |
| prompt | string | What to create: the picture or clip prompt, the script (text to speech) or the description of the sound (sound effects, music). Required, except for speech-to-speech and speech-to-text, which work on their recording alone and take none. For a picture or a clip there is no limit on its length: the only bound is the size of the request body (2 MiB by default, a 413 above it), and a model's provider may still refuse a very long prompt (see |
| negativePrompt | string | What to avoid, with no length limit either. Only models with |
| params | object | Optional settings. What you leave out takes the model default; a value the model does not allow is a 422, never silently changed. |
| params.aspectRatio | string | One of the model's إحدى القيم |
| params.count | integer | How many images. At most the model's 1 to 8 |
| params.durationSec | integer | Length in seconds, one of the model's 1 to 600 |
| params.resolution | string | One of the model's إحدى القيم |
| params.seed | integer | Repeats a result. Only models with 0 to 4294967295 |
| params.strength | number | How far image-to-image may stray from the input, 0 to 1. Only models with 0 to 1 |
| params.voiceId | string | A voice of the model's provider, from the curated list of voices. 1 to 100 characters |
| params.speed | number | Text to speech: how fast the voice reads. 1 is the voice's own pace. Only within the model's 0.5 to 2 |
| params.stability | number | Text to speech: 0 lively to 1 even. Left out, the voice uses its own. 0 to 1 |
| params.tone | string | Text to speech: the delivery, one of the model's إحدى القيم |
| params.pitch | number | Text to speech: semitones deeper (negative) or higher than the voice's own, on the grid of the model's -12 to 12 |
| params.language | string | A lower-case ISO 639-1 code from the model's |
| params.instrumental | boolean | Music without singing. Default true. |
| params.loop | boolean | Sound effects: a sound that repeats without a seam. |
| params.rightsConfirmed | boolean | Speech to speech: you confirm you have the right to use the recording you uploaded. Required |
| inputAssetId | string | Required by image-to-image and image-to-video (an image you uploaded with |
| inputAssetIds | string[] | Several pictures, in order, for image-to-image or image-to-video with a model whose 1 to 6 items |
| isPublic | boolean | List the results on the public Explore feed. Default false. Always false for sound, transcripts and montage exports, which are private: |
{ "tool": "text-to-image", "modelId": "aivore-demo-image", "prompt": "A lighthouse at dawn, soft fog, cinematic", "params": { "aspectRatio": "16:9" }}مثال على الطلب
curl -X POST "https://aivoraai.space/api/v1/generations" \ -H "Authorization: Bearer $AIVORA_API_KEY" \ -H "Idempotency-Key: 0b7f3c52-8f3e-4a52-9a5e-3c1d6f5c9e10" \ -H "Content-Type: application/json" \ -d '{ "tool": "text-to-image", "modelId": "aivore-demo-image", "prompt": "A lighthouse at dawn, soft fog, cinematic", "params": { "aspectRatio": "16:9" } }'الاستجابات
200OKA replay of an earlier request with the same Idempotency-Key: the original generation, nothing charged.
تُرجع Generation
{ "data": { "id": "gen_01k8m3x9q2v7c5n4h6j0t1r8we", "tool": "text-to-image", "kind": "image", "modelId": "aivore-demo-image", "prompt": "A lighthouse at dawn, soft fog, cinematic", "params": { "aspectRatio": "16:9", "count": 1 }, "status": "queued", "progress": 0, "cost": 1, "outputs": [], "isPublic": false, "isFavorite": false, "createdAt": 1760000000000 }}201CreatedAccepted and queued. Location is the path of the new generation.
تُرجع Generation
{ "data": { "id": "gen_01k8m3x9q2v7c5n4h6j0t1r8we", "tool": "text-to-image", "kind": "image", "modelId": "aivore-demo-image", "prompt": "A lighthouse at dawn, soft fog, cinematic", "params": { "aspectRatio": "16:9", "count": 1 }, "status": "queued", "progress": 0, "cost": 1, "outputs": [], "isPublic": false, "isFavorite": false, "createdAt": 1760000000000 }}الأخطاء
- 400
bad_requestThe body is not valid JSON.
- 401
unauthorizedNo valid API key or session.
- 402
insufficient_creditsThe balance does not cover the cost. Nothing was charged.
- 403
email_not_verifiedWhere email confirmation is required, the account has not confirmed its address yet. A cookie-authenticated request without a matching
Originis also a 403 (forbidden). - 404
not_foundThe
inputAssetIddoes not exist, is not yours, or is not of the kind the tool takes: a picture for image-to-image and image-to-video, a recording for speech-to-speech and speech-to-text. - 409
conflictThe model is not configured on this deployment (
details.reasonismodel_unavailable), or theIdempotency-Keywas used for a different request (idempotency_key_reused). - 413
payload_too_largeThe body is larger than 2 MiB.
- 415
unsupported_media_typeThe request has no
Content-Type: application/jsonheader. - 422
validation_failedThe request is not valid (
validation_failed, every problem listed indetails.issues), or the prompt goes against the content policy (moderation_blocked,details.category). Nothing is charged. - 429
too_many_activeThe rate limit is spent (
rate_limited), or too many of your generations are running (too_many_active,details.limit). - 503
service_busyThe platform is not accepting new paid generations for a while.
details.retryAfterSecandRetry-Aftersay when to retry.



