Image understanding (ask about a photo)
POST /api/image-describeImage understanding: ask one question about a photo or picture, or about up to 10 at once, and get an answer for each...
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
| Name | Type | Required | Description |
|---|---|---|---|
question | string | yes | One question about the image (max 500 chars) Up to 500 characters. The example sends Is there a refrigerator in this kitchen?. |
imageUrl | string | no | Public http(s) URL of one image (robots.txt honored) |
imageUrls | array of string | no | Several image URLs, up to 10 images a call Up to 10 items. |
image | string | no | One 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
POST /api/image-describefrom $0.01 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example 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
}| Field | Type | Always present | In the example |
|---|---|---|---|
question | string | yes | Is there a refrigerator in this kitchen? |
results | array of objects | yes | 1 item in the example |
overall | object | yes | 3 fields: answer, confidence, image |
answered | number | yes | 1 |
failed | number | yes | 0 |
model | string | yes | openai/gpt-6-luna |
untrustedContent | boolean | yes | true |
aiGenerated | boolean | yes | true |
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
- Pay per request ($0.01 to $0.1, quoted from this body) over x402 or MPP. Wallet-only, model-backed: no proof-of-work tier; the same input can give a different result. A prepaid card-credits key (
Authorization: Bearer a402_...) also pays it. - Required:
question; a rejected input answers 4xx witherror,tool,expected,requiredandexample. - On this route, a call ending in any status of 400 or above is not charged over x402, MPP or a credits key. Some calls are paid before they run; a failed one can be retried free with the same payment, or is refunded. A Tempo push credential pays before the call; a failure is a refund owed.
- A bodyless
GETorHEADreturns the same 402 quote. - An
Idempotency-Keyreplays the first 200 uncharged (an answer larger than 1 MB is not replayed).
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