Grok image generation via micropayment — $0.07 per image, ~3s, 13 aspect ratios including ultra-wide
What it does
This endpoint generates images using the Grok Image model through StableStudio's pay-per-generation API. It accepts a text prompt and an optional aspect ratio (13 options including standard, wide, and ultra-wide like 19.5:9 and 20:9), returning a job ID that can be polled for the completed image URL. The cost is $0.07 per generation with ~3s turnaround.
Payment is handled via the MPP protocol (Tempo method with pathUSD on Tempo L2) or x402 (USDC on Base, network eip155:8453). No API keys are needed — callers POST to the endpoint without a payment header to receive a 402 challenge, then sign a USDC authorization and resubmit with a PAYMENT-SIGNATURE header. The response includes a jobId; poll GET /api/jobs/{jobId} with a SIGN-IN-WITH-X wallet signature header until the job completes and returns an imageUrl.
StableStudio also offers a companion Grok edit endpoint at /api/generate/grok/edit ($0.022) that accepts reference images. The Grok generate endpoint is part of a broader platform offering multiple image models (Nano Banana Pro, GPT Image 1.5, Flux 2 Pro) and video models (Grok Video, Seedance, Wan 2.6, Sora 2, Veo 3.1). An MCP server is available via `npx -y agentcash@latest` for agent integration.
Capabilities
Use cases
- —Generate images from text prompts with ultra-wide aspect ratio support for banners and phone wallpapers
- —Agent-driven image creation workflows using micropayments without API key management
- —Programmatic content generation for social media, marketing, or design assets
- —On-demand image generation in chatbots or creative tools via MCP integration
Fit
Best for
- —Agents needing fast, cheap image generation ($0.07, ~3s) without subscriptions
- —Use cases requiring unusual aspect ratios (19.5:9, 20:9 ultra-wide)
- —Crypto-native workflows paying per call with USDC on Base or pathUSD on Tempo
- —Developers wanting a simple prompt-in, image-out API with no auth keys
Not for
- —Batch processing thousands of images (async polling adds overhead per job)
- —Users without a crypto wallet (payment requires USDC or pathUSD signing)
- —Image editing with reference images (use the /grok/edit endpoint instead)
Quick start
# 1. Get payment challenge
curl -X POST https://stablestudio.dev/api/generate/grok/generate \
-H 'Content-Type: application/json' \
-d '{"prompt": "A cat astronaut floating in space", "aspect_ratio": "16:9"}'
# Returns 402 with PAYMENT-REQUIRED header (base64 JSON)
# 2. Decode challenge, sign USDC payment, resubmit with PAYMENT-SIGNATURE header
# 3. Poll GET /api/jobs/{jobId} with SIGN-IN-WITH-X header until completeExample
Request
{
"prompt": "A cat astronaut floating in space, photorealistic",
"aspect_ratio": "16:9"
}Response
{
"type": "grok-generate",
"jobId": "abc123-def456",
"status": "pending",
"success": true
}Endpoint
Quality
Full OpenAPI schema with detailed input/output specs, clear pricing ($0.07), documented payment flow, and agents.txt present. The endpoint returned 405 on HEAD/GET probes (expected — it's a POST-only endpoint), so liveness is inferred from the broader platform being up (root 200) and the comprehensive OpenAPI spec. Docs pages 404, but the OpenAPI x-guidance field provides thorough documentation.
Warnings
- —Endpoint probe returned 405 on HEAD/GET; this is expected for a POST-only route but means the 402 challenge was not directly captured for this specific endpoint
- —No dedicated documentation pages found (/docs, /pricing, /api all return 404); all docs are embedded in the OpenAPI spec
Citations
- —Grok generate costs $0.07 per image with ~3s turnaroundhttps://stablestudio.dev
- —Grok generate supports 13 aspect ratios including ultra-wide 19.5:9 and 20:9https://stablestudio.dev
- —Payment via USDC on Base (eip155:8453) or Tempo pathUSD, no API keys requiredhttps://stablestudio.dev
- —MCP server available via npx -y agentcash@latesthttps://stablestudio.dev
- —Grok edit endpoint available at /api/generate/grok/edit for $0.022https://stablestudio.dev