Agent Image: POST /agent/image

Generate one hosted still image from a text prompt, as PNG or JPEG. One call costs $0.15 in USDC on Base, the lowest price of the three endpoints, which also makes it the cheapest way to test a full payment round trip.

What it is for

Album and single cover art, podcast and video thumbnails, social and campaign graphics, concept art, storyboard frames, product shots and article illustrations. Frame it square, portrait or widescreen.

At a glance

EndpointPOST https://app.suedeai.ai/agent/image
Price$0.15, amount 150000 USDC base units
Paymentx402 exact on eip155:8453 to 0x10FF767043A1723E0BB5B9207bC37D3442cC9E4F, or a Skyfire token
OutputOne hosted PNG or JPEG
Paid response202 Accepted with jobId and pollUrl
PollGET https://app.suedeai.ai/agent/image/{jobId}, free
IdentifiersOpenAPI operationId, A2A skill and MCP tool: agent_image

Make your first call without spending

First confirm your client can reach the endpoint and read a payment challenge. The following request has no payment credential. It requests a challenge, not a render.

curl -sS -i https://app.suedeai.ai/agent/image \
  -H 'Content-Type: application/json' \
  -H 'Suede-API-Version: 1' \
  --data-binary '{"prompt":"An unlettered red record sleeve on a cream counter","aspectRatio":"1:1","outputFormat":"png"}'
  1. Expect HTTP 402. Inspect x402Version, resource.url and accepts. A challenge is not a successful request and does not prove the image body is valid.
  2. Compare the resource and accepted payment terms with the live discovery manifest and your own allowlist. For direct x402, check the network, token, recipient and amount before signing. The price shown in this guide is a reference, not approval to spend.
  3. When authorized to spend, use the x402 quickstart or Python SDK to submit the same URL and body with PAYMENT-SIGNATURE. Save the returned job before showing the caller a success screen.

The public x402 flow does not require a Suede account or Suede API key. The published OpenAPI also documents a Skyfire pay or kya-pay JWT supplied in the same header for the Skyfire rail. Treat both as sensitive. Keep wallet keys, signatures and payment tokens out of browser code, logs and analytics. A GET of the returned job URL does not require another authorization.

Request body

FieldTypeRequiredDescription
promptstringYesVisual prompt describing the image to generate.
aspectRatiostringNoOne of 1:1, 9:16, 16:9, 3:4, 4:3, 3:2, 2:3, 5:4, 4:5, 21:9.
outputFormatstringNopng or jpeg.
asyncModebooleanNoSwitches asynchronous mode on, never off. Paid calls are already asynchronous.

The ten aspect ratios cover square (1:1), portrait (4:5, 3:4, 2:3, 9:16) and landscape or widescreen (5:4, 4:3, 3:2, 16:9, 21:9) framing.

Choose an execution mode before you sign

RequestModeWhat the client should do
Paid POST without an async query parameterAsync, even with asyncMode: falseHandle 202; store the job ID and status URL.
?async=trueAsync; wins over the bodyUse this literal if explicitly choosing async.
?async=falseBlocking; wins over the bodyInspect the body even on 200. It can report processing or failure without an image.

Use the default for paid calls unless you have a reason to block. Do not send ?async=1, yes or on; the implementation treats them as false. There is no documented caller-controlled pixel-size, seed, transparency, or edit input in the request. Check the file you receive rather than inferring its properties from the prompt.

Example: square cover art

Get the 402 challenge first (amount 150000, priceUsd $0.15), sign it as shown in the quickstart, then send:

curl -i -X POST https://app.suedeai.ai/agent/image \
  -H 'Content-Type: application/json' \
  -H "PAYMENT-SIGNATURE: $PAYMENT" \
  -H 'X-Idempotency-Key: cover-art-0001' \
  -d '{
    "prompt": "Album cover, neon city at night, rain on glass",
    "aspectRatio": "1:1",
    "outputFormat": "png"
  }'

Response to a paid call: 202 Accepted

The discovery document gives this example body:

{
  "jobId": "image-job-example",
  "status": "queued",
  "provider": "suede",
  "pollUrl": "https://app.suedeai.ai/agent/image/image-job-example"
}

With ?async=false, a successful HTTP response is 200 with the same response fields as the poll below. Read status before treating it as a finished asset.

