Nano Studio Pro Generations API

The core of the API. Send a prompt, optionally attach reference images, and get an AI-generated photograph back. Generations cost credits by resolution (60 (1K) / 85 (2K) / 170 (4K)) and store under your per-user storage prefix.

GitHub OpenAPI

Operations 3

GET /v1/generations List generations in a project #
POST /v1/generations Generate an image #
POST /v1/generations/upload Import an image into a project timeline #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/nanostudiopro-com:nanostudiopro-com-generations-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

nanostudiopro-com-generations-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Nano Studio Pro Generations 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: Generations
  description: The core of the API. Send a prompt, optionally attach reference images, and get an AI-generated photograph back. Generations cost credits by resolution (60 (1K) / 85 (2K) / 170 (4K)) and store under your per-user storage prefix.
paths:
  /v1/generations:
    get:
      tags:
      - Generations
      summary: List generations in a project
      description: 'Returns all generations under a given project, newest-first. Each item includes a time-limited signed `image_url` you can use to display or download the result without re-fetching the file separately.


        Every item carries `generation_type`. A clip (`generation_type: "video"`) also carries `is_video: true`, a signed `video_url`, `poster_url` (the same still as `image_url`) and `duration_seconds` when known.


        **Tip:** if you don''t have a project ID yet, call `GET /v1/projects` first and copy one from the response.'
      parameters:
      - name: project_id
        in: query
        required: true
        description: Project to list generations from. Get one from `GET /v1/projects`.
        example: cmod4q3op00011dod8a0omywd
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          default: 20
          maximum: 100
      - name: offset
        in: query
        schema:
          type: integer
          default: 0
      responses:
        '200':
          description: Paginated generations
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/Generation'
                  total:
                    type: integer
        '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: Project not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: not_found
                  message: 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
      operationId: getV1Generations
      x-operation-id-source: derived
    post:
      tags:
      - Generations
      summary: Generate an image
      description: 'The endpoint you''re here for. Sends your prompt to the model and returns the resulting image.


        ### Two ways to call it


        - **JSON** — text-only prompts. Send `Content-Type: application/json` with a body containing `project_id` and `prompt`. Optionally reference existing assets by ID.

        - **Multipart** — attach reference images directly. Send `Content-Type: multipart/form-data` with one or more `reference_file[]` parts. Up to **14 references per generation** (combined files + asset IDs). Files attached this way are also saved to your asset library under category `upload` so you can reuse them later — the IDs come back in the response as `saved_asset_ids`.


        ### Aspect ratio and resolution


        `aspect_ratio` controls the shape (`1:1`, `4:5`, `9:16`, `16:9`, etc.); `resolution` controls pixel density (`1K`, `2K`, `4K`). Defaults: `4:5` shape, `1K` resolution. The model is instructed to honor the picked ratio in addition to whatever you write in the prompt.


        ### Cost


        Charged in **credits**, by model and resolution. Nano Banana 2.1 bills the `generate_*` rows below; Nano Banana Pro bills `generate_pro_*` and GPT Image 2.5 (both variants, one price) bills `generate_gpt_*` — read them from `GET /v1/pricing`.


        | Resolution | Credits |

        |------------|---------|

        | 1K | 60 |

        | 2K | 85 |

        | 4K | 170 |


        References don''t add cost. Failed calls don''t deduct (the credit deduction runs only after the model returns and the row is saved).


        ### Naming


        Pass `name` to label the generation in your library (e.g. `"Hero shot — linen suit"`). If you don''t, we''ll auto-derive a short name from your prompt.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - project_id
              - prompt
              properties:
                project_id:
                  type: string
                prompt:
                  type: string
                  maxLength: 16000
                name:
                  type: string
                  description: Optional human-friendly name.
                aspect_ratio:
                  type: string
                  enum:
                  - '1:1'
                  - '4:5'
                  - '3:4'
                  - '9:16'
                  - '16:9'
                  - '3:2'
                  - '2:3'
                  default: '4:5'
                resolution:
                  type: string
                  enum:
                  - 1K
                  - 2K
                  - 4K
                  default: 1K
                model:
                  type: string
                  enum:
                  - gemini-nano-banana-2.1
                  - gemini-3-pro-image
                  - gpt-image-2.5-flare
                  - gpt-image-2.5-sunburst
                  default: gemini-nano-banana-2.1
                  description: 'Which model renders it. Nano Banana 2.1 (`gemini-nano-banana-2.1`, default): light, texture, mood, the fastest. Nano Banana Pro (`gemini-3-pro-image`): holds structure and proportion exactly. GPT Image 2.5 Flare (`gpt-image-2.5-flare`): text you can actually read — labels, packaging, signs. GPT Image 2.5 Sunburst (`gpt-image-2.5-sunburst`): the same, more careful with references, slower. Names work too: `nano-banana-2`, `nano-banana-pro`, `gpt-2.5-flare`, `gpt-2.5-sunburst`. GPT renders 1K and 2K only — asking it for 4K is a `400`.'
                reference_asset_id:
                  type: array
                  items:
                    type: string
                  description: 'Reuse pictures you already have as references, by id: an uploaded asset or a generation (max 14 total).'
                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.
            examples:
              text-only:
                value:
                  project_id: cmod4q3op00011dod8a0omywd
                  prompt: Editorial portrait of a woman in a tailored linen suit, golden hour, 35mm.
                  aspect_ratio: '4:5'
                  resolution: 1K
                  name: Linen suit hero
          multipart/form-data:
            schema:
              type: object
              required:
              - project_id
              - prompt
              properties:
                project_id:
                  type: string
                prompt:
                  type: string
                  maxLength: 16000
                name:
                  type: string
                aspect_ratio:
                  type: string
                  enum:
                  - '1:1'
                  - '4:5'
                  - '3:4'
                  - '9:16'
                  - '16:9'
                  - '3:2'
                  - '2:3'
                resolution:
                  type: string
                  enum:
                  - 1K
                  - 2K
                  - 4K
                model:
                  type: string
                  enum:
                  - gemini-nano-banana-2.1
                  - gemini-3-pro-image
                  - gpt-image-2.5-flare
                  - gpt-image-2.5-sunburst
                  description: As in the JSON body.
                reference_file[]:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: Upload up to 14 reference images.
                reference_asset_id[]:
                  type: array
                  items:
                    type: string
                entity_id[]:
                  type: array
                  items:
                    type: string
                  maxItems: 12
                  description: As `entity_ids` in the JSON body.
      responses:
        '201':
          description: Generation created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerationCreated'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: validation_error
                  message: Invalid request
        '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: Not enough credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: insufficient_credits
                  message: Not enough credits
        '404':
          description: Project or referenced asset not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: not_found
                  message: Project or referenced asset 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: postV1Generations
      x-operation-id-source: derived
  /v1/generations/upload:
    post:
      tags:
      - Generations
      summary: Import an image into a project timeline
      description: 'Imports a single local image directly into a project''s timeline as a generation — **no prompt, no AI, no effect**. The image is stored under your storage prefix and appears in the project''s timeline immediately, just like a generated image. Counts against your **storage quota**.


        Use this when you want to bring an external photo into a project so it can be used as a source for cutouts, restyles, or other operations that operate on existing generations.


        ### Request


        Multipart only. The `file` and `project_id` fields are required; `name` is optional (auto-derived from the filename if omitted).


        ### Response


        Returns the full generation object (same shape as `GET /v1/generations`) with a signed `image_url`.'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
              - file
              - project_id
              properties:
                file:
                  type: string
                  format: binary
                  description: Image file to import (JPEG, PNG, WebP, etc.).
                project_id:
                  type: string
                  description: Project to add this generation to. Get one from `GET /v1/projects`.
                name:
                  type: string
                  description: Human-friendly label for this generation. Auto-derived from the filename if omitted.
                metadata:
                  type: string
                  description: A JSON object (as a string) of your own fields, at most 4 KB. Returned as `metadata` on every read.
      responses:
        '201':
          description: 'Image imported and available as a generation. When other versions of the same picture are already in your library (a larger original, a smaller export, a re-save), the answer adds `versions`: see `GET /v1/media/{type}/{id}/versions`. Nothing is refused over it.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Generation'
              example:
                id: cmod7xy9z00031do84a1bcde9
                project_id: cmod4q3op00011dod8a0omywd
                name: my-product-shot.jpg
                image_url: https://nanostudiopro.com/storage/gens/my-product-shot.jpg?sig=...
                prompt_used: null
                aspect_ratio: null
                resolution: null
                width: 1200
                height: 1600
                created_at: '2026-06-14T10:00:00.000Z'
        '400':
          description: Missing file or project_id, or unsupported file type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: validation_error
                  message: Missing file or project_id, or unsupported file type
        '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: Storage quota exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: storage_limit_exceeded
                  message: Storage quota exceeded
        '404':
          description: Project not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: not_found
                  message: 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
        '500':
          description: Unexpected server error while storing the file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: internal_error
                  message: Unexpected server error while storing the file
      operationId: postV1GenerationsUpload
      x-operation-id-source: derived
