Documentation/Integration guide/Character-to-image: realistic and anime
Integration guide

Character-to-image: realistic and anime

Render standalone images or consistent character scenes with aspect ratios and idempotency.

5 min read
•Updated October 21, 2026

Character-to-Image Endpoint

POST /v1/generations supports standalone text-to-image (omit character_id) and consistent character scenes (send a ready character_id). Set model_alias explicitly. When using a character, match its public model_alias. Both snake_case names and their camelCase aliases are accepted.

Model Consistency & Prompt Composition

For a realistic character send model_alias=photoreal-v1. For an anime character send model_alias=anime-v1. Keep the returned character_id and supply new action and environment sections for every scene. The backend retains the saved subject. The example requires CHARACTER_ID in your server environment; create one using the Quickstart first. A plain prompt is also accepted.

Asynchronous Generation Lifecycle

The initial response is 202. A successful idempotent replay can return 200 with the same ID. Subscribe to generation.completed/generation.failed, or poll GET /v1/generations/{id}. Download outputUrl after completion.

Supported Aspect Ratios

Supported aspect ratios are 1:1, 2:3, 3:2, 3:4, 4:3, 9:16 and 16:9. Do not send guidance_scale, negative_prompt or arbitrary provider parameters to this route.

Idempotency-Key Replay Safety

Reuse an Idempotency-Key only for the exact same payload within the same project. A changed payload with that key returns 409. Idempotency does not apply automatically to every POST route.

Code Implementation

import os
import time
import requests

BASE = "https://api.apimarketplace.com"
headers = {"Authorization": "Bearer " + os.environ["API_KEY"]}

def call(method, path, **kwargs):
    response = requests.request(method, BASE + path, headers=headers, timeout=300, **kwargs)
    response.raise_for_status()
    return response.json() if response.content else None

def wait(path, success):
    deadline = time.monotonic() + 900
    while time.monotonic() < deadline:
        result = call("GET", path)
        if result["status"] == success:
            return result
        if result["status"] == "failed":
            raise RuntimeError(result.get("errorMessage") or "Generation failed")
        time.sleep(3)
    raise TimeoutError("Still pending; keep the returned ID and check later")

# Use a ready character from your project; match its model_alias.
payload = {'character_id': 'CHARACTER_ID',
 'model_alias': 'photoreal-v1',
 'action': 'Wearing a green jacket, standing by a window',
 'environment': 'A modern apartment in soft morning light',
 'aspect_ratio': '2:3'}
payload['character_id'] = os.environ['CHARACTER_ID']
result = call('POST', '/v1/generations', json=payload)
print("Resource ID:", result["id"])
completed = wait('/v1/generations/' + result["id"], 'completed')
print(completed)