> For the complete documentation index, see [llms.txt](https://extensityai.gitbook.io/symbolicai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://extensityai.gitbook.io/symbolicai/engines/drawing_engine.md).

# Drawing Engine

We now expose three distinct high-level drawing interfaces:

1. **`gpt_image`** – a unified wrapper around OpenAI’s Images API (DALL·E 2/3 and `gpt-image-*`).
2. **`flux`** – Black Forest Labs’ Flux text-to-image models via api.bfl.ai.
3. **`nanobanana`** – Google Gemini image generation models via the Gemini API.

Both return a list of local PNG file paths.

***

## 1. OpenAI “gpt\_image” Interface

Use `Interface('gpt_image')` to drive OpenAI’s Images API. Supported models:

* `dall-e-2`
* `dall-e-3`
* `gpt-image-1`

```python
from symai import Interface

gpt_image = Interface('gpt_image')

paths = gpt_image(
    "a fluffy cat with a cowboy hat",
    operation="create",          # create | variation | edit
    model="dall-e-3",            # choose your model
    n=1,                          # number of images
    size=1024,                    # square size in px, or "1024x1024"
    response_format="url",        # "url" or "b64_json"
    # Extra for DALL·E-3:
    quality="standard",           # "standard" | "hd"
    style="vivid",                # "vivid" | "natural"
    # Extra for gpt-image-*:
    moderation="auto",            # "auto" | "strict"
    background="transparent",     # "auto" | "transparent"
    output_format="png",          # "png" | "jpeg" | "webp"
    # if jpeg/webp you can also pass `output_compression=80` for quality (0-100)
)

print(paths[0])  # → /tmp/tmpabcd.png
```

```python
from symai import Interface
from pathlib import Path

gpt_image = Interface('gpt_image')

paths = gpt_image(
    operation="variation",
    model="dall-e-2",
    image_path=Path("artifacts/images/cat.png"),
    n=3,
    size=512,
    response_format="url",
)
```

```python
from symai import Interface
from pathlib import Path

gpt_image = Interface('gpt_image')

paths = gpt_image(
    "Add medieval armor and scrolls in the background",
    operation="edit",
    model="gpt-image-1",
    image_path=Path("artifacts/images/cat.png"),
    # mask_path=Path("path/to/mask.png"),  # optional
    n=1,
    size=512,
    quality="medium",   # only for gpt-image-*
)
```

### Supported Parameters

**Common** (all operations):

* `prompt` (str)
* `operation` (`"create"`|`"variation"`|`"edit"`)
* `model` (str)
* `n` (int, default=1)
* `size` (int or `"WxH"`)
* `response_format` (`"url"`|`"b64_json"`)

**Create-only**:

* DALL·E-3:
  * `quality` (`"standard"`|`"hd"`)
  * `style` (`"vivid"`|`"natural"`)
* gpt-image-\*:
  * `quality` (`"auto"`|`"low"`|`"medium"`|`"high"`)
  * `moderation` (`"auto"`|`"strict"`)
  * `background` (`"auto"`|`"transparent"`)
  * `output_format` (`"png"`|`"jpeg"`|`"webp"`)
  * `output_compression` (int 0-100, jpeg/webp only)

**Variation / Edit**:

* `image_path` (Path or str or list)
* `mask_path` (Path or str, edit only)

***

## 2. Black Forest Labs “flux” Interface

Use `Interface('flux')` to call Flux via <https://api.bfl.ai>. Supported models: any `flux-*`, e.g. configured in `SYMAI_CONFIG["DRAWING_ENGINE_MODEL"]`.

```python
from symai import Interface

flux = Interface('flux')

paths = flux(
    "a futuristic city skyline at night",
    operation="create",        # currently only 'create' is implemented
    model="flux-pro-1.1",
    width=1024,                # default 1024
    height=768,                # default 768
    steps=50,                  # default 40
    guidance=7.5,              # default None
    seed=42,                   # default None
    safety_tolerance=2,        # default 2
    prompt_upsampling=False,   # default False
    interval=5,                # default None
    output_format="png",       # default 'png'
)

print(paths)  # → ['/tmp/tmp1234.png']
```

### Supported Parameters

* `model` (str)
* `width` (int, default 1024)
* `height` (int, default 768)
* `steps` (int, default 40)
* `guidance` (float)
* `seed` (int)
* `safety_tolerance` (int, default 2)
* `prompt_upsampling` (bool, default False)
* `interval` (int)
* `output_format` (str, default 'png')

Under the hood Flux uses:

* POST `https://api.bfl.ai/v1/{model}`
* GET `https://api.bfl.ai/v1/get_result?id={request_id}`

and writes out local PNG file(s).

***

## 3. Google “nanobanana” (Gemini Image) Interface

Use `Interface("nanobanana")` to generate images with Gemini image models. This interface currently supports **create-only** generation.

Supported models (as of this release):

* `gemini-2.5-flash-image`
* `gemini-3-pro-image-preview`

```python
from symai import Interface

nanobanana = Interface("nanobanana")

paths = nanobanana(
    "a fluffy cat with a cowboy hat",
    operation="create",                 # currently only 'create' is implemented
    model="gemini-2.5-flash-image",
)

print(paths[0])  # → /tmp/tmpabcd.png
```

### Supported Parameters

* `prompt` (str)
* `operation` (`"create"`)
* `model` (str, default from `SYMAI_CONFIG["DRAWING_ENGINE_MODEL"]`)
* `response_modalities` (list\[str], default `["IMAGE"]`)
* `config` (optional): a dict of wire-format `generationConfig` fields (camelCase), merged over the `responseModalities` default

### Configuration

Set these keys in `symai.config.json` (or via your preferred config location):

* `DRAWING_ENGINE_API_KEY`: your Gemini API key
* `DRAWING_ENGINE_MODEL`: one of the supported Gemini image model names, e.g. `gemini-2.5-flash-image`
