Skip to content

AI2Face API: generate images, video, voiceovers and music

In short

The AI2Face API runs the same generations as the web app: images, video, voiceovers and music on the models of your plan. It's available on any paid plan: create a key in the API section of your account, submit a job and poll its status — the finished file comes back as a link. Credits are charged at generator prices, and results appear in your feed.

Contents

Quick start

  1. Get any paid plan and open the API section of your account.
  2. Create a key and save it: the full key is shown only once.
  3. Submit a job and poll its status until it finishes.
export AI2FACE_API_KEY="a2f_..."

curl -X POST https://ai2face.com/api/v1/images \
  -H "X-Api-Key: $AI2FACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "An astronaut cat with Earth in the background, cinematic lighting", "aspect_ratio": "16:9"}'

The response contains the job ID and its status URL:

{
  "success": true,
  "data": {
    "jobs": [{ "id": 16201, "status": "pending", "status_url": "https://ai2face.com/api/v1/jobs/16201" }],
    "cost": 3,
    "credits_charged": 3,
    "credits": 581,
    "queue_limit": 10,
    "asset_ids": []
  }
}
curl https://ai2face.com/api/v1/jobs/16201 -H "X-Api-Key: $AI2FACE_API_KEY"

When job.status becomes completed, result.url holds a link to the finished image.

Key and access

The API base URL is https://ai2face.com/api/v1. Send the key with every request in one of two ways:

  • the X-Api-Key: a2f_... header;
  • the Authorization: Bearer a2f_... header.

A key is tied to your account: generations run on its behalf, credits are charged to its balance, and results go to its feed. You can create, name and delete keys in the API section of your account, up to 10 keys at a time. A deleted key stops working immediately.

The API is available on any paid plan. Without one, requests get 403 with errors.plan = ["required"], and your keys are not deleted.

Keep the key on your server: anyone can see it in page or mobile app code.

Requests and responses

  • The request body is JSON (Content-Type: application/json) or multipart/form-data when you need to send files. The fields are the same; arrays in multipart are sent as reference_ids[].
  • Field names are snake_case, dates are ISO 8601 in UTC (2026-11-25T08:06:37Z).
  • A successful response: {"success": true, "data": {...}}. An error: {"success": false, "message": "...", "errors": {...}} with an HTTP code from the “Errors and limits” section.
  • Error messages are always in English; Accept-Language doesn’t affect them. Build your integration logic on the HTTP code and the fields in errors.

How generation works

Generation is asynchronous. The POST /images, /videos, /audio and /music endpoints queue jobs and respond 202 right away:

Field Meaning
jobs Queued jobs: id, status and status_url for polling
cost Price of one generation in credits
credits_charged Charged for the whole request: cost × number of jobs
credits Balance after the charge
queue_limit How many jobs your plan keeps in the queue at once
asset_ids Files uploaded with the request (you can reuse them)

batch_size runs several variations in one request. If the queue is almost full, you get fewer jobs than requested — rely on the length of jobs.

Job status — GET /jobs/{id}:

job.status Meaning
pending Waiting in the queue
processing Generating
completed Done, the result is in result
failed Failed, the reason is in job.error_code, credits are refunded

You can cancel a pending job: DELETE /jobs/{id} refunds the credits. A job that is already generating can’t be canceled (409). A failed job disappears from the feed after DELETE.

Models and prices

GET /models returns the generator’s models with prices and parameters; ?type=image|video|audio|music keeps one type.

curl "https://ai2face.com/api/v1/models?type=image" -H "X-Api-Key: $AI2FACE_API_KEY"
{
  "id": "gpt-image-2.6-flare",
  "name": "GPT Image 2.6 Flare",
  "type": "image",
  "is_available": true,
  "reference_images_limit": 5,
  "aspect_ratios": ["auto", "1:1", "3:2", "2:3", "4:3", "3:4", "16:9", "9:16", "21:9"],
  "resolutions": ["1K", "2K", "4K"],
  "credits_by_resolution": { "1K": 2, "2K": 3, "4K": 4 },
  "image_options": { "qualities": ["auto", "low", "medium", "high"], "backgrounds": ["auto", "opaque", "transparent"] }
}
  • id is the value of the model field in generation requests. Without model, your plan’s default model is used (defaults).
  • is_available: false means the model is in the catalog but not open to your plan.
  • Instead of resolutions, video models describe a video object (modes, durations, per-second prices), audio models an audio object, music models a music object.
  • voices lists the voices for voiceovers.

