Text to image

Returns JSON with a 1024x1024 JPEG generated from a text prompt by FLUX.1 schnell on Workers AI, as base64.

Use when you need image generation or text to image from a prompt for illustrations or mockups and can poll an async job.

Do not use when you need image edits, a specific size, photos of real people or more than one image per call.

Price: 0.03 USDC per call (x402, eip155:8453). Typical response time: 10000 ms (p95). Asynchronous: the paid call returns a jobId; polling is free.

Call it over HTTP (x402)

POST https://x402-gateway.blackwoodstate8.workers.dev/v1/image-gen. A request without payment gets 402 Payment Required with the PAYMENT-REQUIRED header; any x402 client signs an EIP-3009 authorization and retries with PAYMENT-SIGNATURE (or X-PAYMENT). Invalid input is answered with 400 and not charged.

curl -i -X POST https://x402-gateway.blackwoodstate8.workers.dev/v1/image-gen -H 'content-type: application/json' -d '{"prompt":"A brass lighthouse on a dark navy sea at dusk, minimalist flat illustration","steps":4}'
Pay to0xAf45feD0fb0145443ACaFA4754556BC4D2968D86
Asset0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (USDC)
Amount30000 atomic units (0.03 USDC)
Authorization window60 s
Poll (free)GET https://x402-gateway.blackwoodstate8.workers.dev/v1/image-gen/jobs/:jobId

Call it over MCP

Streamable HTTP at https://x402-gateway.blackwoodstate8.workers.dev/mcp, tool image-gen_v1. Payment goes in _meta["x402/payment"]; without it the tool returns the payment requirements.

Input

FieldTypeMeaning
promptstringWhat the image should show, in English
steps (optional)integerDiffusion steps (1-8, 4 when omitted); more steps, more detail

Example:

{
  "prompt": "A brass lighthouse on a dark navy sea at dusk, minimalist flat illustration",
  "steps": 4
}

Output

Real example of the paid response (the job ticket):

{
  "jobId": "job_00000000000000000000000000000000",
  "pollUrl": "https://gateway.example/v1/image-gen/jobs/job_00000000000000000000000000000000",
  "expiresAt": "2026-01-31T00:00:00.000Z",
  "status": "queued"
}
JSON Schema
{
  "type": "object",
  "properties": {
    "jobId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "pollUrl": {
      "type": "string",
      "format": "uri"
    },
    "expiresAt": {
      "type": "string",
      "description": "ISO 8601: depois disso o resultado deixa de existir"
    },
    "status": {
      "type": "string",
      "const": "queued"
    }
  },
  "required": [
    "jobId",
    "pollUrl",
    "expiresAt",
    "status"
  ],
  "additionalProperties": false
}

More

Free schema and example: GET https://x402-gateway.blackwoodstate8.workers.dev/v1/image-gen. OpenAPI 3.1 · llms.txt · All services