# OpenAI gpt-image-2 Image Generation (x402)

> OpenAI gpt-image-2 Image Generation (x402) is a paid API for AI agents from openai.mm.family, paid per call via x402, $0.003473/call, status unknown (last checked 2026-10-02).

Generates images from text prompts using OpenAI's GPT-Image-2 model, returning base64-encoded PNG/JPEG/WebP, paid per call in USDC via x402.

## Facts

- Endpoint: POST https://openai.mm.family/x402/v1/models/gpt-image-2/images/generations?utm_source=zero.xyz
- Price: $0.003473/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/openai-gpt-image-2-image-generation-x402-ff991ddb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-AZR1vo_923KlWeZIZnVY

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability openai-gpt-image-2-image-generation-x402-ff991ddb -d '<json body>'
```

Example prompt: Generate a high-quality 1024x1024 PNG image of a cozy coffee shop interior with warm lighting and wooden furniture using GPT-Image-2, and give me the result as a base64 image.

## When to prefer this

Choose this endpoint when you need programmatic access to OpenAI's GPT-Image-2 model with pay-per-call USDC micropayments via x402 protocol, without needing a traditional OpenAI API key or subscription. Ideal for agents that require fine-grained cost control per image (billing in USDC per call), or for blockchain-native / crypto-native workflows. Prefer this over general OpenAI image endpoints when operating in an agentic payment context and when you need explicit quality control (low/medium/high) with predictable per-token pricing.

## Known failure modes

- Prompt refused by content moderation — returns error if prompt violates OpenAI content policy
- 'auto' quality value rejected — endpoint explicitly refuses 'auto'; must specify low, medium, or high
- Payment failure — x402 payment not accepted or USDC balance insufficient
- Invalid size or format combination — unsupported size strings return validation errors
- Missing prompt — request without a prompt field returns 400 bad request
- Rate limiting — too many concurrent requests may result in 429 errors

## How this service works

gpt-image-2: OpenAI GPT Image 2 image generation, paid per call in USDC. OpenAI list $30 per 1M image tokens (1024x1024: low 196, medium 1756, high 7024 tokens), text in $5 per 1M, plus $0.0005 (Base) or $0.0005 (Solana) per call. Send size and quality (auto is refused); omitted means 1024x1024 medium. Returns b64_json. Rates: https://openai.mm.family/x402/pricing

## Output

Returns a JSON object containing an array of image objects each with a b64_json field holding the base64-encoded image, along with metadata including size, quality, output_format, creation timestamp, and token usage (input_tokens, output_tokens, total_tokens).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "n": {
   "type": "integer"
  },
  "size": {
   "type": "string"
  },
  "model": {
   "enum": [
    "gpt-image-2"
   ],
   "type": "string"
  },
  "prompt": {
   "type": "string"
  },
  "quality": {
   "enum": [
    "low",
    "medium",
    "high"
   ],
   "type": "string"
  },
  "background": {
   "type": "string"
  },
  "moderation": {
   "enum": [
    "auto"
   ],
   "type": "string"
  },
  "output_format": {
   "enum": [
    "png",
    "jpeg",
    "webp"
   ],
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": [
   {
    "b64_json": "<base64 png>"
   }
  ],
  "size": "1024x1024",
  "usage": {
   "input_tokens": 12,
   "total_tokens": 208,
   "output_tokens": 196
  },
  "created": 1,
  "quality": "low",
  "output_format": "png"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/openai-gpt-image-2-image-generation-x402-ff991ddb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from openai.mm.family](https://www.zero.xyz/host/openai.mm.family/llms.txt)
