Image Compression

Compresses to a target quality or maximum byte size, reporting the achieved size and the quality actually used.

POST /v1/image/compress $0.01 per call

Specification

Endpoint
POST /v1/image/compress
Price
$0.01 per call · tier standard_data
Payment
x402 on X Layer (chain 196) · settled in USDG or USDT0 · scheme exact
Data source
Local sandboxed processing of the uploaded image
Timeout
60 seconds
Max request
20 MB
Version
1.0.0

Calling it

The first call returns a 402 with the payment challenge. Retry with a signed authorisation in the X-PAYMENT header — see the payment guide for the exact shape.

curl -i -X POST "https://api.dana-edu.pp.ua/v1/image/compress" \
  -H "content-type: application/json" \
  -d '{ ... }'

Response

Real output, captured by running this endpoint at build time — not written by hand. Volatile fields such as timestamps are elided. Captured 2026-07-30.

{
  "original_size_bytes": 405,
  "compressed_size_bytes": 430,
  "reduction_bytes": -25,
  "reduction_percent": -6.17,
  "quality_used": 80,
  "encode_attempts": 1,
  "source_format": "JPEG",
  "output_format": "JPEG",
  "dimensions": {
    "width": 64,
    "height": 64
  },
  "target_met": null,
  "output_base64": "<base64 payload elided from the published example>"
}

Every response is wrapped in the same envelope: data plus warnings, sources, confidence, informational_only and a measured processing_ms. See the envelope reference.

Related endpoints