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

# Bildgenerierungs-API

> Um Entwicklern den Aufruf verschiedener Bildgenerierungsmodelle zu erleichtern, bietet AIHubMix eine vereinheitlichte Image-Generation-API.

## Verfügbare Modellliste

<Tip>
  Zur Nano-Banana-Serie siehe: [https://docs.aihubmix.com/en/api/Gemini-Guides](https://docs.aihubmix.com/en/api/Gemini-Guides)
</Tip>

### OpenAI-Modelle

* [gpt-image-2](https://aihubmix.com/model/gpt-image-2) – Wird über den OpenAI-kompatiblen Bildbearbeitungs-Endpunkt unterstützt. Verwenden Sie die vollständige Modell-ID `gpt-image-2`; `image2` ist keine gültige Modell-ID.
* [gpt-image-1.5](https://aihubmix.com/model/gpt-image-1.5) – OpenAIs neuestes Bildgenerierungsmodell mit verbesserter Anweisungsbefolgung und Prompt-Ausführung.
* [gpt-image-1](https://aihubmix.com/model/gpt-image-1) – Ein multimodales Sprachmodell, das Text- und Bildeingaben akzeptiert und Bildausgaben erzeugt.
* [gpt-image-1-mini](https://aihubmix.com/model/gpt-image-1-mini) – Eine ökonomische Variante von gpt-image-1.
* [dall-e-3](https://aihubmix.com/model/dall-e-3) – Kann realistische Bilder und Kunstwerke basierend auf natürlicher Sprache erstellen und neue Bilder in angegebenen Dimensionen erzeugen.

### Imagen-Modelle

* imagen-4.0-ultra-generate-001
* imagen-4.0-generate-001
* imagen-4.0-fast-generate-001
* imagen-4.0-fast-generate-preview-06-06
* imagen-3.0-generate-002

### Qwen-Modelle

* [qwen-image](https://aihubmix.com/model/qwen-image) – Ein grundlegendes Bildgenerierungsmodell der Qwen-Serie mit deutlichen Fortschritten bei komplexem Textrendering und präziser Bildbearbeitung.
* [qwen-image-edit](https://aihubmix.com/model/qwen-image-edit) – Qwen-Modell zur Bildbearbeitung.

### Doubao-Modelle

* [doubao-seedream-4-5](https://aihubmix.com/model/doubao-seedream-4-5) – ByteDances neuestes multimodales Bildmodell, das Funktionen für Text-zu-Bild, Bild-zu-Bild und zusammengesetzte Bildausgaben integriert.
* [doubao-seedream-4-0](https://aihubmix.com/model/doubao-seedream-4-0) – ByteDances SOTA-Multimodal-Bildmodell, unterstützt Multi-Bild-Fusion, Bildbearbeitung und Composite-Image-Generierung.

### Flux-Modelle

* [flux-2-flex](https://aihubmix.com/model/flux-2-flex) – Konzipiert für realitätsnahe kreative Produktionsworkflows; erzeugt hochwertige Bilder bei gleichzeitiger Konsistenz von Charakter und Stil über mehrere Referenzen hinweg.
* [flux-2-pro](https://aihubmix.com/model/flux-2-flex) – Ein Bildgenerierungs- und Bearbeitungsmodell von Black Forest Labs, das komplexes Lesen und Schreiben von Text unterstützt.
* [FLUX.1-Kontext-pro](FLUX.1-Kontext-pro) – Ein multimodales Flow-Matching-Modell von Black Forest Labs, das sowohl Text-zu-Bild-Generierung als auch kontextbezogene Bildbearbeitung unterstützt.

### iRAG-Modelle

* [irag-1.0](https://aihubmix.com/model/irag-1.0) – Baidus selbst entwickeltes Bildgenerierungsmodell mit hyperrealistischen Ergebnissen.
* [ernie-irag-edit](https://aihubmix.com/model/ernie-irag-edit) – Baidus selbst entwickeltes Bildbearbeitungsmodell mit Funktionen wie Erase, Repaint und Variation.

### Ideogram-Modelle

* [V3](https://aihubmix.com/model/V3) – Bildgenerierungsmodell von Ideogram AI, das schnell Bilder erzeugen kann.

## API-Schnittstelle

### Request-URL

```shellscript theme={null}
POST https://aihubmix.com/v1/models/<model_path>/predictions
```

<Tip>
  \<model\_path> hat die Form \<provider/model\_id>, z. B. \<openai/gpt-image-1.5>, \<qianfan/qwen-image>.
</Tip>

### Request-Header

```shellscript theme={null}
Authorization: Bearer $AIHUBMIX_API_KEY
Content-Type: application/json
```

### Request-Parameter

#### Allgemeine Parameter

| Parameter | Typ     | Pflicht | Beschreibung                                                                                                                                                                                      |
| --------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| prompt    | string  | Ja      | Prompt-Text                                                                                                                                                                                       |
| size      | string  | Nein    | Bildgröße; unterstützt `1K` (nicht in Doubao-4-5-Serie), `2K`, `4K`, `auto` (Standard). Qwen-Serie unterstützt: `512*1024`, `768*512`, `768*1024`, `1024*576`, `576*1024`, `1024*1024` (Standard) |
| image     | string  | Nein    | Pfad zum Referenzbild                                                                                                                                                                             |
| n         | integer | Nein    | Anzahl der zu generierenden Bilder, 1–10, Standard 1                                                                                                                                              |
| quality   | string  | Nein    | Rendering-Qualität: `low`, `medium`, `high`; höhere Qualität dauert länger                                                                                                                        |

#### OpenAI-Modell-Parameter

| Parameter       | Typ    | Pflicht | Beschreibung                                                                                                                                           |
| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| input\_fidelity | string | Nein    | Treue, unterstützt `high` und `low` (Standard)                                                                                                         |
| moderation      | string | Nein    | Strenge der Inhaltsmoderation, unterstützt `auto` (Standard, normale Filterung) und `low` (weniger Filterung); im Bild-zu-Bild-Modus nicht unterstützt |
| output\_format  | string | Nein    | Ausgabe-Bildformat: `png`, `jpeg` (Standard), `webp`                                                                                                   |

#### Flux-Modell-Parameter

| Parameter         | Typ     | Pflicht | Beschreibung                                                                        |
| ----------------- | ------- | ------- | ----------------------------------------------------------------------------------- |
| safety\_tolerance | integer | Nein    | Toleranz der Prüfung; höhere Werte = nachsichtiger. Bereich `0<=x<=5`, Standard `2` |
| aspect\_ratio     | string  | Nein    | Gewünschtes Seitenverhältnis: `16:9` (Standard), `1:1`, `4:3`                       |
| seed              | integer | Nein    | Zufalls-Seed                                                                        |
| raw               | boolean | Nein    | Aktiviert den Raw-Modus für eine natürlichere Bildwirkung, Standard `false`         |

#### Qwen-Modell-Parameter

| Parameter | Typ     | Pflicht | Beschreibung                                                                     |
| --------- | ------- | ------- | -------------------------------------------------------------------------------- |
| watermark | boolean | Nein    | Ob ein Wasserzeichen hinzugefügt wird; unterstützt `true` (Standard) und `false` |
| seed      | integer | Nein    | Zufalls-Seed, Bereich `[0,2147483647]`                                           |

#### Doubao-Modell-Parameter

| Parameter                              | Typ     | Pflicht | Beschreibung                                                                                                                                                     |
| -------------------------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sequential\_image\_generation          | string  | Nein    | Steuert, ob die Composite-Image-Funktion deaktiviert wird                                                                                                        |
| sequential\_image\_generation\_options | object  | Nein    | Composite-Image-Konfiguration, nur wirksam, wenn `sequential_image_generation` auf `auto` steht. Unterstützt derzeit `max_images`, Bereich \[1, 15], Standard 15 |
| watermark                              | boolean | Nein    | Wasserzeichen hinzufügen; `true` (Standard) und `false`                                                                                                          |
| seed                                   | integer | Nein    | Zufalls-Seed, Bereich \[-1, 2147483647], Standard -1                                                                                                             |
| response\_format                       | string  | Nein    | Rückgabeformat des generierten Bildes: `url` (Link 24 Stunden nach Generierung gültig, bitte zeitnah herunterladen) oder `base64_json`                           |

<Tip>
  Die tatsächlich erzeugbare Anzahl an Bildern wird nicht nur von `max_images`, sondern auch von der Anzahl der bereitgestellten Referenzbilder beeinflusst. Eingabe-Referenzbilder + finale Bildanzahl ≤ 15.
</Tip>

## Anwendungsbeispiele

### OpenAI

<CodeGroup>
  ```shellscript Text-to-Image theme={null}
  curl https://aihubmix.com/v1/models/openai/gpt-image-1.5/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace",
      "size": "1024x1024", 
      "n": 1,
      "quality": "high",
      "moderation": "low",
      "background": "auto"
    }
  }'
  ```

  ```shellscript Image-to-Image theme={null}
  curl https://aihubmix.com/v1/images/edits \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "model=gpt-image-1.5" \
    -F "prompt=Change the background to blue sky and white clouds." \
    -F "image=@test.png" \
    -F "size=1024x1024"
  ```
</CodeGroup>

#### gpt-image-2

Dies ist ein OpenAI-Modell für Bildbearbeitung. Verwenden Sie den vollständigen Modellnamen `gpt-image-2`; `image2` ist keine gültige Modell-ID. Wenn der Endpunkt `b64_json` zurückgibt, speichern die folgenden Beispiele das Ergebnis als `edited.png`.

<CodeGroup>
  ```powershell PowerShell theme={null}
  curl.exe -sS -X POST "https://aihubmix.com/v1/images/edits" `
    -H "Authorization: Bearer YOUR_API_KEY" `
    -F "model=gpt-image-2" `
    -F "prompt=Ändere den Hintergrund in blauen Himmel und weiße Wolken." `
    -F "image=@test.png" `
    -F "size=1024x1024" `
    -D headers.txt `
    -o response.json `
    -w "HTTP_CODE:%{http_code}`nTOTAL:%{time_total}`n"

  $b64 = (Get-Content .\response.json -Raw | ConvertFrom-Json).data[0].b64_json
  [IO.File]::WriteAllBytes(".\edited.png", [Convert]::FromBase64String($b64))
  ```

  ```typescript TypeScript theme={null}
  import { readFile, writeFile } from "node:fs/promises";

  const apiKey = process.env.AIHUBMIX_API_KEY;
  if (!apiKey) {
    throw new Error("Set AIHUBMIX_API_KEY first.");
  }

  const form = new FormData();
  form.append("model", "gpt-image-2");
  form.append("prompt", "Ändere den Hintergrund in blauen Himmel und weiße Wolken.");
  form.append("image", new Blob([await readFile("test.png")], { type: "image/png" }), "test.png");
  form.append("size", "1024x1024");

  const response = await fetch("https://aihubmix.com/v1/images/edits", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${apiKey}`,
    },
    body: form,
  });

  if (!response.ok) {
    throw new Error(`${response.status} ${await response.text()}`);
  }

  const result = (await response.json()) as {
    data: Array<{ b64_json: string }>;
  };

  await writeFile("edited.png", Buffer.from(result.data[0].b64_json, "base64"));
  ```
</CodeGroup>

### Google Imagen

<CodeGroup>
  ```shell Curl theme={null}
  curl https://aihubmix.com/v1/models/google/imagen-4.0-fast-generate-001/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace",
      "numberOfImages": 1
    }
  }'
  ```
</CodeGroup>

### Qwen

<CodeGroup>
  ```shellscript Qwen-Image theme={null}
  curl https://aihubmix.com/v1/models/qianfan/qwen-image/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
        "prompt": "A beautiful sunset over a calm ocean",
        "refer_image": "",
        "n": 1,
        "size": "1024x1024",
        "watermark": false
      }
    }'
  ```

  ```shellscript Qwen-Image-Edit theme={null}
  curl https://aihubmix.com/v1/models/qianfan/qwen-image-edit/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "Put this bear sitting under the moon (represented by a light gray crescent outline on a white background), holding a guitar, with small stars and speech bubbles like 'Be Kind' floating around.",
      "image": "https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4766809571/p999719.png",
      "n": 1,
      "size": "1024x1024",
      "watermark": false,
      "seed": 0
    }
  }'
  ```
</CodeGroup>

### Doubao

<CodeGroup>
  ```shellscript Text-to-Image theme={null}
  curl https://aihubmix.com/v1/models/doubao/doubao-seedream-4-0/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
        "prompt": "Interstellar, black hole, a vintage train bursting out of a black hole, vying for visual impact, cinematic blockbuster, apocalyptic feel, dynamic, contrasting colors, oc rendering, ray tracing, motion blur, depth of field, surrealism, deep blue, the scene is shaped by delicate rich color layers creating the subject and scene, realistic texture, the lighting effects of a dark background create an atmosphere, combining artistic fantasy, exaggerated wide-angle perspective, glare, reflection, extreme light and shadow, strong gravity, devouring",
        "size": "2K",
        "sequential_image_generation": "disabled",
        "stream": false,
        "response_format": "url",
        "watermark": true
      }
    }'
  ```

  ```shellscript Image-to-Image theme={null}
  curl https://aihubmix.com/v1/models/doubao/doubao-seedream-4-5/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
          "model": "doubao-seedream-4-5",
          "prompt": "Keep the model's pose and the flowing shape of the liquid clothing unchanged. Change the clothing material from silver metal to completely transparent clear water (or glass). Through the liquid flow, the model's skin details can be seen. The light and shadow change from reflection to refraction.",
          "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imageToimage.png",
          "size": "2K",
          "watermark": false
      }
    }'
  ```

  ```shellscript Multi-Image Fusion theme={null}
  curl https://aihubmix.com/v1/models/doubao/doubao-seedream-4-5/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
          "model": "doubao-seedream-4-5",
          "prompt": "Change the clothing in image 1 to the clothing in image 2",
          "image": ["https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png"],
          "sequential_image_generation": "disabled",
          "size": "2K",
          "watermark": false
      }
    }'
  ```

  ```shellscript Multiple Reference Image Generation theme={null}
  curl https://aihubmix.com/v1/models/doubao/doubao-seedream-4-5/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
          "model": "doubao-seedream-4-5",
          "prompt": "Generate 3 images of a girl and a cow toy happily riding a roller coaster in an amusement park, covering morning, noon, and evening",
          "image": ["https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_2.png"],
          "sequential_image_generation": "auto",
          "sequential_image_generation_options": {
              "max_images": 3
          },
          "size": "2K",
          "watermark": false
      }
    }'
  ```
</CodeGroup>

### Flux

<Note>
  * `flux-2-flex` und `flux-2-pro` sind asynchrone Endpoints, die einen zweistufigen Request erfordern. Diese Serie ist extrem schnell, nahezu sofortig.
  * `FLUX.1-Kontext-pro` nutzt eine allgemeine Schnittstelle und bietet einen einstufigen Prozess.
</Note>

#### **FLUX – Einstufiges Zeichnen**

```shellscript theme={null}
curl https://aihubmix.com/v1/images/generations \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
  "model": "FLUX.1-Kontext-pro",
  "prompt": "a cat in the garden, cute cartoon",
  "safety_tolerance": 6
}' \
| jq -r '.data[0].b64_json' \
| base64 -D > "$HOME/Desktop/image_extract.png"
```

#### **Flux – Asynchrones Zeichnen**

**Schritt 1: Zeichnungsanfrage senden**

<CodeGroup>
  ```shell Text-to-Image theme={null}
  curl https://aihubmix.com/v1/models/bfl/flux-kontext-max/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace. reference style as the given image:",
      "aspect_ratio": "2:3",
      "safety_tolerance": 6
    }
  }'
  ```

  ```shell Image-to-Image theme={null}
  curl https://aihubmix.com/v1/models/bfl/flux-kontext-max/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace. reference style as the given image:",
      "aspect_ratio": "2:3",
      "safety_tolerance": 2,
      "input_image": "https://assets.aihubmix.com/docs/ghibli.png"
    }
  }'
  ```
</CodeGroup>

Beispiel-Ausgabe:

```shell theme={null}
{
  "output": [
    {
      "taskId": "api.us1.***",
      "polling_url": "https://api.us1.bfl.ai/v1/get_result?id=f9821dbf-f134-41c2-aaa8-5405fb665c76"
    }
  ]
}
```

**Schritt 2: Link zum generierten Bild abrufen**

```shell Get Image theme={null}
curl https://api.aihubmix.com/v1/tasks/<taskId> \
    -H "Authorization: Bearer sk-***" \
    -X GET
```

### Ideogram V3

<Note>
  1. Versionen unterhalb V3 (V\_2, V\_1 usw.) sind alte Schnittstellen und werden nicht unterstützt.
  2. Die zurückgegebenen Links erfordern einen Proxy-Zugriff.
</Note>

<CodeGroup>
  ```shell Curl theme={null}
  curl https://aihubmix.com/v1/models/ideogram/V3/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace, in the style of Pixar 3D",
      "rendering_speed": "QUALITY",
      "aspect_ratio": "2x1"
    }
  }'
  ```
</CodeGroup>

### iRAG

<CodeGroup>
  ```bash ERNIE iRAG theme={null}
  curl https://aihubmix.com/v1/models/qianfan/irag-1.0/predictions\
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
        "prompt": "A beautiful sunset over a calm ocean",
        "refer_image": "",
        "n": 1,
        "size": "1024x1024",
        "guidance": 7.5,
        "watermark": false
      }
    }'
  ```

  ```bash ERNIE iRAG Edit theme={null}
  curl https://aihubmix.com/v1/models/qianfan/ernie-irag-edit/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "Add a flying pig",
      "image": "http://***"
    }
  }'
  ```
</CodeGroup>

***

Zuletzt aktualisiert: 2026-06-01