The catalog changes: models are added, and new versions get new IDs. Take IDs from /models instead of hardcoding them forever.

Input images and video

References, frames and source videos can be passed in two ways, which you can combine:

  1. As files in multipart/form-data: the images[] field for references; first_frame, last_frame, source_video for video.
  2. As IDs from your account:
    • reference_ids — assets: uploads, locations, clothing, poses (GET /assets, POST /assets);
    • image_ids — finished images and videos from your feed (GET /images);
    • character_ids — characters (GET /characters).

Files from a request are saved to your Uploaded assets, and their IDs come back in asset_ids. If the job isn’t queued (invalid parameters, not enough credits), the files uploaded for it are deleted.

Formats: JPEG, PNG, WebP, GIF, HEIC images up to 20 MB; MP4, MOV, WebM video up to 50 MB. Up to 10 files per request. A model’s reference_images_limit shows how many inputs it accepts.

To upload a file in advance and get its ID, use a separate request:

curl -X POST https://ai2face.com/api/v1/assets \
  -H "X-Api-Key: $AI2FACE_API_KEY" \
  -F "file=@product.jpg"

Images

POST /images

Field Type Description
prompt string Description of the image, up to 20,000 characters. Required if there are no input images
model string Image model ID
aspect_ratio string Aspect ratio from the model’s aspect_ratios, e.g. 16:9
image_resolution string 1K, 2K, 4K — from the model’s resolutions and within your plan
batch_size number Variations per request, 1–20
quality, background, thinking_level, search_types, output_format — Model-specific parameters from its image_options
images[], reference_ids, image_ids, character_ids — Input images (see above)

Editing a photo from your feed:

curl -X POST https://ai2face.com/api/v1/images \
  -H "X-Api-Key: $AI2FACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.6-flare",
    "prompt": "Put this mug on a wooden table by the window, soft morning light",
    "image_ids": ["4922849c-dec9-4286-99e2-8642f4cb5df0"],
    "image_resolution": "2K",
    "batch_size": 2
  }'

The same request with a file:

curl -X POST https://ai2face.com/api/v1/images \
  -H "X-Api-Key: $AI2FACE_API_KEY" \
  -F "model=gpt-image-2.6-flare" \
  -F "prompt=Put this mug on a wooden table by the window" \
  -F "images[]=@mug.jpg"

The API never substitutes values silently: a value the model doesn’t list in GET /models (aspect ratio, resolution, image_options parameters) returns 422, and errors lists the allowed values.

Video

POST /videos

Field Type Description
prompt string Description of the video. Required
model string Video model ID
mode string text, image, first_last, reference, edit, extend — from the model’s video.modes
first_frame, last_frame object or file First and last frame: {"asset_id": "..."} or {"image_id": "..."}
source_video object or file Source video for edit and extend, in the same format
reference_ids, image_ids, character_ids, images[] — References for reference and edit; models with video.frame_references also take them together with frames and in extend
aspect_ratio string From the model’s video.aspect_ratios: 16:9 or 9:16. Not sent in edit and extend — the source video sets the orientation
duration_seconds number Duration from the model’s list for the mode: video.durations, for reference — reference_durations, for first_last — first_last_durations, for extend — extend_durations (how many seconds to add). Not sent in edit
video_resolution string 360p, 720p, 1080p, 4K — from the model’s list and within your plan
generate_audio boolean Video with sound. The model’s video.audio: optional — set by this field, always — sound is always there, none — true returns 422
batch_size number Variations per request, 1–4

