Documentation/Integration guide/Quickstart
Integration guide

Quickstart

5-minute step-by-step tutorial to generating your first consistent character and cinematic scene.

5 min read
•Updated October 21, 2026

Setup & API Key Configuration

Sign in at apimarketplace.com, select your organization and project, add credits, and create an API key. Save its secret when it is created; it is shown only once. Set API_KEY in your server environment.

Model Selection & Scene Generation

Run the example with MODEL_ALIAS=photoreal-v1 for realistic output or MODEL_ALIAS=anime-v1 for illustrated output. Use the character ID returned by your own project. The sample polls for clarity; subscribe to webhooks for completion notifications.

Server-Side Reference Invariant

Never submit reference images, image URLs, storage keys or base64 to either image-generation route. The platform creates and retrieves its reference internally.

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")

character = call("POST", "/v1/characters", json={'name': 'Example character',
 'model_alias': 'photoreal-v1',
 'subject': 'A 30-year-old adult with brown eyes and short brown hair',
 'action': 'Wearing a blue shirt, facing the camera',
 'environment': 'A plain studio'})
print("Character ID:", character["id"])
wait("/v1/characters/" + character["id"], "ready")
payload = {'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"] = character["id"]
generation = call("POST", "/v1/generations", json=payload)
print("Generation ID:", generation["id"])
completed = wait("/v1/generations/" + generation["id"], "completed")
print("Temporary output URL:", completed["outputUrl"])