Drive the Studio from code
The Studio is the visual film-builder in your dashboard: you create a project, add characters and reference assets, lay out scenes and shots on a storyboard, and generate each shot. Every one of those actions is available programmatically — over the REST API and over a Model Context Protocol (MCP) server — so an agent (Claude Code, Claude Desktop, Cursor, your own code) can build a whole video end to end.
The REST API takes the same API key you already use for generation. The MCP server takes it too, or you can sign in with no key at all.
The model
Project ← aspect ratio, quality, defaults
├─ Asset library ← characters, props, reference images/videos
├─ Scene (order 0) ← groups ordered shots
│ ├─ Shot ← a generatable panel (model + prompt + camera)
│ │ └─ Take ← one generated result; select the best
│ └─ Shot …
└─ Scene (order 1) …
- A character is an asset with
kind: character. Props and references arekind: prop | image | video. - The storyboard is a node graph: each shot has a canvas position and
connections(directed edges) that describe the camera path through the scene; scenes carry titled groups and sticky notes. - A shot references assets via
refAssetIds,startFrameAssetId, andendFrameAssetId— that is how your characters and references flow into the generation.
Option A — REST API
Every route is under /api/v1/studio/* and takes
Authorization: Bearer <your-api-key>. See the full list in the
API reference under the Studio tag. The core flow:
BASE=https://nokai.studio
KEY=agw_your_key
# 1. Pick a model
curl -s $BASE/api/v1/models -H "Authorization: Bearer $KEY"
# 2. Create a project
curl -s $BASE/api/v1/studio/projects -H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' \
-d '{ "name": "Neon Courier", "aspectRatio": "9:16", "quality": "draft" }'
# 3. Add a character from a public URL
curl -s $BASE/api/v1/studio/projects/PID/assets/url-import \
-H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
-d '{ "name": "Courier", "kind": "character", "url": "https://…/courier.png" }'
# 4. Create a scene, then a shot in it
curl -s $BASE/api/v1/studio/projects/PID/scenes \
-H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
-d '{ "name": "Rooftop chase", "order": 0 }'
curl -s $BASE/api/v1/studio/scenes/SID/shots \
-H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
-d '{ "modelSlug": "MODEL", "prompt": "wide establishing shot of a neon rooftop",
"camera": { "angle": "low-angle", "lens": "24mm-wide", "move": "dolly-in" },
"refAssetIds": ["AID"] }'
# 5. Generate it (paid) and poll
curl -s $BASE/api/v1/studio/shots/SHID/generate -X POST \
-H "Authorization: Bearer $KEY"
curl -s "$BASE/api/v1/jobs/recordInfo?taskId=TASK" -H "Authorization: Bearer $KEY"GET /api/v1/studio/projects/{pid}/storyboard returns the whole tree with live
generation state — one call to inspect everything and to poll progress.
Generation debits your balance. Call POST /api/v1/studio/shots/{shid}/estimate
first to preview the cost. Uploading your own media instead of generating is
free: use-asset attaches an owned asset as the shot result.
Option B — MCP server
Hosted at https://nokai.studio/mcp. Clients sign in with OAuth: they open
Nokai in your browser, you approve, and there is no key to paste. See
setup for each client, or with Claude Code:
claude mcp add --transport http nokai https://nokai.studio/mcpApproving a client creates an API key named after it (MCP · Claude, say). To
disconnect, revoke that key on the API keys page.
Start with generate_video, generate_image and wait_for_job for one-offs,
list_models (best models first), get_balance and upload_media. For films,
there is one tool per Studio action: create_project, create_character,
create_scene, create_shot, generate_shot, get_storyboard, select_take,
and more.
With an API key — for scripts and clients without OAuth, send your key as a bearer token. Each request is authenticated and isolated:
{
"mcpServers": {
"nokai": {
"type": "http",
"url": "https://nokai.studio/mcp",
"headers": { "Authorization": "Bearer agw_your_key" }
}
}
}Once connected, a single prompt can drive the whole build: "Create a project, add these two characters, lay out two scenes with three connected shots each using a low-angle 24mm dolly-in, then estimate the cost and stop before generating."
Cost & safety
- Read-only and structural calls (create/patch project, scene, shot, asset;
use-asset,remix,select-take) are free. generate_video,generate_image,generate_shot,generate_scene,upscale, and reframe are paid — they debit your balance. Alwaysestimatefirst. MCP clients see these tools marked as paid, so they can ask you first.- Keys scope every call to your own account; ids from other accounts resolve to
404.