Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Nano Studio Pro Video API
version: 1.0.0
description: 'Programmatic access to **Nano Studio Pro** — generate AI fashion and product photography, manage projects and assets, and track storage from any client (scripts, CLIs, AI agents).
### How it works
You group your work into **Projects**. Each generation belongs to a project. Reusable inputs (model photos, pose references, uploads) live in **Assets** and can be passed by ID into any generation. Generations cost credits by resolution (see `POST /v1/generations`); asset uploads count against your **storage quota**.
### Authentication
All requests require a Bearer token. Create one at Settings · API keys. The token is shown once at creation — store it safely. If lost, revoke and create a new one.
```bash
curl -H "Authorization: Bearer sk_sf_live_..." https://nanostudiopro.com/api/v1/me
```
Two kinds of key share this header:
- **Secret keys** (`sk_sf_live_...`) — full API access, governed by the token''s scopes. Never ship one in client-side code.
- **Publishable keys** (`pk_sf_live_...`) — safe to embed in public HTML. They are created with the `read` scope only and work **exclusively on `GET /v1/search`**: authentication itself rejects them with `401 unauthorized` on every other endpoint. Each publishable key optionally carries a **`search_scope`** object (see the schema of that name) that narrows what it can see:
- `projects` — the key sees only these project ids; absent = the whole library.
- `types` — result types the key may return (`asset` / `generation`).
- `max_image_size` — caps the `image_size` variant served; requests above the cap (the `preview` default included) are silently served the cap.
- `origins` — exact-match browser `Origin` allowlist; a request from any other origin gets `403 forbidden`. Absent = any origin. Requests with no Origin header (curl, server-to-server) always pass — the origin lock is a soft, browser-only control; the hard controls are the read-only scope and the narrowing above.
- `include_regions` — whether the key may request detection regions. Default false.
- `include_narrative` — whether results carry the AI-written photo description (`narrative`). Default false: publishable-key results omit it unless the scope opts in.
Scope narrowing is **silent by design**: a filter that falls entirely outside the key''s scope returns an empty 200 page, never an error, so a client can''t probe what exists outside its window.
### Rate limits
Per-token rate limits are enforced; when exceeded you''ll get `429` with a `Retry-After` header. Secret keys get **60 requests/min per token**. Publishable keys (search-only) get **600/min per key** plus **60/min per key + client IP** — whichever is stricter wins, so one hot visitor can''t exhaust a whole site''s key. Search rate limits are durable — shared across server instances, so counts don''t reset on deploys or split between replicas.
### Errors
All error responses use the same shape: `{ "error": { "code": "...", "message": "..." } }`. Common codes include `unauthorized`, `validation_error`, `not_found`, `insufficient_credits`, `token_cap_exceeded`, `storage_limit_exceeded`, `rate_limited`.
## Authorizing a device
Two ways to get a token:
1. **Manual** — create one in Settings · API Tokens. Returns a `sk_sf_live_...` token immediately.
2. **Device flow (RFC 8628)** — for CLIs and headless tools. Run `curl -fsSL https://nanostudiopro.com/cli/nsp -o /usr/local/bin/nsp && chmod +x /usr/local/bin/nsp && nsp login`, or implement the protocol yourself (full walkthrough at /docs/device-auth; endpoints are listed under the **Device Auth** tag below).
Each token can optionally have a **daily credit cap** — a rolling-24h spending limit independent of the wallet balance. Useful for limiting blast radius if a token leaks. Configure under Settings → API Tokens.'
contact:
url: https://nanostudiopro.com/settings?tab=api-tokens
servers:
- url: /api
description: Same origin as docs (auto-detects local vs prod)
- url: https://nanostudiopro.com/api
description: Production
security:
- BearerAuth: []
tags:
- name: Video
description: Image-to-video generation (Kling). Submit a source generation + motion prompt; poll until the 5s/10s video is ready. The platform's most expensive operation (`video_*` pricing keys) — credits are deducted only when a video completes, and video requires purchased credits (not trial).
paths:
/v1/videos:
post:
tags:
- Video
summary: Make a video from an image (async)
description: 'Submits a video job from an image you own — a generation or an upload — plus a prompt. Every model the app''s own video modal offers is here, with the same dials. **Async** — the response carries a `task_id`; poll `GET /v1/videos/{task_id}` until `completed`.
### Models
| `model` | length | `mode` | sound | takes |
|---|---|---|---|---|
| `kling-v3` (default) | 3-15s | std / pro / 4k | optional | `end_frame_id` — about 2 minutes |
| `kling-v3-omni` | 3-15s | std / pro / 4k | optional, never with a clip | up to 6 `reference_image_ids`, or 3 beside one `reference_video_id` (3-10s) whose acting and motion to keep — about 5 minutes |
| `kling-video-o1` | 3-10s | std / pro | none | the same references, cheaper with a clip |
| `kling-motion-control` | the clip''s (3-30s) | std / pro | none | `reference_video_id` = the movement to copy; `character_orientation` picks whose face |
| `veo-3.1-lite-generate-preview` | 4, 6 or 8s | std = 720p / pro = 1080p | always | `end_frame_id` |
| `gemini-omni-1.2-flash` | 3-15s (10 at most with `end_frame_id`) | lite = 360p / std = 720p native / pro, 4k upscaled | always | `end_frame_id`, up to 6 stills in all (frames included), up to 3 `reference_video_ids` to follow (1 past 10 s; the first 3 s of each is used), or `reference_video_id` = a clip of up to 15 s to **edit** by describing the change; `clip_task: extend` adds 3-10 s, 30 s in all. `gemini-omni-1.1-flash` is still accepted and runs on 1.2 |
| `dreamina-seedance-2-5-260628` | 4-30s | lite = 480p / std = 720p / pro = 1080p | always, dialogue in sync | `end_frame_id`, OR up to 6 `reference_image_ids` and up to 10 `reference_video_ids` (clips to follow, 30 s in all). `generation_id` is optional: without it the clip follows only its references, or the prompt alone, in `aspect_ratio`. `clip_task` edits or extends `reference_video_id`. `draft: true` makes a 480p draft; `finalize_draft_id` renders it at 1080p — about 2-4 minutes |
Names work as well as ids: `kling-3.0`, `kling-3.0-omni`, `kling-o1`, `veo-3.1-lite`, `gemini-omni-flash`, `seedance-2.5`. `GET /v1/meta` returns the same table as data, and says which models are **switched off for now**: `available: false` with `unavailable_reason` ("Back soon", "Unavailable for technical reasons"). A request naming one answers `503 model_unavailable`; with no `model`, the default is used while it is on, else the first open model in this table. A model asked for something it cannot do — an end frame on O1, 4K on Veo, audio with a reference clip — answers `400 validation_error` with the reason in words.
### Cost — read before calling
The most expensive operation on the platform, priced **per second of output**: the `video_*_sec_*` rows in `GET /v1/pricing` times the clip''s seconds (Motion Control: the reference clip''s seconds; Veo 3.1 Lite: fixed `video_veo_lite_*` rows). The 202 response states the exact `credits_cost` and the `pricing_key` it came from. Credits are deducted **only when the video completes** — a failed video costs nothing. Video requires **purchased** credits; trial credits return `402 video_requires_purchase`.
**Quote first.** Send the same body with `dry_run: true`: every check and the planner run and the response is a `200` with `status: quote` and the same fields the 202 would carry, but no job exists and nothing is charged. A model asked for a dial it lacks answers the quote with the same `400` the real call would.'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- project_id
- prompt
properties:
generation_id:
type: string
description: 'Source image / first frame: a generation or upload id you own. Required except on Seedance, which can follow references or the prompt alone.'
project_id:
type: string
prompt:
type: string
description: The motion/action to depict — or, with a Gemini Omni `reference_video_id`, the change to make.
model:
type: string
enum:
- kling-v3
- kling-v3-omni
- kling-video-o1
- kling-motion-control
- veo-3.1-lite-generate-preview
- gemini-omni-1.1-flash
- dreamina-seedance-2-5-260628
default: kling-v3
description: By id or by name (see the table). `kling-v2-6` is retired but still accepted.
duration:
type: integer
minimum: 1
maximum: 60
description: Whole seconds, within the model's range or menu (Veo snaps to 4/6/8; Gemini Omni 3-15). Default 5, Veo 8. Ignored by Motion Control.
mode:
type: string
enum:
- lite
- std
- pro
- 4k
default: std
description: 'Render size. `lite` is the cheap draft size: 480p on Seedance, 360p on Gemini Omni. `360p`, `480p`, `720p`, `1080p` and `4K` are accepted as aliases.'
audio:
type: boolean
default: false
description: Optional on Kling 3.0 / Omni (more credits; refused together with a reference clip). Veo, Gemini Omni and Seedance always carry sound; O1 and Motion Control never do.
end_frame_id:
type: string
description: An image the clip must land on. Kling 3.0, Veo, Gemini Omni, Seedance (not together with references).
reference_video_id:
type: string
description: 'A finished video generation you own: the acting to keep (Kling Omni / O1), the movement to copy (Motion Control), or the clip to edit (Gemini Omni).'
reference_image_ids:
type: array
items:
type: string
maxItems: 7
description: Extra stills the clip should stay faithful to, beyond the first frame. Kling Omni / O1 up to 6, or 3 once a reference clip takes a place in the same list. Gemini Omni up to 6 stills in all, its first and last frame included. Seedance up to 6, never beside an end frame.
character_orientation:
type: string
enum:
- image
- video
description: 'Motion Control only: the face as in the still, or as in the clip. Default `video`.'
entity_ids:
type: array
items:
type: string
maxItems: 12
description: Saved characters, props or places (ids from `GET /v1/entities`) whose baked reference sheet to attach. Writing `@slug` in the prompt does the same — a look is `@parent/look` or its own slug — and the prompt is rewritten so the model knows which picture is whom. Sheets go after your own references, within the model's reference limit; the response's `entities` says which went in and which were dropped. Unknown `@words` are left as typed. To leave something out, write `-@slug` (that prop comes off every items sheet the request sends, and the words are removed from the prompt) or pass `-<id>` here; `@slug/alone` or `<id>/alone` sends the entity without its items sheet. The response's `entities.excluded` lists what was left out. Sheets count against `reference_image_ids`' limit; Kling 3.0, Veo and Motion Control take none, so there a mention becomes the plain name.
reference_video_ids:
type: array
items:
type: string
maxItems: 10
description: 'Seedance References: finished clips to follow for movement, camera or pacing (@Video1, @Video2… in the prompt), each 2-30 s and 30 s in all. Not edited. Billed as clip input: the per-second row x 0.6 x (clip seconds + output seconds). Gemini Omni: up to 3 (1 on clips over 10 s), new footage only; the first 3 s of each is followed, at no extra charge.'
reference_audio_ids:
type: array
items:
type: string
maxItems: 10
description: 'Seedance References: sounds to follow (@Audio1, @Audio2… in the prompt), ids from `POST /v1/videos/reference-audio`. MP3 or WAV, 2-30 s each, 30 s in all.'
reference_audio_urls:
type: array
items:
type: string
maxItems: 10
description: The same as public links, fetched and stored on this call; they come after `reference_audio_ids` in @Audio order. At most 10 sounds in all.
aspect_ratio:
type: string
enum:
- '16:9'
- '9:16'
- '1:1'
- '4:3'
- '3:4'
- '21:9'
description: 'Seedance without a first frame: the shape to render. With a first frame the shape follows it.'
clip_task:
type: string
enum:
- edit
- extend
description: 'Seedance: edit `reference_video_id` (4-30 s; keeps its length and shape) or extend it (2-30 s; `duration` is the new part). Billed as clip input, like `reference_video_ids`.'
extend_direction:
type: string
enum:
- forward
- backward
default: forward
description: 'With `clip_task: extend`: the new part follows the clip, or leads into it.'
name:
type: string
maxLength: 200
description: The clip's title in the library. Without it the clip is untitled and shows its prompt.
keep_sound:
type: boolean
default: true
description: 'On an edit (Gemini Omni with `reference_video_id`, or Seedance `clip_task: edit`): the clip''s own sound is put back under the edited picture, since the model redraws voices and can repeat a line. false keeps the model''s sound.'
draft:
type: boolean
default: false
description: 'Seedance: a 480p draft at the 480p price. When you like it, send `finalize_draft_id` to render the same shot at 1080p.'
finalize_draft_id:
type: string
description: A finished Seedance draft's video id. Sent alone (with `project_id`), it renders the same shot at 1080p within 7 days of the draft, billed at the 1080p row for the draft's length. `dry_run` quotes it.
dry_run:
type: boolean
default: false
description: 'Quote only. Every check and the planner run and the exact `credits_cost` comes back as a `200` with `status: quote`, but nothing is submitted or charged. Then send the same body without it.'
examples:
quote:
summary: 'Quote first: the exact price of a 5 second Kling 3.0 clip with sound, nothing submitted'
value:
generation_id: cgen_start
project_id: cproj
prompt: she turns from the window
model: kling-v3
audio: true
dry_run: true
kling_end_frame:
summary: Kling 3.0, 7 seconds, 4K, landing on a second still
value:
generation_id: cgen_start
project_id: cproj
prompt: she turns from the window and walks toward the camera
model: kling-v3
duration: 7
mode: 4k
end_frame_id: cgen_end
omni_reference_clip:
summary: 'Kling 3.0 Omni: keep the acting of a clip, with two stills of who should do it'
value:
generation_id: cgen_still
project_id: cproj
prompt: the same walk and turn, in a rain-lit street at night
model: kling-v3-omni
duration: 10
mode: pro
reference_video_id: cgen_clip
reference_image_ids:
- cgen_face
- cgen_outfit
gemini_edit:
summary: 'Gemini Omni Flash: edit a finished clip by describing the change'
value:
generation_id: cgen_still
project_id: cproj
prompt: same shot, but she is wearing the red jacket and the cups are tall glasses
model: gemini-omni-1.2-flash
reference_video_id: cgen_clip
mode: pro
responses:
'200':
description: 'Quote (`dry_run: true`): the plan and its exact price. Nothing was submitted or charged.'
content:
application/json:
example:
dry_run: true
status: quote
id: null
task_id: null
provider: kling
model: kling-v3
mode: std
resolution: null
duration_seconds: 5
audio: true
end_frame: false
reference_video: false
reference_images: 0
credits_cost: 800
pricing_key: video_kling3_sec_std_audio
estimated_wait: about 2 minutes
note: 'Quote only: nothing was submitted or charged. Send the same body without dry_run to make the clip.'
'202':
description: Job submitted; poll the task.
content:
application/json:
example:
id: cmgen_video
task_id: task_xyz
status: submitted
provider: kling
model: kling-v3
mode: 4k
resolution: null
duration_seconds: 7
audio: false
end_frame: true
reference_video: false
reference_images: 0
credits_cost: 4200
pricing_key: video_kling3_sec_4k
estimated_wait: about 2 minutes
note: Credits are deducted when the video completes. Poll GET /v1/videos/{task_id} (about 2 minutes).
'400':
description: A missing field, an unknown model, or a dial this model does not have (the message says which)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: validation_error
message: A missing field, an unknown model, or a dial this model does not have (the message says which)
'401':
description: Missing or invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: unauthorized
message: Missing or invalid token
'402':
description: Trial credits (video requires purchase) or insufficient credits
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
video_requires_purchase:
value:
error:
code: video_requires_purchase
message: Video generation isn't included in free trial credits.
'404':
description: Generation or project not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: not_found
message: Generation or project not found
'429':
description: Rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: rate_limited
message: Rate limit exceeded
'503':
description: The model is switched off for now (GET /v1/meta says why); or `feature_unavailable` when pricing is not configured
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: model_unavailable
message: The model is switched off for now (GET /v1/meta says why); or `feature_unavailable` when pricing is not configured
operationId: postV1Videos
x-operation-id-source: derived
/v1/videos/{task_id}:
parameters:
- name: task_id
in: path
required: true
description: The task_id returned by POST /v1/videos.
schema:
type: string
get:
tags:
- Video
summary: Poll a video job
description: 'Status of a video job. Polling ADVANCES the job: when Kling reports success, this call downloads and stores the MP4, settles the deferred credit deduction, and returns signed `video_url` + `preview_url` (720p). Poll every 15-30s until `completed` or `failed`.'
responses:
'200':
description: Current status; URLs present once completed.
content:
application/json:
example:
task_id: task_xyz
generation_id: cmgen_video
status: completed
video_url: https://nanostudiopro.com/api/file?path=...&sig=...
preview_url: https://nanostudiopro.com/api/file?path=..._preview.mp4&sig=...
duration_seconds: 5
'400':
description: Task exists but is not a video task
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: validation_error
message: Task exists but is not a video task
'401':
description: Missing or invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: unauthorized
message: Missing or invalid token
'404':
description: Task not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: not_found
message: Task not found
'429':
description: Rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: rate_limited
message: Rate limit exceeded
operationId: getV1VideosByTaskId
x-operation-id-source: derived
components:
schemas:
Error:
type: object
required:
- error
properties:
error:
type: object
required:
- code
- message
properties:
code:
type: string
example: validation_error
message:
type: string
example: '`prompt` is required'
needed:
type: integer
nullable: true
description: '402 only: what the operation costs in credits, when known.'
balance:
type: integer
nullable: true
description: '402 only: what the account has (for `token_cap_exceeded`, what the token may still spend today), when known.'
purchase_url:
type: string
format: uri
description: '402 only: where the person adds credits. Every 402 (`insufficient_credits`, `token_cap_exceeded`, `video_requires_purchase`, `audio_requires_purchase`, `storage_limit_exceeded`, `trial_required`) carries the same fields, so one handler can show the notice. `trial_required` answers an upload from an account that has not started its free trial: nothing was stored, and the upload goes through once the trial is on.'
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: 'Personal access token from `/settings?tab=api-tokens`. Send as `Authorization: Bearer sk_sf_live_...` — or a publishable `pk_sf_live_...` key, which authenticates on `GET /v1/search` only.'