Back to home

API

Generate images from your own code or AI agents: the AINanoBananaPro.com REST API and MCP server for Nano Banana, GPT Image and Seedream models, billed in credits.

Last updated: 2026-11-26

Access

API access is included with the Ultimate plan. Create a key in Settings → API Keys and send it as a bearer token. Keys stop working if the plan no longer includes API access. Keep keys secret — anyone with a key spends your credits.

Authorization: Bearer sk-...

Jobs cost the same credits as in the studio, use the same resolution and Beast mode limits as your plan, and are refunded automatically if a model fails. Beast mode (several models in one request) is a batch feature of Ultimate and Business (up to 8) and Crew (up to 4); on other plans and packs such a request returns 403 with pro_required and nothing is charged.

Start a job

POST /api/v1/images

FieldTypeNotes
model or modelsstring / string[]e.g. nano-banana-2-1; several models = Beast mode (Ultimate and team plans only); auto picks the best fit
promptstringrequired, up to 3,000 characters
referencesstring[]up to 8 public https:// image URLs
resolution1K | 2K | 4Ksnapped to what each model supports
aspectRatiostringe.g. 1:1, 16:9, 9:16
relaxbooleanRelax mode on Nano Banana / 2 / Pro — no credits, slower, hourly limit
visibilitypublic | privatePrivate Mode is on by default for your plan
curl https://ainanobananapro.com/api/v1/images \
  -H "Authorization: Bearer $NBA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"models":["nano-banana-2-1","gpt-image-2-5-flare"],"prompt":"A ceramic mug on a sunlit desk","resolution":"2K"}'

The response (201) is { "data": [ { "id", "model", "status", "credits", ... } ] } — one job per model.

Poll a job

GET /api/v1/images/{id} returns { "data": { "status", "outputs": [url], "error" } }. status is pending, processing, success or failed. Poll every few seconds; most images finish in 10–60 seconds.

Models

nano-banana, nano-banana-2, nano-banana-2-1, nano-banana-pro, gpt-image-2, gpt-image-2-5-flare, gpt-image-2-5-sunburst, seedream-4-5, seedream-5-lite, seedream-5-pro, or auto.

Errors

Errors return { "error": { "message" } } with 401 (bad key), 403 (plan has no API access), 402 (not enough credits), 400 (invalid request or plan limit) or 429 (too many requests).

MCP server for AI agents (Claude, ChatGPT, Cursor)

AINanoBananaPro.com is also a remote Model Context Protocol server, so AI assistants can generate images with your account. It works on every plan (no API key needed): you sign in once and approve access, and images use your normal credits and plan limits.

Server URL: https://ainanobananapro.com/mcp

  • Claude: Settings → Connectors → Add custom connector, then paste the URL.
  • ChatGPT: Settings → Apps → Developer mode → Create app, then paste the URL.
  • Claude Code: claude mcp add --transport http ai-nano-banana-pro https://ainanobananapro.com/mcp
  • Cursor / VS Code / others: add a remote (Streamable HTTP) server with the URL above.
ToolWhat it does
generate_imageCreate or edit an image from a prompt and up to 8 reference images; returns URLs
get_generationStatus and URLs of a generation that was still running
list_image_modelsModels, credits per resolution, aspect ratios and what your plan includes
list_my_imagesYour recent images
get_credit_balanceCredits left and plan limits
browse_banana_promptsPublic Banana Prompts gallery with the exact prompts behind each image

Protocol: Streamable HTTP with JSON responses. It supports MCP 2026-07-28 (stateless, server/discover) and the initialize handshake for 2025-11-25 and earlier. It also ships an MCP Apps result card for hosts that show one.

Step-by-step setup for each app: MCP server guide.

Auth: OAuth 2.1 with S256 PKCE. The user approves each app on a consent screen that shows its name and where it returns. Clients identify themselves with a Client ID Metadata Document (an https client_id), or register dynamically. The authorization server requires the resource to be this site's /mcp (RFC 8707), returns iss on every redirect (RFC 9207), rotates refresh tokens and supports revocation at /api/auth/mcp/revoke (RFC 7009). Clients discover all of it from the 401 challenge:

To disconnect an assistant, use Settings → Connected apps. Its access stops immediately.