Skip to main content
A world is a playable game expressed as a graph of states and events — a little state machine you generate from a prompt. It’s programmable because you don’t just get a static asset: you read it, patch it, fork variants, and react to its runtime events (onChoice, onEnding, …) to wire it into your own product’s logic.
Secret keys (sk_…) live on your server and can create worlds and mint session tokens. Publishable keys (pk_…) are browser-safe and limited to read + embed. Both come in test and live modes.
Mint a short-lived session token on your server with your secret key (POST /v1/sessions/token), then pass that token — not the key — to @alakazamworld/embed in the browser. See Embedding.
The API is free during the developer preview. Generations and sessions are metered per app so you can see usage, but nothing is charged. See Pricing.
No. Worlds conform to a frozen, versioned schema (schemaVersion). Minor versions only add optional fields; breaking changes require a major version, and the previous major stays readable.
Send an Idempotency-Key header on POST /v1/worlds. A retry with the same key returns the original result instead of generating again.