Skip to content

Image understanding (ask about a photo)

quoted per request from $0.01USDC via x402POST /api/image-describe

Image understanding: ask one question about a photo or picture, or about up to 10 at once, and get an answer for each...

Category: AI & computeTags: vision image-understanding photo picture describe visual-question-answering image-analysis aiAlso found as: image-understanding vision photo-question describe-image image-question

Try in playground →

Details

Image understanding: ask one question about a photo or picture, or about up to 10 at once, and get an answer for each: what is in this photo, is there a dishwasher in this picture, what color is the door. Each result carries answer, confidence (high, medium or low, the model's own word) and a short reason; "can't tell" is an answer when the picture does not show enough. For a yes or no question, overall combines the pictures. Send imageUrl, imageUrls or image (base64); PNG, JPEG, WebP or GIF up to 8 MB. It is told never to identify a person, and an answer it flags as naming one is withheld. $0.01 per image, quoted in the 402. An image that failed is named in its result; upto and credits payments cover only the images answered. Some calls are paid before they run; a failed one can be retried free with the same payment, or is refunded. Model-backed: answers can be wrong. To read printed text use image-ocr; to list a page's photos use page-images.

Parameters

NameTypeRequiredDescription
questionstringyesOne question about the image (max 500 chars) Up to 500 characters. The example sends Is there a refrigerator in this kitchen?.
imageUrlstringnoPublic http(s) URL of one image (robots.txt honored)
imageUrlsarray of stringnoSeveral image URLs, up to 10 images a call Up to 10 items.
imagestringnoOne image inline: base64 or a data: URL

Example request

curl -i -X POST https://agent402.tools/api/image-describe \
  -H "Content-Type: application/json" \
  -d '{"question":"Is there a refrigerator in this kitchen?","imageUrl":"https://agent402.tools/fixtures/sample-kitchen.png"}'

Watch a call get paid

RequestPOST /api/image-describe
402from $0.01 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "question": "Is there a refrigerator in this kitchen?",
  "results": [
    {
      "image": "https://agent402.tools/fixtures/sample-kitchen.png",
      "answer": "yes",
      "confidence": "high",
      "reason": "A tall gray refrigerator stands at the left of the counter."
    }
  ],
  "overall": {
    "answer": "yes",
    "confidence": "high",
    "image": "https://agent402.tools/fixtures/sample-kitchen.png"
  },
  "answered": 1,
  "failed": 0,
  "model": "openai/gpt-6-luna",
  "untrustedContent": true,
  "aiGenerated": true
}
FieldTypeAlways presentIn the example
questionstringyesIs there a refrigerator in this kitchen?
resultsarray of objectsyes1 item in the example
overallobjectyes3 fields: answer, confidence, image
answerednumberyes1
failednumberyes0
modelstringyesopenai/gpt-6-luna
untrustedContentbooleanyestrue
aiGeneratedbooleanyestrue

From an MCP client

catalog.call {
  "slug": "image-describe",
  "params": {
    "question": "Is there a refrigerator in this kitchen?",
    "imageUrl": "https://agent402.tools/fixtures/sample-kitchen.png"
  }
}

Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.21.0): pays from a wallet or AGENT402_CREDITS_KEY.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.10" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/image-describe", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "question": "Is there a refrigerator in this kitchen?",
    "imageUrl": "https://agent402.tools/fixtures/sample-kitchen.png"
  }),
});

Get a wallet or run npx -y agent402-mcp@0.21.0 wallet new.

The quote (Python)

import base64, json, urllib.error, urllib.request

req = urllib.request.Request("https://agent402.tools/api/image-describe", method="POST", data="{\"question\":\"Is there a refrigerator in this kitchen?\",\"imageUrl\":\"https://agent402.tools/fixtures/sample-kitchen.png\"}".encode(), headers={"Content-Type": "application/json"})
try:
    urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
    quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
    print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]])  # the price, per chain, in base units

Part of these workflows

Related tools