{"uid":"cap_JnivsV4aO9sAYtUp7AExR","slug":"onchain-router-image-generation-6a51eedc","name":"Onchain Router Image Generation","description":"Give agents provider-neutral access to text, image, and speech models with USDC payments on Base, local spending controls, ambiguity-safe recovery, and verified receipts. Stable public npm clients and MIT agent integrations are available now.","url":"https://onchainrouter.dev/v1/images/generations","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"n":{"type":"integer","const":1},"model":{"type":"string","const":"gemini-3.1-flash-lite-image"},"prompt":{"type":"string","maxLength":4000,"minLength":1},"image_size":{"enum":["1K"],"type":"string","default":"1K"},"aspect_ratio":{"enum":["1:1"],"type":"string","default":"1:1"},"response_format":{"enum":["url","b64_json"],"type":"string","default":"url"}}},"responseSchema":{"type":"json","example":{"data":[{"url":"https://onchainrouter.dev/v1/media/images/00000000-0000-4000-8000-000000000000?access=capability","backed_up":true}],"model":"gemini-3.1-flash-lite-image","price":{"amount":"0.035","currency":"USD"},"created":0,"image_size":"1K","aspect_ratio":"1:1"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_M4LWCVUjllZGZ6KMbVfkv","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Generates images from text prompts using Gemini Flash Lite and returns a seven-day hosted URL or base64 JSON, paid per-call via x402","exampleAgentPrompt":"Generate a square image of a golden retriever running through a field of sunflowers at sunset, and give me back a hosted URL I can use for the next seven days.","exampleUseCases":[{"title":"Social media visual creation","prompt":"Create a 1:1 square image of a minimalist coffee cup on a marble table with soft morning light — I want a hosted URL I can paste into our Instagram scheduler."},{"title":"Game asset placeholder generation","prompt":"Generate an image of a fantasy castle on a floating island at dusk and return it as a base64 JSON so I can embed it directly in my game prototype."},{"title":"Blog post hero image","prompt":"Make me an image of a futuristic city skyline at night with neon reflections on rain-soaked streets — square format, hosted URL please, for our tech blog article header."}],"resultDescription":"Returns a JSON object containing a data array with the hosted image URL (valid for seven days) or base64 image data, the model name used, creation timestamp, image size, aspect ratio, and the price charged in USD.","failureModes":["Prompt too long (exceeds 4000 characters) returns validation error","Empty or missing prompt returns 400 bad request","Invalid enum value for image_size or aspect_ratio returns schema validation error","Payment failure via x402 protocol returns 402 Payment Required","Hosted URL expires after seven days making previously returned links invalid","Model unavailability returns 503 or equivalent upstream error"],"whenToPreferThis":"Choose this endpoint when you need fast, per-call AI image generation billed via x402 crypto micropayments with no subscription, want a ready-to-use seven-day hosted URL without managing your own storage, and are comfortable with square 1:1 format images. It suits agentic workflows where images are generated on demand and the hosted URL lifespan is sufficient. Prefer alternatives if you need multiple images per call, non-square aspect ratios, or persistent long-term image storage.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T18:36:53.521Z","isFirstParty":false}