components:
  schemas:
    GenerationCreated:
      type: object
      description: Returned only by POST /v1/generations. Includes the just-created generation plus accounting fields specific to the create call.
      allOf:
      - $ref: '#/components/schemas/Generation'
      - type: object
        properties:
          credits_remaining:
            type: integer
            description: User's credit balance after this call.
          model:
            type: string
            description: The model that rendered it — the request's `model`, or the default.
          reference_count:
            type: integer
            description: How many reference images were used.
          saved_asset_ids:
            type: array
            items:
              type: string
            description: IDs of any reference files attached via multipart that were persisted to your asset library.
          task_id:
            type: string
            description: ID of the Task row tracking this generation. Pass to `GET /v1/tasks/{id}` to poll lifecycle status. The Task is already `complete` by the time you receive this response (the call is synchronous), but the id is useful for cross-referencing in logs, audit trails, or batch dashboards.
    Generation:
      type: object
      description: A stored generation as returned in list responses.
      properties:
        id:
          type: string
        project_id:
          type: string
        name:
          type: string
          nullable: true
          example: Linen suit hero
        metadata:
          type: object
          nullable: true
          additionalProperties: true
          description: The fields you sent as `metadata` when uploading or importing it, returned unchanged.
        image_url:
          type: string
          format: uri
          description: Signed URL to the generated image. Tied to a ~6-hour signing window (always at least 10 minutes of validity left); re-fetch the resource for a fresh one.
        prompt_used:
          type: string
          description: The full prompt sent to the model — includes the aspect/resolution directive we append.
        aspect_ratio:
          type: string
          enum:
          - '1:1'
          - '4:5'
          - '3:4'
          - '9:16'
          - '16:9'
          - '3:2'
          - '2:3'
        resolution:
          type: string
          enum:
          - 1K
          - 2K
          - 4K
        width:
          type: integer
          nullable: true
          description: Real width in pixels (if measured).
        height:
          type: integer
          nullable: true
        created_at:
          type: string
          format: date-time
    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.'