Create a world (generate or import)
Two modes, selected by the body. Generate (default): produce a playable SMWorld from a premise and/or seed frame — or from a chapter/book excerpt via text (book-to-game) — reserving one generation against your daily quota before spending GPU. Import: pass a compiled world object to persist it VERBATIM (no generation/GPU) — the graph is schema-validated but not recompiled, and it returns 201 with imported:true. Import still reserves one generation of quota (anti-spam) and is bounded in size (see 413). Worlds created with a live key are attributed to your account and appear in your web Studio under My Creations (test-mode creations stay out of the Studio list).
Authorizations
An app API key, e.g. Authorization: Bearer sk_live_…. Secret (sk_) for writes/sessions; publishable (pk_) is read-only (browser-safe).
Headers
A retried request with the same key returns the original result without re-generating. Keyed per (app, mode, key value) — test and live keep separate idempotency caches, so reusing a key across modes is safe.
Body
GENERATE mode: a "what if…" pitch. Required if no frame and no world is given.
GENERATE mode: base64 seed frame (data-URL or raw).
GENERATE mode: URL of a seed frame.
GENERATE mode (BOOK-TO-GAME): a chapter or book excerpt turned into a playable world through the book pipeline (segment → bible → author an act, fail-closed validate). One chapter → one world. Mutually exclusive with premise/frame_b64/frame_url (sending both → 400); over 40000 chars → 400. Recommend async:true for chapters. Meters one generation; tenancy, mode and author stamping match every other create. subject_ref is NOT yet supported with text (sending both → 400) — to carry a character across chapters, author each chapter with premise/frame + subject_ref.
40000IMPORT mode: a complete compiled SMWorld to store verbatim. When present, generation is skipped and the response is 201 with imported:true. name/description (below) override the blob's own.
IMPORT mode: overrides the imported blob's description.
GENERATE mode only.
GENERATE mode: queue a durable job and return 202 with a jobId instead of generating inline. Poll GET /v1/jobs/{jobId}. (Ignored by import and by test-mode keys, which return synchronously.)
GENERATE mode: a canonical-character reference (subjectRef) for cross-scene consistency — the PIXEL counterpart of the prose subject lock. When present, the opening seed is painted FROM this character and the reference is stored on the world as subjectRef {imageUrl, descriptor}, so later scenes/levels/chapters regenerate seeds that keep the same face, build, hair and clothing (see POST /v1/worlds/{id}/scenes). A image_b64 is hosted to a durable URL first. Threads through the async job path too. FAIL CLOSED: if a supplied image_b64 cannot be hosted the request returns 502 (no world is created) rather than silently dropping the reference.

