Agent API (x402)Create an image

Create an image through AiSpace

Sync paid calls. Catalogs are free. Origin: https://x402.aispace.bot. Pay this gateway (x402 USDC on Base or AISPACE_X402_KEY) — not Venice.

StepMethodPathPay?
List modelsGET/api/v1/models?type=image (edits: ?type=inpaint)Free
List style presetsGET/api/v1/image/stylesFree
GeneratePOST/api/v1/image/generatePaid
OpenAI-shaped generatePOST/api/v1/images/generationsPaid (n clamped to 1)
Edit one imagePOST/api/v1/image/editPaid
Combine 1–3 imagesPOST/api/v1/image/multi-editPaid
UpscalePOST/api/v1/image/upscalePaid
Cut out backgroundPOST/api/v1/image/background-removePaid

Unpaid generate/edit → 402. Cap spend with ?priceOnly=1 first. Details: Sync routes · Pricing.

1. Pick a model

GET /api/v1/models?type=image. Use the exact id (examples that are live as of this writing: flux-2-pro, grok-imagine-image-2-0; grok-imagine-image remains a fallback). Read that row’s model_spec for aspect ratios, resolutions, supportsStyleReferences, supportsTransparentBackground, and prompt limits. Do not guess those lists.

Edit / multi-edit models: GET /api/v1/models?type=inpaint (example: qwen-image-2-edit). Upscale and background-remove do not take a Venice model in the proxied body.

2. Generate

POST /api/v1/image/generate — required model, prompt. Optional documented fields: variants (1–4; this is the quantity billed), style_preset (from /image/styles), style_references ([{ image, strength? }] only when the model supports them), enhance_prompt, safe_mode (defaults false on this gateway — no adult-content blur; send true to blur), transparent_background (png/webp and catalog flag). Extra sizing fields the catalog lists (width / height / aspect_ratio) are forwarded.

200 is JSON { id, images[], request?, timing? } — base64 (often webp), not a raw PNG. variants only works on this JSON shape. /images/generations is the OpenAI-shaped alternative (n max 1).

Charge = catalog unit × variants (clamped to 4). You pay for every image requested. If Venice omits some variants for an explicit provider policy reject, the 200 still settles and x-venice-content-violation-count is the omitted count. A full-prompt 422 ImageContentViolationError is unpaid (settled: false). x-venice-is-blurred reports safe_mode blur.

3. Refine

JobPathBody notesDefault 200
Change one thing/image/editimage (HTTPS or plain base64, no data: prefix) + prompt. Optional model.Raw image file
Combine photos/image/multi-editVenice field is modelId (gateway maps model → modelId). images 1–3 + prompt.Raw image file
Bigger/image/upscaleimage only (URL or plain base64). scale 1–4 (default 2; scale=1 needs enhance=true). No model.Raw image file
Transparent PNG/image/background-removeimage XOR image_url. Optional model is priced then stripped.Raw image file

On edit / multi-edit / upscale / background-remove, omit return_binary for the file; return_binary: false returns JSON like generate ({ id, images: [base64], format }). The flag is gateway-owned and stripped before Venice.

This gateway unwraps data: URIs on edit/upscale into plain base64. Local filesystem paths are not accepted.

4. Deliver

Tell the user the model, prompt, and any seed/style you sent. Decode images[] from generate JSON, or save the binary body from edit/upscale/cutout when Content-Type is image/*.