{"openapi":"3.1.0","info":{"title":"Agent Image Compression API","description":"Pay-per-image compression for AI agents. Send an image URL (or upload a file); get back a smaller PNG / JPEG / WebP / AVIF and the bytes saved.","version":"0.1.0","x-guidance":"Compress images for a small per-image fee. Primary endpoint: POST /api/compress with JSON { \"url\": \"<https image url>\", \"format\"?: \"png\"|\"jpeg\"|\"webp\"|\"avif\", \"quality\"?: 1-100, \"maxWidth\"?: number, \"maxHeight\"?: number }. Returns JSON { format, contentType, inputBytes, outputBytes, percentSaved, width, height, image (base64) }. Each call costs the advertised price; pay via x402 (USDC on Base/Solana) or MPP (Tempo). You are only charged on a successful compression — bad URLs, unsafe targets, oversized or unsupported images return a JSON error and no charge. There is also POST /api/compress-upload (multipart field \"file\") and a free GET /api/health.","guidance":"Compress images for a small per-image fee. Primary endpoint: POST /api/compress with JSON { \"url\": \"<https image url>\", \"format\"?: \"png\"|\"jpeg\"|\"webp\"|\"avif\", \"quality\"?: 1-100, \"maxWidth\"?: number, \"maxHeight\"?: number }. Returns JSON { format, contentType, inputBytes, outputBytes, percentSaved, width, height, image (base64) }. Each call costs the advertised price; pay via x402 (USDC on Base/Solana) or MPP (Tempo). You are only charged on a successful compression — bad URLs, unsafe targets, oversized or unsupported images return a JSON error and no charge. There is also POST /api/compress-upload (multipart field \"file\") and a free GET /api/health.","contact":{"url":"https://workeron.ai"}},"servers":[{"url":"https://agent-image-compress-production.up.railway.app"}],"tags":[{"name":"Api"}],"paths":{"/api/health":{"get":{"operationId":"api_health","summary":"api/health","tags":["Api"],"security":[],"responses":{"200":{"description":"Successful response"}}}},"/api/compress":{"post":{"operationId":"api_compress","summary":"Compress an image fetched from a URL. Charged per successful image.","tags":["Api"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.005"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"HTTPS URL of the source image to compress."},"format":{"description":"Target output format. Defaults to the input format.","type":"string","enum":["png","jpeg","webp","avif"]},"quality":{"description":"Encoder quality 1-100. Defaults to 80.","type":"integer","minimum":1,"maximum":100},"maxWidth":{"description":"Max output width in px. Never upscales.","type":"integer","minimum":1,"maximum":20000},"maxHeight":{"description":"Max output height in px. Never upscales.","type":"integer","minimum":1,"maximum":20000}},"required":["url"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"format":{"type":"string","enum":["png","jpeg","webp","avif"],"description":"Output image format."},"contentType":{"type":"string","description":"MIME type of the returned image."},"inputBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Source size in bytes."},"outputBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Compressed size in bytes."},"percentSaved":{"type":"number","description":"Percent reduction (can be negative)."},"width":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Output width in px."},"height":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Output height in px."},"image":{"type":"string","description":"Base64-encoded compressed image bytes."}},"required":["format","contentType","inputBytes","outputBytes","percentSaved","width","height","image"],"additionalProperties":false}}}},"402":{"description":"Payment Required"}}}},"/api/compress-upload":{"post":{"operationId":"api_compress-upload","summary":"Compress an uploaded image file (multipart field \"file\").","tags":["Api"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.005"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}}]},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"format":{"type":"string","enum":["png","jpeg","webp","avif"],"description":"Output image format."},"contentType":{"type":"string","description":"MIME type of the returned image."},"inputBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Source size in bytes."},"outputBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Compressed size in bytes."},"percentSaved":{"type":"number","description":"Percent reduction (can be negative)."},"width":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Output width in px."},"height":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Output height in px."},"image":{"type":"string","description":"Base64-encoded compressed image bytes."}},"required":["format","contentType","inputBytes","outputBytes","percentSaved","width","height","image"],"additionalProperties":false}}}},"402":{"description":"Payment Required"}}}}}}