# Create Image

Generate one or more images from a text prompt.

- Source: https://www.unifyllm.com/docs/api-reference/create-image/
- Language: en

## Endpoint

```http
POST https://api.unifyllm.top/v1/images/generations
```

Use the authentication and headers shown in the request examples. Content-Type: application/json

[Integration guide](https://www.unifyllm.com/docs/gemini-image/)

## Parameters

| Field | Location | Type | Required | Description | Allowed values | Example |
| --- | --- | --- | --- | --- | --- | --- |
| model | body | enum<string> | yes | Image generation model. Use gpt-image-2-c for 1K/2K output or gpt-image-2-4k-c for 4K output. | gpt-image-2-c, gpt-image-2-4k-c | gpt-image-2-c |
| prompt | body | string | yes | Text instruction describing the requested output. |  |  |
| size | body | enum<string> | no | Output dimensions. Use a listed preset or a custom WxH value. Custom sizes must have a maximum edge of 3840 px, both edges divisible by 16, an aspect ratio no greater than 3:1, and 655,360–8,294,400 total pixels. | 1024x1024, 1536x1024, 2048x1536, 1024x1536, 1536x2048, 1440x2160, 2048x2048, 2880x2880, 3200x2560, 2560x3200, 3264x2448, 2448x3264, 3504x2336, 2336x3504, 3840x2160, 2160x3840, 3696x1584, auto | auto |

## Generate Image

```json
{
  "model": "gpt-image-2-c",
  "prompt": "A flying white rabbit in a futuristic sci-fi style",
  "size": "1024x1536"
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/images/generations' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2-c",
  "prompt": "A flying white rabbit in a futuristic sci-fi style",
  "size": "1024x1536"
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/images/generations", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "gpt-image-2-c",
    "prompt": "A flying white rabbit in a futuristic sci-fi style",
    "size": "1024x1536"
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/images/generations",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"gpt-image-2-c\",\n  \"prompt\": \"A flying white rabbit in a futuristic sci-fi style\",\n  \"size\": \"1024x1536\"\n}")
)
response.raise_for_status()
print(response.json())
```

## Response examples

### Default — HTTP 200

```json
{"created":1785223107,"data":[{"url":"https://image.ezworkapi.top/origin-img?u=aHR0cHM6Ly9vc3M1LmN4a2VkdS5zaG9wL2ltYWdlcy8yMDI2LzA3LzI4LzE3ODUyMjMxMDdfMGNiMTE4MzMzMmMxMGM2Mzg3Mzk3N2QyMjJlMjY5ZjQucG5n&sig=df731cbb207003b14ed3d71c1fdf25369f66f1b1ea66a90f24d7a2dd5bac3eb0"}],"model":"gpt-image-2-c"}
```
