NanoStudio API

Overview

NanoStudio exposes a REST API so you can embed Nano Banana and Nano Banana Pro models in your own product. Calls consume the same credits as the in-app generator (14 credits for Nano Banana, 28 for Nano Banana Pro).

Request an API key

  1. Sign in to NanoStudio and open Settings → API Keys (/settings/apikeys).
  2. Click Create API Key, give it a label, and confirm the workspace/user.
  3. Copy the generated key immediately—this is the only time the plaintext value is shown.
  4. Revoke or rotate keys any time from the same screen. Revoked keys stop working instantly.

Only subscription plans (monthly or annual) can create active API keys. Pay as you go plans do not include API access. Credits and plan limits are shared between the dashboard and the API.

Authentication

Every API request must include your key:

Authorization: Bearer <your_api_key>

Alternatively send X-API-Key: <key> or append ?api_key=<key> to GET requests. Requests without a valid key return 401.

Generate an image

  • Endpoint: POST /api/v1/images/generate
  • Body fields:
    • mediaType – currently only image
    • model – google/nano-banana or google/nano-banana-pro
    • prompt – required unless you pass options
    • scene – text-to-image (default) or image-to-image
    • aspectRatio – optional, pass ratios like 16:9, 1:1, etc.
    • imageSize – optional, only for google/nano-banana-pro; accepts 1K, 2K, or 4K (defaults to 1K)
    • options – provider-specific JSON (e.g. image_input array for image-to-image)

NanoStudio automatically routes each model to the correct underlying provider, so you only need to specify the model name.

curl https://app.example.com/api/v1/images/generate \
  -H "Authorization: Bearer $NANOSTUDIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mediaType": "image",
    "model": "google/nano-banana-pro",
    "prompt": "ultra detailed product photo of citrus soda can on ice",
    "scene": "text-to-image",
    "aspectRatio": "16:9",
    "imageSize": "2K"
  }'

Response

{
  "code": 0,
  "message": "ok",
  "data": {
    "id": "task_123",
    "taskId": "remote_task_id",
    "status": "pending",
    "costCredits": 28,
    "model": "google/nano-banana-pro"
  }
}

Keep the returned id (internal) or taskId (provider) for polling.

Poll task status

  • Endpoint: GET /api/v1/images/{id}
curl https://app.example.com/api/v1/images/task_123 \
  -H "Authorization: Bearer $NANOSTUDIO_API_KEY"

Successful responses return the stored task record, including status, taskResult, and provider metadata. Only the user who owns the key can read the task.

NanoStudio automatically checks the upstream provider when the stored task is still pending, so each poll returns the freshest status available. Keep polling every few seconds until status becomes success or failed.

Handling results & webhooks

Tasks transition through pending → succeeded / failed. NanoStudio stores the taskResult JSON exactly as returned by the upstream provider; use it to fetch the final assets. Continue polling until status === "succeeded" or connect an existing webhook under Settings → Notifications.

Error handling

CodeHTTPMeaning
api_key_required401Missing authentication
invalid_api_key401Key revoked or malformed
-1400Validation error (check message)
-1402Insufficient credits

If you need higher quotas, reach out via in-app chat and include your workspace ID.