Grok-powered image editing via micropayments — $0.022 per edit, ~3s latency
What it does
This endpoint provides AI image editing using xAI's Grok model, accessed through StableStudio's pay-per-generation platform. You POST a prompt and one or more reference image URLs (previously uploaded via StableStudio's file upload flow) along with an optional aspect ratio, and receive a job ID. You then poll the job status endpoint until the edited image URL is returned. The endpoint costs $0.022 per edit and typically completes in about 3 seconds.
Payment is handled via the MPP protocol (Tempo method on pathUSD) or x402 (USDC on Base, network eip155:8453). No API keys or subscriptions are required — each call is paid individually with a signed crypto transaction. The flow is: (1) POST without payment to receive a 402 challenge with the exact amount, (2) sign the payment and re-POST with the PAYMENT-SIGNATURE header to get a pending job, (3) poll GET /api/jobs/{jobId} with a SIGN-IN-WITH-X wallet signature header until the result contains an imageUrl.
Grok edit supports 13 aspect ratios including standard (1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3), wide (2:1, 1:2), and ultra-wide (19.5:9, 9:19.5, 20:9, 9:20). Reference images must first be uploaded through StableStudio's three-step upload flow ($0.01) to obtain blob URLs. The endpoint is part of a broader StableStudio platform that also offers generation and editing via Nano Banana Pro, GPT Image 1.5, Flux 2 Pro, Grok Video, Seedance, Wan, Sora, and Veo models.
Capabilities
Use cases
- —Edit or modify existing images using natural language prompts via Grok
- —Apply style changes, object additions/removals, or transformations to uploaded images
- —Integrate low-cost image editing into agent workflows without API key management
- —Build automated image processing pipelines with per-call micropayments
Fit
Best for
- —Agents needing cheap, fast image edits ($0.022/call, ~3s)
- —Workflows requiring ultra-wide or unusual aspect ratios (up to 20:9)
- —Developers who want pay-per-use image editing without subscriptions or API keys
Not for
- —Batch processing thousands of images (each requires a separate crypto payment)
- —Use cases requiring fiat/credit-card payment (crypto wallet required)
- —Real-time editing with sub-second latency (async job polling adds overhead)
Quick start
# 1. POST to get 402 challenge
curl -X POST https://stablestudio.dev/api/generate/grok/edit \
-H 'Content-Type: application/json' \
-d '{"prompt": "Add sunglasses to the person", "images": ["https://your-blob-url.vercel-storage.com/img.png"]}'
# Returns 402 with PAYMENT-REQUIRED header
# 2. Sign payment, re-POST with PAYMENT-SIGNATURE header
# 3. Poll GET /api/jobs/{jobId} with SIGN-IN-WITH-X headerExample
Request
{
"images": [
"https://example.blob.vercel-storage.com/uploads/abc/photo.png"
],
"prompt": "Add sunglasses to the person in the photo",
"aspect_ratio": "16:9"
}Response
{
"type": "grok-edit",
"jobId": "job_abc123",
"status": "pending",
"success": true
}Endpoint
Quality
Full OpenAPI schema with detailed input/output definitions, clear pricing ($0.022), documented payment flow, and comprehensive guidance. The probe returned 405 (not 402) because the endpoint only accepts POST, not HEAD/GET — this is expected behavior, not a liveness issue. Deducted slightly because no direct 402 challenge was captured for this specific endpoint and no /docs page exists.
Warnings
- —Probe returned 405 because HEAD/GET are not supported; endpoint requires POST method
- —Reference images must be uploaded first via the paid /api/upload flow ($0.01) before editing
- —No dedicated documentation page exists at /docs (returns 404)
Citations
- —Grok edit costs $0.022 per call with ~3s latencyhttps://stablestudio.dev/api/openapi.json
- —Grok edit accepts prompt, aspect_ratio, and images fieldshttps://stablestudio.dev/api/openapi.json
- —Payment is USDC on Base (eip155:8453) or pathUSD via Tempohttps://stablestudio.dev/api/openapi.json
- —13 aspect ratios supported including ultra-wide 19.5:9, 20:9https://stablestudio.dev/api/openapi.json
- —File upload flow costs $0.01 and uses Vercel Blob storagehttps://stablestudio.dev/api/openapi.json
- —StableStudio describes itself as AI image/video generation via micropaymentshttps://stablestudio.dev