Polling: GET /agent/image/{jobId}

Poll until status is completed, with imageUrl set, or failed. Both are final; queued and processing mean poll again.

FieldDescription
jobIdThe render's job identifier.
statusqueued, processing, completed or failed.
providerThe provider handling the render.
imageUrlThe generated image once complete; null until then.
pollUrlSet on the 202 accept; null on a poll response.

An unknown or expired jobId answers 200 with status failed, not 404. On 2026-10-11 that response looked like this:

{"jobId":"unknown-job-id","imageUrl":null,"status":"failed","provider":"suede","pollUrl":null,"error":"Generation failed. Please try again."}

One campaign, two placements: crop or generate again?

Suppose a record shop needs a square release tile and a vertical story. If the customer expects the same photograph in both placements, start with one image. Ask for the record sleeve in the center, with enough background around it for a crop. A second prompt is a new generation, not a resize of the first image.

  1. Brief the composition. For a square tile, try: “Overhead photograph of a red record sleeve on a cream counter, sleeve centered, blank space above, no lettering.” Add the shop name in your layout after the image is ready so its spelling and placement stay under your control.
  2. Test both crops before buying another render. Place the returned file in the square tile and a 9:16 story mockup. Check whether either crop cuts off the sleeve, hides the title area or leaves a price sticker unreadable at phone size.
  3. Make the revision match the problem. If only the lettering fails, fix the overlay. If the vertical crop removes the subject, request a separate 9:16 composition. Review the current challenge before approving that additional paid call.

For handoff, keep the accepted image, its placement, the request body and the job ID together. Record whether the story is a crop or a separate render. That gives the next designer a specific asset to revise rather than a prompt to guess from.

Poll an accepted job with Python

Pass the pollUrl saved from your 202 response. This standard-library example uses only GET and never authorizes another payment. It backs off on throttling, server errors and transport errors, and stops on a failed job or a payment reconciliation signal. It schedules requests within an overall polling window and gives each request its own socket timeout. A production worker can schedule individual polls instead of sleeping.

import json
import time
from urllib.error import HTTPError, URLError
from urllib.parse import urlsplit
from urllib.request import HTTPRedirectHandler, Request, build_opener


class NoRedirect(HTTPRedirectHandler):
    def redirect_request(self, req, fp, code, msg, headers, newurl):
        return None


def poll_image(poll_url, *, deadline_seconds=120, request_timeout=10):
    url = urlsplit(poll_url)
    if (url.scheme, url.netloc) != ("https", "app.suedeai.ai"):
        raise ValueError("Use the status URL returned by Suede")
    if not url.path.startswith("/agent/image/") or url.query or url.fragment:
        raise ValueError("Expected an Agent Image status URL")

    opener = build_opener(NoRedirect())
    deadline = time.monotonic() + deadline_seconds
    delay = 1.0
    while (remaining := deadline - time.monotonic()) > 0:
        pause = delay
        try:
            req = Request(poll_url, headers={"Accept": "application/json"})
            with opener.open(req, timeout=min(request_timeout, remaining)) as res:
                raw = res.read(65537)
                if len(raw) > 65536:
                    raise RuntimeError("Status response too large")
                job = json.loads(raw)
        except HTTPError as exc:
            if exc.code == 402:
                raise RuntimeError("Reconcile the original payment") from exc
            if exc.code != 429 and not 500 <= exc.code <= 599:
                raise
            retry_after = exc.headers.get("Retry-After", "")
            if retry_after:
                if not (retry_after.isascii() and retry_after.isdecimal()):
                    raise TimeoutError("Defer polling using Retry-After") from exc
                seconds = retry_after.lstrip("0") or "0"
                if len(seconds) > 2 or int(seconds) > 30:
                    raise TimeoutError("Defer polling using Retry-After") from exc
                pause = max(pause, int(seconds))
        except (URLError, TimeoutError):
            pass
        else:
            status = job["status"]
            if status == "completed":
                result = job.get("imageUrl")
                if not isinstance(result, str) or not result:
                    raise RuntimeError("Completed without an image URL")
                return result
            if status == "failed":
                raise RuntimeError(job.get("error") or "Render failed")
            if status not in ("queued", "processing"):
                raise RuntimeError(f"Unexpected job status: {status}")
        time.sleep(max(0, min(pause, deadline - time.monotonic())))
        delay = min(delay * 2, 10.0)
    raise TimeoutError("Polling deadline reached; resume the same job later")

