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
- Sign in to NanoStudio and open Settings → API Keys (
/settings/apikeys). - Click Create API Key, give it a label, and confirm the workspace/user.
- Copy the generated key immediately—this is the only time the plaintext value is shown.
- 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 onlyimagemodel–google/nano-bananaorgoogle/nano-banana-proprompt– required unless you passoptionsscene–text-to-image(default) orimage-to-imageaspectRatio– optional, pass ratios like16:9,1:1, etc.imageSize– optional, only forgoogle/nano-banana-pro; accepts1K,2K, or4K(defaults to1K)options– provider-specific JSON (e.g.image_inputarray 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 untilstatusbecomessuccessorfailed.
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
| Code | HTTP | Meaning |
|---|---|---|
api_key_required | 401 | Missing authentication |
invalid_api_key | 401 | Key revoked or malformed |
-1 | 400 | Validation error (check message) |
-1 | 402 | Insufficient credits |
If you need higher quotas, reach out via in-app chat and include your workspace ID.