If mode is omitted, it’s picked from the inputs: two frames — first_last, a first frame — image, references — reference, otherwise text. With source_video, set the mode explicitly. The mode and values are checked strictly against the model’s catalog entry: a duration, resolution or aspect ratio outside its lists, as well as inputs the mode doesn’t use (for example, last_frame in image mode), return 422.

The price of a video is the model’s per-second price (with or without sound) × duration. An edit (edit) keeps the source’s duration and orientation; an extension (extend) is charged for the added seconds.

Animating a photo:

curl -X POST https://ai2face.com/api/v1/videos \
  -H "X-Api-Key: $AI2FACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo-3.1-generate-001",
    "prompt": "The camera slowly pulls back, the wind moves her hair",
    "first_frame": { "image_id": "4922849c-dec9-4286-99e2-8642f4cb5df0" },
    "aspect_ratio": "9:16",
    "duration_seconds": 8,
    "video_resolution": "720p",
    "generate_audio": true
  }'

In multipart/form-data, write a frame object as fields with the key in square brackets: first_frame[asset_id] or first_frame[image_id] — likewise last_frame[...] and source_video[...]. A file goes into the field itself: first_frame=@photo.jpg. A JSON string in a frame field isn’t accepted (422).

A transition from a frame in your feed to your own file:

curl -X POST https://ai2face.com/api/v1/videos \
  -H "X-Api-Key: $AI2FACE_API_KEY" \
  -F "model=veo-3.1-lite-generate-001" \
  -F "prompt=Smooth transition between the frames, the camera slowly moves forward" \
  -F "first_frame[image_id]=4922849c-dec9-4286-99e2-8642f4cb5df0" \
  -F "last_frame=@last.jpg" \
  -F "duration_seconds=4"

Voiceover

POST /audio

Field Type Description
text string Text to voice, up to 5,000 characters. Required
model string Audio model ID
mode string single (default) — one voice, dialog — a dialogue of two
voice string A voice from voices for single mode
speakers array For dialog: exactly two {"name": "Anna", "voice": "Kore"} with different names
style string Speaking style, up to 500 characters — only for models with audio.supports_style; others return 422
batch_size number Variations per request, 1–4

In a dialogue, each line starts on a new line in the Name: text format. Sounds and pauses are set with tags from the model’s audio.tags, for example <laugh>. The price is audio.credits_per_unit for every started 1,000 characters. Fields of the other mode — voice in dialog, speakers in single — return 422.

curl -X POST https://ai2face.com/api/v1/audio \
  -H "X-Api-Key: $AI2FACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "dialog",
    "text": "Anna: Have you tried the new generator yet?\nMax: Yes, and it even makes music <laugh>",
    "speakers": [{ "name": "Anna", "voice": "Kore" }, { "name": "Max", "voice": "Puck" }]
  }'

The result is an MP3 in result.audio_url and a cover image in result.url.

Music

POST /music

Field Type Description
prompt string Description of the track: genre, mood, instruments, up to 2,000 characters
lyrics string Your own song lyrics, up to 3,000 characters
instrumental boolean No vocals. Combined with lyrics — 422
duration_seconds number Full song length from the model’s music.durations (60, 120 or 180). A clip (music.full_song: false) has a fixed length of 30 seconds — don’t send this field
model string Music model ID
reference_ids, image_ids, character_ids, images[] — Pictures: music inspired by an image
batch_size number Variations per request, 1–4

You need at least one of three: a description, lyrics or a picture. The price is music.credits per track and doesn’t depend on length. A song made from a picture alone, with no description or lyrics, is sung in English — set another language in prompt.

curl -X POST https://ai2face.com/api/v1/music \
  -H "X-Api-Key: $AI2FACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Summer indie pop, light guitar, female vocals", "duration_seconds": 120}'

Job result

GET /jobs/{id}

