> For the complete documentation index, see [llms.txt](https://docs.meganova.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.meganova.ai/inference-models/image-generation.md).

# Image Generation

Use these models to generate whatever images you can (or can't!) imagine.

## Models available

Models that generate images from a prompt, plus image-editing models (filter **`Image To Image`**).

Two billing shapes here: the Nano-Banana (Gemini image) models are priced per 1M tokens, input and output, while the rest are priced per image. The catalog shows which applies to a given model.

Model ids, current prices, context lengths and per-tier limits are in the console catalog, which is generated from the same records that bill your requests:

[**console.meganova.ai/serverless**](https://console.meganova.ai/serverless) — filter by **`Text To Image`**

The same list is available programmatically from [`GET /v1/models`](/api-reference/inference-models.md), including pricing and capability flags.

**Parameters**

* Prompt: The prompt to guide the model's generation.
* Negative Prompt: A prompt to guide the model away from generating certain content.
* Width, Height: The resolution of the output image.
* Steps: Number of inference steps that the model will take. A higher number of steps typically\
  leads to better quality but costs more.
* Guidance Scale: A high value encourages the model adhere closely to the prompt, but may result in a lower image quality.
* Seed: A number to seed the generation. Using the same value ensures reproducibility.

> **NOTE:** For best results, ensure that the mask dimensions are the same as the image.

> **NOTE:** For video generation models, see the dedicated [Video Generation](/inference-models/video-generation.md) page.

## Using the Models

### Through Our Website UI

Our website UI is the easiest and fastest way to use our endpoints.

1. Go to the [MegaNova](https://meganova.ai) website.
2. Log in, and ensure you have enough credits.
3. Click on the "Inference Models" tab and select your model.
4. Choose your parameters, enter your prompt (and image + mask if applicable) and just press Enter!

> **NOTE:** We support JPG, JPEG, PNG, and WebP image formats.

### Through API Endpoint

This option is to use our API endpoint directly in your projects. Below are some code snippets to get you started!

> **NOTE:** Don't forget to use **your** API key. See [Authentication](/api-reference/platform-api/authentication.md) for details on authentication and [Create API Key](/api-reference/platform-api/create-api-key.md) for managing keys.

#### Using cURL

**Text-to-Image Model**

```bash
curl -X POST "https://api.meganova.ai/v1/images/generations" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $MegaNova_API_KEY" \
    --data-raw '{
      "model":"gemini/gemini-3-pro-image",
      "prompt":"a flying cat",
      "num_steps":25,
      "guidance_scale":9,
      "negative_prompt":null,
      "width":1024,
      "height":1024
    }'
```

**Image-to-Image Model**

```bash
curl -X POST "https://api.meganova.ai/v1/images/generations" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $MegaNova_API_KEY" \
    --data-raw '{
    "model":"Bytedance/seedream-5-0-lite-260128",
    "prompt": "a red baseball cap",
    "num_steps": 40,
    "guidance_scale": 4.5,
    "width": 1024,
    "height": 1024,
    "image": "/9j/4…/Z", 
    "mask": "/9j/4…ACgD/9k="
}'
```

where `"image"` and `"mask"` are base64 encoded images.

#### Using Python

**Text-to-Image Model**

```python
import requests 
import os

url = "https://api.meganova.ai/v1/images/generations" 

headers = {  
    "Content-Type": "application/json",  
    "Authorization": f"Bearer {os.environ.get('MegaNova_API_KEY')}" 
} 

data = {
    "model":"gemini/gemini-3-pro-image",
    "prompt":"a flying cat",
    "num_steps":25,
    "guidance_scale":9,
    "negative_prompt": None,
    "width":1024,
    "height":1024
}

response = requests.post(url, headers=headers, json=data) 
print(response.json())
```

**Image-to-Image Model**

```python
import requests 
import os

url = "https://api.meganova.ai/v1/images/generations" 

headers = {  
    "Content-Type": "application/json",  
    "Authorization": f"Bearer {os.environ.get('MegaNova_API_KEY')}" 
} 

data = {
    "model":"Bytedance/seedream-5-0-lite-260128",
    "prompt":"a flying cat",
    "num_steps":25,
    "guidance_scale":9,
    "negative_prompt": None,
    "width":1024,
    "height":1024, 
    "image":"/9j/4…/Z", 
    "mask":"/9j/4…ACgD/9k="
}

response = requests.post(url, headers=headers, json=data) 
print(response.json())
```

#### Using JavaScript

**Text-to-Image Model**

```javascript
const url = 'https://api.meganova.ai/v1/images/generations';

const headers = {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${process.env.MegaNova_API_KEY}`
};

const data = {
    "model": "gemini/gemini-3-pro-image",
    "prompt": "",
    "num_steps": 25,
    "guidance_scale": 9,
    "negative_prompt": null,
    "width": 1024,
    "height": 1024
};

fetch(url, {
    method: 'POST',
    headers: headers,
    body: JSON.stringify(data)
})
    .then(response => response.json())
    .then(data => {
        console.log(JSON.stringify(data, null, 2));
    })
    .catch(error => console.error('Error:', error));
```

**Image-to-Image Model**

```javascript
const url = 'https://api.meganova.ai/v1/images/generations';

const headers = {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${process.env.MegaNova_API_KEY}`
};

const data =  {
    "model": "Bytedance/seedream-5-0-lite-260128",
    "prompt": "a flying cat",
    "num_steps": 25,
    "guidance_scale": 9,
    "negative_prompt": null,
    "width": 1024,
    "height": 1024, 
    "image": "/9j/4…/Z", 
    "mask": "/9j/4…ACgD/9k="
};

fetch(url, {
    method: 'POST',
    headers: headers,
    body: JSON.stringify(data)
})
    .then(response => response.json())
    .then(data => {
        console.log(JSON.stringify(data, null, 2));
    })
    .catch(error => console.error('Error:', error));
```

#### Selecting a Model

To specify the desired model, use this mapping for the `model` field:

**Image Generation Models**

* Nano-Banana-Pro: `gemini/gemini-3-pro-image`
* Nano-Banana-Pro-Edit: `gemini/gemini-3-pro-image-edit`
* Nano-Banana-2: `gemini/gemini-3.1-flash-image`
* Nano-Banana: `gemini/gemini-2.5-flash-image`
* Nano-Banana-Edit: `gemini/gemini-2.5-flash-image-edit`
* Bytedance-Seedream-5.0-Lite: `Bytedance/seedream-5-0-lite-260128`
* Bytedance-Seedream-4.5: `Bytedance/seedream-4-5-251128`
* Bytedance-Seedream-4.0: `Bytedance/seedream-4-0-250828`
* Bytedance-Seedream-3.0: `Bytedance/seedream-3-0-t2i-250415`
* Alibaba-Z-Image-Turbo: `Alibaba/z-image-turbo`
* DreamShaper-8: `Lykon/dreamshaper-8`

#### Response Example

A successful response body will return the image in this format:

```json
{
    "model": "gemini/gemini-3-pro-image",
    "object": "list",
    "data": [
        {
            "timings": {
                "inference": 13.366829872131348
            },
            "index": 0,
            "b64_json": "sjkkc9j34m..."
        }
    ],
    "message": "Image generated successfully",
    "status": "success"
}
```

> **NOTE:** You'll need to use an image b64 decoder to view the result. Just pass in the b64\_json value to the decoder of your choice.

Feel free to explore refer to the [API Reference](/api-reference/inference-models.md) for more details.
