# Image generation

`POST /v1/images/generations` — Generate a 1024×1024 image from a text prompt.

- Base URL: https://eroq.ai/v1
- Auth: `Authorization: Bearer eroq_sk_…` (create keys at https://eroq.ai/dashboard/keys)
- Credits: 10 per image · +2 with store: true

Returns the image inline as base64 (`b64_json`), or a URL when the engine answers with one. Outputs are not retained on our side — unless you ask us to keep them:

Set `store: true` to persist the render to the eroq Store in the same call: the response answers with a durable CDN URL instead of base64, plus a `stored` block. The Store's rate (2 credits / started 10MB — one block for any 1024×1024 image) is charged on top and itemized in your ledger.

Image One is a diffusion engine: it responds to `negative_prompt` and `cfg_scale`, and reads comma-separated tag prompts as well as prose. It is NSFW-capable: mature imagery of adult characters renders within the acceptable-use policy; prompts outside it return `content_blocked` and are not charged.

Rendering takes a few seconds; the request holds until the image is ready.

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `prompt` | string | yes | What to draw, up to 2400 characters. |
| `model` | string | no | Only `eroq-image-one` today. Default `eroq-image-one`. |
| `negative_prompt` | string | no | What to steer away from. |
| `cfg_scale` | number | no | Prompt adherence, `1`–`20`. Engine default when omitted. |
| `store` | boolean | no | Persist to the eroq Store and answer with a CDN URL. +2 credits per started 10MB. Default `false`. |
| `response_format` | string | no | `b64_json` (default) or `url` when available. |

## Example request

```bash
curl https://eroq.ai/v1/images/generations \
  -H "Authorization: Bearer $EROQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "eroq-image-one",
  "prompt": "portrait of a starship mechanic, grease-stained overalls, warm hangar light, 35mm",
  "negative_prompt": "blurry, extra fingers"
}'
```

```javascript
const res = await fetch('https://eroq.ai/v1/images/generations', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.EROQ_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "model": "eroq-image-one",
    "prompt": "portrait of a starship mechanic, grease-stained overalls, warm hangar light, 35mm",
    "negative_prompt": "blurry, extra fingers"
  }),
})
console.log(await res.json())
```

```python
import os, requests

res = requests.post(
    "https://eroq.ai/v1/images/generations",
    headers={"Authorization": f"Bearer {os.environ['EROQ_API_KEY']}"},
    json={
        "model": "eroq-image-one",
        "prompt": "portrait of a starship mechanic, grease-stained overalls, warm hangar light, 35mm",
        "negative_prompt": "blurry, extra fingers"
    },
)
print(res.json())
```

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{
  "model": "eroq-image-one",
  "prompt": "portrait of a starship mechanic, grease-stained overalls, warm hangar light, 35mm",
  "negative_prompt": "blurry, extra fingers"
}`)

	req, _ := http.NewRequest("POST", "https://eroq.ai/v1/images/generations", body)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EROQ_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```

## Response


```json
{
  "created": 1756118400,
  "model": "eroq-image-one",
  "data": [{ "b64_json": "UklGRl4jAABXRUJQ…" }],
  "usage": { "credits_spent": 10, "credits_remaining": 987 }
}
```
---
Canonical: https://eroq.ai/docs/images · Index for agents: https://eroq.ai/llms.txt · OpenAPI: https://eroq.ai/openapi.json