{
  "success": true,
  "data": {
    "job": {
      "id": 16201,
      "status": "completed",
      "type": "image",
      "model": "gpt-image-2.6-flare",
      "model_name": "GPT Image 2.6 Flare",
      "error_code": null,
      "created_at": "2026-11-25T09:12:03Z",
      "completed_at": "2026-11-25T09:12:21Z"
    },
    "result": {
      "id": "4922849c-dec9-4286-99e2-8642f4cb5df0",
      "media_type": "image",
      "url": "https://ai2face.com/storage/uploads/generated/.../08f36035.jpg",
      "video_url": null,
      "audio_url": null,
      "preview_url": "https://ai2face.com/storage/uploads/generated/.../08f36035.jpg",
      "thumbnail_url": "https://ai2face.com/storage/uploads/generated/.../08f36035_thumb.webp",
      "image_width": 2048,
      "image_height": 1152,
      "aspect_ratio": "16:9",
      "duration_seconds": null,
      "created_at": "2026-11-25T09:12:21Z"
    }
  }
}
  • For video, url is the cover and the video itself is video_url; for voiceovers and music, the file is audio_url.
  • result.id is the ID in your feed: you can pass it in image_ids of the next request.
  • If the item was deleted from the feed after generation, result is null.

job.error_code values for failed jobs:

Code Reason
content_safety, content_prohibited, content_third_party, content_other The model rejected the request under its content rules
music_copyright, music_rejected The music model rejected the request (for example, a recognizable piece)
no_image The model returned no result
input_missing An input file was deleted before the job started
provider_overloaded, provider_quota, provider_unavailable, timeout, network A temporary provider issue — try again later
bad_request, max_tokens, video_edit_region, video_speech_edit, internal, unknown Other request or service errors

Account, feed, characters and assets

Request Returns
GET /account credits balance, plan (slug, name, expires_at, max_resolution, api_requests_per_minute) and queue (active, limit)
GET /images Your generation feed, paginated: page, per_page (up to 100), filters character_id, date_from, date_to (YYYY-MM-DD)
GET /characters Your characters: id, name, thumbnail_url
GET /assets Your assets; ?type= filter — upload, location, clothing, pose, reference
POST /assets Upload a file (file) — returns the asset ID
GET /status Key check: {"ok": true}

Filters and pages are checked strictly: a type outside the list, a date not in YYYY-MM-DD format, per_page above 100 or page below 1 return 422 instead of an unfiltered result.

Errors and limits

HTTP code When
400 Nothing to generate: no prompt and no inputs
401 The key is missing, invalid or deleted
402 Not enough credits
403 No paid plan (errors.plan), or the model or resolution isn’t open to your plan
404 Job or key not found
409 The job can no longer be canceled
422 Invalid parameters or a value the model doesn’t list in GET /models — details in errors
429 Request or generation limit exceeded, or the queue is full — wait Retry-After seconds
503 Maintenance: the whole API is temporarily unavailable. Try again later — after Retry-After seconds if the end time is known

The request limit applies to the whole account, all keys combined, and depends on your plan: 120 per minute on the entry paid plan and more on higher plans. Your plan’s value is plan.api_requests_per_minute in the GET /account response. On top of that, your plan’s queue limit (queue_limit) and your account’s general generation limits apply, just like in the app.

FAQ

Is there free access to the API?

No. The API works on any paid plan, including a plan received with a promo code. On the free plan you can't create a key, and requests with a key created earlier get a 403 response with the plan_required code.

Are API prices different from the app?

No. A generation through the API costs the same credits as in the generator and is charged to the same balance. Each model's price is in the GET /models response, and the actual charge is in the response to the job request.

What happens to my keys if my plan ends?

The keys are kept. While you have no paid plan, the API returns 403 plan_required; once you renew, the same keys work again — no need to reconfigure your integrations.

Can I call the API from a browser or a mobile app?

No. The key gives access to your account's credits, so keep it on your own server and call the API from there. Browser requests are also blocked by the CORS policy.

Are there webhooks?

Not yet. You find out a job is done by polling GET /jobs/{id}: every 3–5 seconds for images and every 10–15 seconds for video and music.