> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heyaskr.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate images

> Create and save images from a prompt.

Generate an image and save it to disk.

```python theme={null}
import requests

resp = requests.post(
    "https://api.heyaskr.ai/v1/images/generations",
    headers={"Authorization": "Bearer ASKR_API_KEY"},
    json={
        "model": "flux-1.1-pro",
        "prompt": "an isometric city at golden hour, tiny cars, soft shadows",
        "size": "1024x1024",
    },
).json()

url = resp["data"][0]["url"]
img = requests.get(url).content
open("city.png", "wb").write(img)
print("Saved city.png · cost $", resp.get("cost"))
```

<Warning>
  Image URLs expire after 24 hours, so download anything you want to keep, as shown
  above.
</Warning>

<Tip>
  Try different models by changing `model` to `nano-banana`, `ideogram-3`, or any
  image model from the [catalogue](/concepts/models).
</Tip>