The return value is an image URL, not downloaded bytes. Pass it to the asset delivery step. Keep the saved job if this function times out. Its backoff is capped at 10 seconds, and it honors numeric server hints of up to 30 seconds. If your deployment uses longer retry hints or HTTP-date hints, defer the job to your scheduler instead of polling sooner.

Build a worker that can recover without buying a second image

Separate submit, poll and download into different steps. The submit worker is the only part that authorizes payment; the poller receives an existing job ID and cannot start another render. For a dashboard, send your own internal request ID to the browser and proxy status through your application. The public poll route itself needs no payment, so treat the job ID and status URL as private references.

  1. Prepare: authenticate your user, validate the body against the published schema, and save an internal request ID, exact body, target URL, one server-generated idempotency key, and the approved spending cap. Use a unique database constraint or worker lease so a double-click cannot cause two simultaneous renders.
  2. Authorize: fetch the challenge and compare it to policy. If the requested price exceeds the cap or the resource, chain, token or recipient differs from your allowlist, stop before signing. Record the rail, amount and decision, not the signed authorization itself.
  3. Submit: use the approved payment client and persist jobId, pollUrl and any available non-secret payment reference before releasing the worker lease. If the paid request times out before returning a job, record an ambiguous submit. Do not silently start a second paid request or mint another authorization.
  4. Reconcile: look for the original job and settlement using your payment client or provider records. Use the same request body and X-Idempotency-Key for any authorized replay within the documented caching window; the key is not an exactly-once billing guarantee. Escalate when you cannot establish what happened rather than automatically buying another image.
  5. Finish: poll with a timeout per GET, bounded backoff and a separate overall deadline. Record transitions, keep the job attached when your deadline expires, and resume the GET later if needed. At completion, download and validate the file before marking it ready.
# Worker pseudocode: payment/client and storage are your adapters.
row = load_and_lease(request_id)
if row.job_id:
    schedule_poll(row.job_id)
elif row.state in ("submitting", "ambiguous_submit"):
    schedule_reconciliation(row.id)
else:
    terms = get_unpaid_challenge(row.url, row.body)
    require_policy_match(terms, row.approved_cap)
    persist_state(row.id, "submitting")
    try:
        reply = authorized_post_once(row.url, row.body, row.key, terms)
    except TransportError:
        persist_state(row.id, "ambiguous_submit")
    else:
        if reply.http_status == 202 and valid_job_reference(reply):
            persist_job_and_schedule_poll(row.id, reply)
        else:
            record_response_for_classification(row.id, reply)

Write the submitting state before the paid network call. If the worker crashes between payment and saving the response, a replacement worker will reconcile rather than assume the job was never submitted. Do not accept arbitrary polling URLs from a browser or follow cross-origin redirects with a payment header.

State transitions and failure decisions

SignalClient transitionNext action
Unsigned POST returns 402Awaiting authorizationEvaluate the challenge; no job exists merely because terms were offered.
Authorized POST returns 202 and a job referenceQueuedSave the job and poll. Do not resubmit while waiting.
GET reports queued or processingIn progressSchedule another GET. If your deadline expires, resume later using the same reference.
GET reports completed with imageUrlAsset availableFetch, decode and inspect the file before delivery. If download alone fails, retry the download, not generation.
GET reports failedTerminal render failureKeep the job and error for support and reconcile payment separately. An unknown ID can also return this status with HTTP 200; first check that the ID was preserved correctly.
HTTP 400 or 422Invalid requestRead the error, correct input or version, and treat a changed render body as a new intent. Validate locally before authorizing payment.
402 after attaching paymentAuthorization not acceptedInspect the challenge and retry hint. Check expiration, network and rail configuration. Do not loop signing new authorizations.
Poll GET returns 402 with payment_requiredPayment not verified for this jobStop and reconcile the original payment; do not attach a new payment to the GET.
HTTP 429ThrottledHonor Retry-After when supplied. Retain the job if there is one; keep polling and spending retries separate.
Network timeout or 5xx on paid POSTPotentially ambiguous submitReconcile before authorizing a replacement. A network error does not tell you whether your request reached the server.
Unexpected body, missing URL, or unknown statusNeeds investigationDo not interpret a malformed payload as either a finished asset or permission to pay again.

