
Qwen Image Edit Rapid
Image editing with Qwen-Image-Edit (Rapid AIO v23). THREE-STEP FLOW: (1) POST /call/infer submits a job and returns an event_id (paid). (2) GET /call/infer/{event_id} returns the result, which contains the output image path (free). (3) GET /file=<path> downloads the image bytes (free). Always retrieve the image through this proxy /file= endpoint; the hf.space url inside the result returns 403 for consumers.
https://proxy-monetize.fluxapay.xyz/api/qwen-image-edit-rapid-1/{CREATOR_UID}STEP 1 of 3 - SUBMIT. Submit an image-edit job; returns {"event_id": "..."}. NEXT: call STEP 2 (GET /call/infer/{event_id}) to fetch the result, then STEP 3 (GET /file=<path>) to download the image. Body: {"data": [images, prompt, seed, randomize_seed, true_guidance_scale, num_inference_steps, height, width, rewrite_prompt, zerogpu_budget]}. images is an array of {"image": {"path": "<public image url>", "meta": {"_type": "gradio.FileData"}}, "caption": null} - put a publicly reachable image URL in the path field (the url field is ignored) and always include the meta._type marker; both are required. Note: free ZeroGPU upstream with per-IP quota, so a job can intermittently return event: error / data: null when quota is exhausted; retry with backoff. Example data: [[{"image": {"path": "https://example.com/in.png", "meta": {"_type": "gradio.FileData"}}, "caption": null}], "make the sky purple", 0, true, 1.0, 4, 1024, 1024, true, 0].
STEP 2 of 3 - GET RESULT. Append the event_id from STEP 1 as a path segment: GET /call/infer/{event_id}. Returns a Server-Sent-Events stream; the final event:complete payload is a JSON array: data[0] = gallery [{image:{path, url, meta}}], data[1] = seed, data[2] = UI-state (ignore). To download the image, take data[0][0].image.path and call STEP 3: GET /file=<path> on THIS proxy. Do NOT use data[0][0].image.url (the *.hf.space link) - it returns 403 for consumers because the upstream only serves files to the proxy origin that created them. Free; the charge was on STEP 1.
STEP 3 of 3 - DOWNLOAD IMAGE. Take the image path from the STEP 2 result (data[0][0].image.path, e.g. /tmp/gradio/xxx/image.webp) and GET /file=<path> on this proxy. Returns the raw image bytes (image/webp). This is the ONLY working way to retrieve the result image; the raw *.hf.space url returns 403 for consumers. Free.
Copy this prompt and paste it into your AI agent (like Claude, GPT-4, etc.) to enable automatic X-402 payment handling.
** Your task ** Call the API at: https://proxy-monetize.fluxapay.xyz/api/qwen-image-edit-rapid-1/{CREATOR_UID}
Follow the steps below in order.
** Step 1 - Install FluxA Wallet CLI **
npm install -g @fluxa-pay/fluxa-wallet
Or use without installing: npx fluxa-wallet <command>
** Step 2 - Register agent **
fluxa-wallet init --name "<YOUR_AGENT_NAME>" --client "<YOUR_CLIENT>"
The response may include an authorization URL. Present the user with options: [Yes, open the link] [No, don't open]. If YES: run 'open "<URL>"' to open in their browser.
Verify: fluxa-wallet status
** Step 3 - Discover endpoints **
curl https://proxy-monetize.fluxapay.xyz/api/qwen-image-edit-rapid-1/{CREATOR_UID}
Returns JSON with: name, description, endpoints (paths, methods, descriptions, prices), paymentRequired, and networks.
** Step 4 - Choose payment method **
Ask the user: [On-chain USDC (Base)] or [FluxA Monetize Credits]
If USDC:
- --currency USDC
- --amount in atomic units (6 decimals, e.g., 100000 = 0.10 USDC)
If Credits (1 credit = 1 USDC):
- --currency FLUXA_MONETIZE_CREDITS
- --amount in 2-decimal units (e.g., 10 = 0.10 credits, 100 = 1.00 credits)
** Step 5 - Create an intent mandate **
x402 v3 uses intent mandates: the user pre-approves a spending plan (budget + time window), then the agent makes autonomous payments within those limits.
fluxa-wallet mandate-create \
--desc "Spend up to <BUDGET> for <DESCRIPTION> valid for <DURATION>" \
--amount <BUDGET_IN_UNITS> \
--seconds <DURATION_IN_SECONDS> \
--currency <USDC or FLUXA_MONETIZE_CREDITS>
Options:
- --desc (required): Human-readable spending plan description
- --amount (required): Budget in units for the chosen currency (see Step 4)
- --seconds (optional, default 28800 = 8h): Duration in seconds
- --currency (optional, default USDC): USDC or FLUXA_MONETIZE_CREDITS
** Step 6 - Get user to sign the mandate **
The response from Step 5 includes mandateId and authorizationUrl (TTL: 10 minutes).
Present the user with options: [Yes, open the link] [No, don't open]. If YES: run 'open "<authorizationUrl>"' to open in their browser.
** Step 7 - Wait for mandate to be signed **
fluxa-wallet mandate-status --id <MANDATE_ID>
Poll until mandate.status is "signed". The response also includes remainingAmount.
Important: Use --id, not --mandate.
** Step 8 - Call the API **
curl https://proxy-monetize.fluxapay.xyz/api/qwen-image-edit-rapid-1/{CREATOR_UID}
Optionally add the X-Agent-ID header for agent attribution (its value is the agent_id from 'fluxa-wallet status'): curl -H "X-Agent-ID: <YOUR_AGENT_ID>" https://proxy-monetize.fluxapay.xyz/api/qwen-image-edit-rapid-1/{CREATOR_UID}
If it returns HTTP 402, continue to Step 9.
** Step 9 - Pay via x402 v3 **
Pass the complete HTTP 402 response body as --payload:
fluxa-wallet x402-v3 \
--mandate <MANDATE_ID> \
--payload '$PAYLOAD_402'
The payload must contain an accepts array. Do NOT extract individual fields - pass the entire 402 response JSON.
The response includes xPaymentB64 (the payment token).
** Step 10 - Retry with payment token **
Retry the same request with the X-Payment header (optionally add X-Agent-ID for attribution):
curl -H "X-Payment: <xPaymentB64>" <ORIGINAL_API_URL>
Return the raw API response to the user without post-processing.
** Opening links for user **
Whenever you need to open a URL (authorization, approval, or any external link):
1. Present the user with a choice using your interactive options/menu capability (e.g., AskUserQuestion tool)
2. Options: [Yes, open the link] [No, don't open]
3. If YES: run 'open "<URL>"' to open in their default browser
4. If NO: ask how they would like to proceed
** Error handling **
- mandate_not_signed: User hasn't signed yet - ask them to open authorizationUrl
- mandate_expired: Time window passed - create a new mandate
- mandate_budget_exceeded: Budget too low - create a new mandate with a higher limit
- agent_not_registered: No Agent ID - run 'fluxa-wallet init' first
- Invalid payload: missing accepts array: Pass the full 402 response JSONWant to combine multiple APIs into one skill? Browse All APIs →

