# OpenRouter APIs — Recraft: Recraft V4 Styles (recraft/recraft-v4-styles)

Guide for calling every confirmed OpenRouter API that serves `recraft/recraft-v4-styles`.

Model page: https://openrouter.ai/recraft/recraft-v4-styles
Create an API key: https://openrouter.ai/settings/keys

## Authentication

Send this header with every request:

- Authorization: Bearer $OPENROUTER_API_KEY

## Image API

Generate images with `recraft/recraft-v4-styles` through OpenRouter's Image API.

Docs: https://openrouter.ai/docs/guides/overview/multimodal/image-generation
Model discovery API: https://openrouter.ai/api/v1/images/models
Endpoints (recraft/recraft-v4-styles-20260826): https://openrouter.ai/api/v1/images/models/recraft/recraft-v4-styles-20260826/endpoints

### Endpoint

POST https://openrouter.ai/api/v1/images

Headers:
- Content-Type: application/json

### Request fields (recraft/recraft-v4-styles)

- model: string (required) — `"recraft/recraft-v4-styles"`
- prompt: string (required) — text description of the desired image
- aspect_ratio: "1:1" | "2:1" | "1:2" | "3:2" | "2:3" | "4:3" | "3:4" | "5:4" | "4:5" | "16:9" | "9:16" | "auto" (optional) — aspect ratio of the generated image
- n: integer 1-6 (optional) — upper bound on the number of images to generate; providers may return fewer, and single-image providers reject n > 1
- input_references: array of up to 10 image references (optional) — reference images for image-to-image, as `{ "type": "image_url", "image_url": { "url": "…" } }` entries; the url is an https URL or a base64 data URL

These are the generation parameters this model accepts between its providers; an
unlisted value is rejected, and a listed one can still be refused by whichever provider
serves the call. `provider` (routing preferences) is accepted on every request.

### Response

```json
{
  "created": 1748372400,
  "data": [{ "b64_json": "<base64 image bytes>", "media_type": "image/png" }],
  "usage": { "prompt_tokens": 0, "completion_tokens": 4175, "total_tokens": 4175, "cost": 0.04 }
}
```

Base64-decode `data[i].b64_json` and write the bytes to a file; `media_type` gives the extension.
`usage.cost` is the USD charge for the call.

### Examples

#### Image to Image

```bash
curl -X POST https://openrouter.ai/api/v1/images \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "recraft/recraft-v4-styles",
  "prompt": "Editorial architectural photograph of a contemporary neighborhood storefront at blue hour, glowing warmly against the dusk. Above the entrance, a warm-white neon sign in flowing hand-bent cursive reads exactly \"OpenRouter\", the only text in the scene. Large windows reveal a cozy, lived-in interior: wood shelves styled with books and ceramics, lush trailing plants, and soft pendant lighting. Potted plants and a bicycle rest by the entrance, and golden light spills across the wet pavement in gentle reflections. Straight-on composition, realistic materials, quiet street with no people.",
  "n": 1,
  "aspect_ratio": "16:9",
  "input_references": [
    {
      "type": "image_url",
      "image_url": {
        "url": "https://model-assets.openrouter.ai/model-examples/recraft/recraft-v4-styles-20260826/11ee693c-5794-414b-b155-1c7d6c4adf80/input-0.jpg"
      }
    }
  ]
}'
```

#### Image to Image 2

```bash
curl -X POST https://openrouter.ai/api/v1/images \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "recraft/recraft-v4-styles",
  "prompt": "Change the neon sign to a bright electric blue neon, and let its cool glow tint the facade and the reflections on the pavement below, while keeping the interior'\''s warm lamp lighting unchanged so the windows still glow cozy and golden. Add gentle falling snow: a light dusting on the awning ledge, the potted plants, the bicycle seat, and the sidewalk, with fine snowflakes visible in the air against the dusk sky. Keep the composition and everything else exactly the same. The sign must still read exactly '\''OpenRouter'\''.",
  "n": 1,
  "aspect_ratio": "16:9",
  "input_references": [
    {
      "type": "image_url",
      "image_url": {
        "url": "https://model-assets.openrouter.ai/model-examples/recraft/recraft-v4-styles-20260826/5d43f959-46b1-4fc3-9506-a4d25d21a3b1/input-0.jpg"
      }
    }
  ]
}'
```

### Error differences

- 413 — request body too large

## Errors

Failures return `{"error": {"code": <number>, "message": <string>}}` with the HTTP status:

- 400 — malformed request or an unsupported parameter
- 401 — missing or invalid API key
- 402 — insufficient credits
- 403 — spend limit reached, key disabled, or access blocked
- 404 — unknown model or no provider can serve the request
- 429 — rate limited; retry with backoff
- 502 — the operation failed upstream; failed generations are not billed

---

Canonical version of this document: https://openrouter.ai/recraft/recraft-v4-styles/llms.txt
