Assert for pixels: two images (each an https URL or base64) measured by three deterministic witnesses — a 9×8 luma difference hash for structure, an 8×8 RGB signature for colour (the palette regression dhash is blind to), and the relative change of gradient energy for texture (smoothing, ringing) — each against a threshold you may set. The verdict is same or regression; the signed Assay record carries both images by sha256, width, height and bytes, the three distances and the thresholds, never pixels, so anyone holding the files can re-measure and anyone can verify the seal free at /v1/verify/{record_sha256}. Built for an agent that tests a game or a UI: the golden frame against today's.
curl 'https://api.s2ar.dev/v1/diff?a=https%3A%2F%2Fs2ar.dev%2Fexamples%2Fmedia%2Fscene.png&b=https%3A%2F%2Fs2ar.dev%2Fexamples%2Fmedia%2Fscene-rb.png'
curl -X POST https://api.s2ar.dev/v1/diff \
-H 'content-type: application/json' \
-d '{"a": "https://s2ar.dev/examples/media/scene.png", "b": "https://s2ar.dev/examples/media/scene-rb.png"}'
With a key: add -H 'Authorization: Bearer $S2AR_KEY'. Over x402, while sales are open: the same call at https://api.s2ar.dev/x402/v1/diff; unpaid, it answers 402 with the accepts[] to sign, then send the payment as PAYMENT-SIGNATURE (or X-PAYMENT). Sales are paused since 2026-10-16, and the mirror answers 410. From an agent: the MCP tool diff_images at https://api.s2ar.dev/mcp.
| parameter | type | required | what |
|---|---|---|---|
a | string | yes | the first image: an https URL of a PNG, JPEG or WebP up to 4 MB, or base64 |
b | string | yes | the second image, the same way |
threshold | number | dhash threshold (default 0.10) | |
color_threshold | number | colour-signature threshold (default 0.02) | |
grad_threshold | number | gradient-energy threshold (default 0.25) |
{
"ok": true,
"verdict": "regression",
"outcome": "fail",
"passed": 2,
"checks": 3,
"regressed": [
"color_sig"
],
"distances": {
"dhash": 0.0,
"color_sig": 0.21,
"grad": 0.0
},
"results": [
{
"check": "dhash",
"ok": true,
"distance": 0.0,
"threshold": 0.1
},
{
"check": "color_sig",
"ok": false,
"distance": 0.21,
"threshold": 0.02
}
],
"a": {
"sha256": "…",
"w": 800,
"h": 450,
"bytes": 212345
},
"b": {
"sha256": "…",
"w": 800,
"h": 450,
"bytes": 212401
},
"record_sha256": "c41d…",
"charged_usd": 0.005,
"receipt": {
"evidence_hash": "sha256:94abfed2…",
"cost_usd": 0.005,
"what": "diff",
"determinism": "replayable",
"witnesses": [
"dhash",
"color_sig",
"grad"
],
"issued_at": "2026-10-10T00:00:00Z",
"refund_rule": "failed calls are never charged",
"charter": "https://api.s2ar.dev/charter"
}
}
Every paid answer carries its receipt; a record's sha256 re-verifies free at /v1/verify/{sha256}. A call that fails is never charged.
diff two screenshots: the call, its answer and its record, re-derived.
The errors are the same on every route.