Generate images for a website with Claude Code and Sume MCP
Connect Claude Code to Sume's hosted MCP with Write access, preview the cost with dry_run, then generate site images and save them in your repo.

To generate images for a website from Claude Code, connect it to Sume's hosted MCP server at https://mcp.sume.com/mcp with Write access, have it call generate_image with a prompt, an aspect_ratio, and an idempotency_key, wait on the job with jobs_wait, and save each finished image into your repo.
Facts come from Sume's MCP quickstart, MCP tools and gates, and Image API docs, read on 2026-09-27. Sume basics says hosted MCP still works but is not part of the primary path today, so reach for it when your environment is an MCP client such as Claude Code; from a backend, the same call is POST /v1/images on the Developer API. Setup is covered in Connect Claude Code, Cursor, or Codex to Sume.
What access does Claude Code need?
Write access: default hosted OAuth is read-only (mcp:read), and paid tools such as generate_image return insufficient_scope until you turn Write on at consent or use an API-key session, as the setup guide explains.
Before the first image, have Claude Code call mcp_health, which confirms the endpoint, auth source, and safety posture, and check that generate_image is in tools_list: under mcp:read alone, paid tools are hidden. Keep API keys out of the chat; the quickstart prefers the OAuth connector flow for interactive clients.
Which Sume tools does Claude Code call, in order?
Tool ids use underscores. tools_list shows what your session can see; this is the path for one image:
| Tool | What it does here |
|---|---|
tools_schema | Returns the live contract for name: "generate_image". |
image-models_list / image-models_get | Catalog reads, for a model id and the parameters it accepts. |
generate_image with dry_run: true | Admission and cost preview only. No job is submitted. |
generate_image | Paid submit. Needs a fresh idempotency_key. |
jobs_wait | Waits for the job, at most 55 seconds per call. |
jobs_result | Returns the finished images. |
How do I check the cost before an image is generated?
Follow Sume's inspect-before-paying playbook: read the schema, call generate_image with dry_run: true (or generation_admission_preview), confirm the estimate, balance, and queue behavior, then submit again without dry_run and with a fresh idempotency_key. max_spend_usd caps the call, and it is enforced only when you send it.
Omit payload.model and Sume picks the family as sume/auto, and never discloses which one ran. To pin a model, pass a catalog id from image-models_list. These are the arguments for a preview of a wide hero image:
{
"idempotency_key": "site-hero-2026-09-27",
"dry_run": true,
"max_spend_usd": 1,
"payload": {
"prompt": "Wide hero illustration of a tidy home office at sunrise, soft light, no text",
"aspect_ratio": "16:9"
}
}Which sizes and formats should I ask for?
Start from a ratio and, where the model has one, a tier. A model only accepts the values its catalog descriptors list, so have Claude Code read supported_parameters with image-models_get before it pins any of these:
aspect_ratio: normalized ratios such as16:9for a wide hero,1:1,4:5, or9:16.autoleaves the choice to the provider.resolution:512,1K,2K, or4K, on models that have a resolution descriptor.output_format:png,jpeg,webp, orsvg.n: up to 10 images per call; per-model ceilings are lower.- For a cutout with a transparent background, run
rmbg_createon the finished image. RMBG 1.0 returns PNG artifacts with alpha, per the Sume API reference; the remove background API covers the call.
How do the images end up in my repo?
In the current code, generate_image submits POST /v1/images as an async job by default, so the tool answers with a job, not the image. Call jobs_wait with its job_id. A wait holds at most 55 seconds (50 by default); on wait_slice_expired, call jobs_wait again with the same id and never resubmit the paid create. An image still running at 50 seconds is usually stuck rather than slow. Then jobs_result returns the images.
Hosted MCP is a remote server that cannot read files from your laptop, so saving the images is Claude Code's job: ask it to download each one into the repo, for example under public/images/, and reference that path in your pages rather than the Sume URL. The Image API describes its result URLs as Sume-hosted and signed, and Sume's safe-automation guide lists signed URLs among the things not to log.
How do I generate a whole set of site images at once?
Use script_run when a turn needs three or more calls of the same shape, such as one generate_image per page section. It runs a short JavaScript program on the Sume side under the same gates, and every paid call inside still needs its own idempotency_key. The run is bounded by timeout_seconds (5–55), max_calls, and max_paid_calls, and returns the child jobs[]; programmatic tool calling covers the budgets.
Then wait once: jobs_wait accepts job_ids with 1–20 ids and wait_for: "all" by default. Image models are metered per image, a completed generation is billed in full, and a failed or canceled one is not billed. Custom pixel sizes are covered in image aspect ratios and custom sizes.
Sources
Related posts
More in Agents
- Summarize a video with an API: transcript, stills, then JSON
Summarize a Sume-hosted video: pull stills and a transcript with POST /v1/video-inspect, then send both to Agent Completions with an output_schema.
- What is Sume? A video agent platform, its API, and billing
Sume is a video agent platform: brief an agent in chat, save the recipe as a Format, and call it from your backend over one API. Surfaces and billing.
- Run the Sume video agent from your backend with Agent Completions
POST /v1/agent/completions runs the same agent as the Sume Agents chat, with tools and media generation, and returns an async run receipt you poll or webhook.
- Safe automation for AI agents that call paid APIs
Keep agents read-only by default, keep secrets out of logs, and on hosted MCP send an idempotency_key, preview with dry_run, and cap with max_spend_usd.
Written by Sume