Translate placement dimensions into a framing choice

aspectRatio asks for a shape, not a pixel count. A 1080 × 1920 story slot is 9:16, but requesting 9:16 does not promise that the returned image is exactly 1080 × 1920. Read the actual dimensions after decoding, then crop, pad or resize in your application as needed. These are example placement sizes, not Suede output sizes.

Placement exampleRequest ratioComposition instruction
1080 × 1080 release tile1:1Keep the sleeve central and reserve space above for a separately typeset title.
1080 × 1350 portrait card4:5Leave breathing room above and below a person or a tall product.
1080 × 1920 story9:16Protect the center from captions and interface controls; preview the actual placement.
1920 × 1080 article banner16:9Keep the subject to one side if the headline will sit on the opposite side.
2100 × 900 wide masthead21:9Keep important details near the vertical center and away from either edge.

A centered 9:16 crop of a square source keeps the middle 56.25% of its width if it keeps the full height. If the sleeve fills 75% of the original width, that crop cannot retain it. Padding preserves the whole original at the cost of spare space; a new portrait render can recompose the scene, but it costs another call and may not match the first image. CSS object-fit: cover changes what the viewer sees, not the source file. Export a derivative if a downstream platform needs the crop baked in.

For an editorial illustration, brief subject, camera or viewpoint, lighting and empty space. For a product page, keep the actual product photo as the source of truth; use the generated image for concepts or atmosphere rather than treating a generated label, color or shape as the real item. For a storyboard, use one frame per shot and treat continuity between separately generated frames as something to review, not an API guarantee.

Turn the hosted image into a usable asset

  1. Validate the URL in your downloader. Require HTTPS, enforce your allowed destinations and redirect policy, and do not forward payment credentials. Apply a byte limit and request timeout.
  2. Verify the decoded format and dimensions against your delivery needs. A file extension or successful HTTP response does not prove the bytes are a valid PNG or JPEG. Check transparency explicitly if the placement needs it; choosing PNG alone does not request transparency.
  3. Keep a controlled original for workflows that need stable storage. Save placement-specific derivatives separately, record the source job ID and requested format, and preserve the original for a future crop. Do not depend on an undocumented retention period.
  4. Preview at the actual display size. For visual acceptance, check subject framing, unintended marks or text, the placement of overlays and whether the asset still communicates the brief on a phone. For publishing, add your own text alternative where the image conveys information.

Test the full integration with fixtures before a paid smoke test

Use a local HTTP stub or recorded, redacted responses. Assert network calls as well as on-screen state. A status badge can look correct while the client has accidentally submitted a second charge.

FixturePass condition
Unsigned 402 for the expected resourceTerms are parsed and displayed; zero paid POSTs are made without approval.
Wrong recipient, unsupported network or price above capNo signing and no paid POST, even if the challenge is otherwise well formed.
Two clicks or two workers for one requestOne paid submit attempt; both clients resolve to one internal record.
202, then processing, then completedThe job survives restart. Only GETs occur after accept, and the decoded file is delivered once.
Response dropped after submittingRequest is flagged for reconciliation. Re-running the worker does not sign again.
HTTP 200 with failed, plus a separate malformed completionEach is recorded with its own reason; neither is marked delivered or automatically re-rendered.
Poll deadline and throttled GETBackoff respects a retry hint; later resumption uses the same job without a paid POST.
Completed response with a bad image or rejected download destinationAsset delivery is blocked and the render remains linked to its original job.

If you choose to do one real smoke test, authorize one known-valid request at the live terms. Keep evidence of the challenge, accepted job, terminal response, decoded image and payment reference, with credentials removed. Use fixtures for invalid paid requests and ambiguous settlement rather than spending to manufacture failures.

Sources

  • app.suedeai.ai/.well-known/x402: description, price, payment requirement, input schema and example output (resource entry last updated 2026-08-30).
  • app.suedeai.ai/openapi.json: operations agent_image and agent_image_status.
  • Live requests on 2026-10-11: the unpaid 402 challenge and a poll for an unknown jobId.