NanoPic

Hosted MCP server for AI image generation and editing (GPT Image 2.6, Nano Banana), billed per image in credits.

Hosted MCP Server

npx add-mcp 'https://nanopic.net/api/mcp'

Installs into Claude Code, Codex, Cursor and more

Documentation

Connect Claude Code, Codex, Cursor or any MCP client to NanoPic and generate or edit images from your coding agent with one API key. Setup, tools, credit pricing and example prompts.

Last updated: 2026-11-06

NanoPic runs a remote Model Context Protocol (MCP) server. Add it to your coding agent once and you can ask for images in plain language: a hero image for a landing page, an app icon, a transparent product cutout, an edit of a screenshot in your repo. The agent calls NanoPic, gets back image URLs and can save the files straight into your project.

It uses the same models, credits and prices as the NanoPic web editor. There is nothing to install: it is a hosted HTTP endpoint.

Quick facts

  • Endpoint: https://nanopic.net/api/mcp
  • Transport: Streamable HTTP
  • Auth: Authorization: Bearer sk_... with an API key from Settings → API Keys
  • Tools: generate_image, edit_image, create_upload_url, get_account
  • Billing: the credits on your NanoPic account, at the same prices as the website

1. Create an API key

Sign in, open Settings → API Keys and create a key. It starts with sk_. The key is shown once, so copy it somewhere safe.

Anyone who has the key can spend your credits. Keep it out of git, and delete it from the same page if it leaks.

2. Connect your agent

Claude Code

Run this in a terminal, replacing sk_... with your key:

claude mcp add --transport http nanopic https://nanopic.net/api/mcp \
  --header "Authorization: Bearer sk_..."

Run /mcp inside Claude Code to check that nanopic is connected. Add --scope user to make it available in every project.

Codex

Put the key in your shell profile (~/.zshrc or ~/.bashrc):

export NANOPIC_API_KEY="sk_..."

Then add the server to ~/.codex/config.toml:

[mcp_servers.nanopic]
url = "https://nanopic.net/api/mcp"
bearer_token_env_var = "NANOPIC_API_KEY"
# Image generation can take over a minute; Codex's default is 60s.
tool_timeout_sec = 300

Keep tool_timeout_sec = 300. Codex stops waiting for a tool after 60 seconds by default, and larger images or edits with several source images can take longer than that. If a call times out, Codex reports a failure even though the image may still finish and be billed.

Cursor, Windsurf, Cline and other clients

Clients configured with JSON (Cursor's ~/.cursor/mcp.json or .cursor/mcp.json in a project, Windsurf, Cline, Claude Desktop with remote servers…) take this block:

{
  "mcpServers": {
    "nanopic": {
      "type": "http",
      "url": "https://nanopic.net/api/mcp",
      "headers": {
        "Authorization": "Bearer sk_..."
      }
    }
  }
}

Some clients call the field serverUrl instead of url, or omit type. Any client that supports remote MCP servers over Streamable HTTP with a custom header works.

3. Ask for an image

Talk to your agent normally. A few prompts to start with:

Use nanopic to generate a 16:9 hero image for this project's landing page and save it to public/hero.png
Make a flat app icon for this app as an SVG with nanopic and put it in public/icon.svg
Upload screenshots/home.png to nanopic and turn it into a clean marketing shot on a soft gradient background, 4:3
Generate a transparent PNG of a ceramic coffee mug for the product page, 2K, using nano-banana-pro
Check my nanopic balance and tell me what a 4K image costs on each model

The agent picks the tool, the model and the aspect ratio from what you ask. You can name a model id or a resolution tier to override its choice.

Tools

generate_image

Creates an image from a text prompt and returns public URLs of the files. Takes 10 to 90 seconds.

  • prompt (required): what to draw. English prompts work best.
  • model: one of the model ids in the table below. Default gpt-image-2.6-flare.
  • aspect_ratio: for example 1:1, 16:9, 9:16, 4:3, or auto (the model decides).
  • resolution: 1k, 2k or 4k. Higher tiers cost more.
  • output: image (default), transparent (PNG cutout), gif (looping animation) or svg (flat vector icons and logos).

edit_image

Edits, restyles or combines existing images following an instruction. Takes the same prompt, model, aspect_ratio and resolution as generate_image, plus:

  • images (required): 1 to 8 https URLs. Use earlier results, any public image URL, or files uploaded with create_upload_url. With several images, refer to them in the prompt as "image 1", "image 2" and so on.
  • output: image (default) or transparent.

create_upload_url

Returns a short-lived upload URL so the agent can send local files with curl and then pass the returned URLs to edit_image. Accepts PNG, JPEG, WebP, GIF, AVIF and HEIC, up to 10 MB each and 10 files per request. Free.

get_account

Returns your credit balance, whether your images carry a watermark, and the credit price of every model. Free.

Credit pricing

Each generated image costs credits from your NanoPic balance, depending on the model and resolution tier:

ModelModel id1K2K4KDefault tier
GPT Image 2gpt-image-21231K
Nano Banana Pronano-banana-pro3342K
Nano Banana 2.1nano-banana-2.12231K
GPT Image 2.6 Flare(default)gpt-image-2.6-flare1461K
GPT Image 2.6 Sunburstgpt-image-2.6-sunburst1571K
  • gif and svg outputs cost a flat 3 credits.
  • transparent PNGs cost at least 2 credits.
  • create_upload_url and get_account are free.
  • If a generation fails, its credits are refunded automatically.

Buy credits or a plan on the pricing page. Accounts that have never bought credits get a small NanoPic watermark on their images; any credit pack or plan removes it.

FAQ

Do I need to install anything?

No. NanoPic's MCP server is hosted. Your agent connects to https://nanopic.net/api/mcp over HTTPS with your API key.

Where do the generated images go?

Each result is a public https URL on NanoPic's storage. Ask the agent to download it if you want the file in your project, for example "save it to public/hero.png".

Can it edit images on my computer?

Yes. The agent calls create_upload_url, uploads the local file with curl, then calls edit_image with the uploaded URL. You just name the file in your prompt.

Is it the same as the web editor?

Yes. The same models, credit prices, refunds, watermark rules and content moderation apply. Images made through MCP use the credits on the account that owns the API key.

Codex says the tool timed out. What now?

Set tool_timeout_sec = 300 under [mcp_servers.nanopic] in ~/.codex/config.toml and restart Codex. The default 60-second limit is too short for some generations.

Contact

Questions or problems? Open a ticket from Settings → Tickets and we will get back to you.