Pour une nouvelle intégration, utilisez Génération d’images avec le protocole unifié
/ai/v1/images/generations. Les interfaces compatibles de cette page restent disponibles. Consultez l’API Schema du modèle, sélectionnez l’endpoint par son path et lisez son request.schema sans dépendre de l’ordre du tableau.Inventaire actuel des modèles
| Fournisseur | ID de modèles |
|---|---|
| OpenAI | gpt-image-2, gpt-image-2-free, gpt-image-1.5, gpt-image-1, gpt-image-1-mini, dall-e-3, dall-e-2 |
| Google Gemini | gemini-3.1-flash-lite-image, gemini-3.1-flash-image, gemini-3-pro-image, gemini-3.1-flash-image-preview, gemini-3.1-flash-image-preview-free, gemini-3-pro-image-preview, gemini-2.5-flash-image, gemini-2.5-flash-image-preview |
| Google Imagen | imagen-4.0, imagen-4.0-fast-generate-001, imagen-4.0-generate-001, imagen-4.0-ultra-generate-001, imagen-4.0-ultra |
| Qwen / Wan | qwen-image-3.0, qwen-image-3.0-pro, qwen-image-2.0, qwen-image-2.0-pro, wan2.7-image, wan2.7-image-pro, qwen-image, qwen-image-edit, qwen-image-max, wan2.6-t2i |
| GLM | glm-image |
| ByteDance | doubao-seedream-5.0-pro, doubao-seedream-5.0-lite, doubao-seedream-4-5, doubao-seedream-4-0 |
| Microsoft | mai-image-2.5-pro, mai-image-2.5, mai-image-2.5-flash |
| Ideogram | V3, V_2, V_2_TURBO, V_2A, V_2A_TURBO, V_1, V_1_TURBO, DESCRIBE, UPSCALE |
| Stable Diffusion | Stable-Diffusion-3-5-Large |
| Baidu | ernie-image-turbo, musesteamer-air-image |
| Flux | flux-2-flex, flux-2-pro, FLUX-1.1-pro |
| Agnes | agnes-image-2.1-flash |
Cet inventaire indique les modèles actuellement disponibles. Il ne signifie pas que tous acceptent les mêmes champs. Sélectionnez l’endpoint par
path dans le Schema du modèle, puis lisez son request.schema.API
Interface API
URL de requête
POST https://aihubmix.com/v1/models/<model_path>/predictions
<model_path> est <provider/model_id>, par exemple <openai/gpt-image-1.5>, <qianfan/qwen-image>.
En-têtes de requête
Authorization: Bearer $AIHUBMIX_API_KEY
Content-Type: application/json
Paramètres de requête
Paramètres généraux
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| prompt | string | Oui | Mots-clés du prompt |
| size | string | Non | Taille de l’image, prend en charge 1K (non pris en charge dans la série Doubao-4-5), 2K, 4K, auto (par défaut). La série Qwen prend en charge : 512*1024, 768*512, 768*1024, 1024*576, 576*1024, 1024*1024 (par défaut) |
| image | string | Non | Chemin de l’image de référence |
| n | integer | Non | Nombre d’images à générer, prend en charge 1-10, valeur par défaut : 1 |
| quality | string | Non | Qualité du rendu, prend en charge low, medium et high ; une qualité supérieure prend plus de temps |
Paramètres des modèles OpenAI
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| input_fidelity | string | Non | Fidélité, prend en charge high et low (par défaut) |
| moderation | string | Non | Sévérité de la modération de contenu, prend en charge auto (par défaut, filtrage standard) et low (moins de filtrage), non pris en charge en mode image-vers-image |
| output_format | string | Non | Format de l’image de sortie, prend en charge png, jpeg (par défaut), webp |
Paramètres des modèles Flux
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| safety_tolerance | integer | Non | Tolérance de modération, des valeurs plus élevées indiquent plus de tolérance. Plage 0<=x<=5, valeur par défaut : 2 |
| aspect_ratio | string | Non | Rapport d’aspect souhaité pour l’image, prend en charge 16:9 (par défaut), 1:1, 4:3 |
| seed | integer | Non | Seed pour le nombre aléatoire |
| raw | boolean | Non | Activer le mode brut pour un effet visuel plus naturel, valeur par défaut : false |
Paramètres des modèles Qwen
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| watermark | boolean | Non | Ajouter un filigrane à l’image générée, prend en charge true (par défaut) et false |
| seed | integer | Non | Seed pour le nombre aléatoire, plage [0,2147483647] |
Paramètres des modèles Doubao
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| sequential_image_generation | string | Non | Contrôle l’activation/désactivation de la fonctionnalité d’image composite |
| sequential_image_generation_options | object | Non | Configuration de l’image composite, effective uniquement lorsque sequential_image_generation vaut auto. Prend actuellement en charge max_images, plage [1, 15], valeur par défaut : 15 |
| watermark | boolean | Non | Ajouter un filigrane à l’image générée, prend en charge true (par défaut) et false |
| seed | integer | Non | Seed pour le nombre aléatoire, plage [-1, 2147483647], valeur par défaut : -1 |
| response_format | string | Non | Format de retour pour l’image générée, prend en charge url (lien valide 24 heures après la génération, à télécharger rapidement) ou base64_json |
Le nombre réel d’images pouvant être générées est influencé non seulement par
max_images mais aussi par le nombre d’images de référence fournies. Nombre d’images de référence en entrée + nombre final d’images générées ≤ 15.Exemples d’utilisation
OpenAI
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"
}
}'
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"
gpt-image-2
Il s’agit d’un modèle OpenAI d’édition d’image. Utilisez le nom completgpt-image-2 ; image2 n’est pas un ID de modèle valide. Lorsque l’endpoint renvoie b64_json, les exemples ci-dessous enregistrent le résultat dans edited.png.
curl.exe -sS -X POST "https://aihubmix.com/v1/images/edits" `
-H "Authorization: Bearer YOUR_API_KEY" `
-F "model=gpt-image-2" `
-F "prompt=Remplace l'arrière-plan par un ciel bleu et des nuages blancs." `
-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))
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", "Remplace l'arrière-plan par un ciel bleu et des nuages blancs.");
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"));
Google Imagen
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
}
}'
Qwen
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
}
}'
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
}
}'
Doubao
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
}
}'
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
}
}'
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
}
}'
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
}
}'
Flux
flux-2-flexetflux-2-prosont des endpoints asynchrones, nécessitant une requête en deux étapes. Cette série est extrêmement rapide, quasi instantanée.
Génération en une étape avec FLUX
Génération asynchrone Flux
Étape 1 : envoyer la requête de génération Exemple de résultat de sortie :{
"output": [
{
"taskId": "api.us1.***",
"polling_url": "https://api.us1.bfl.ai/v1/get_result?id=f9821dbf-f134-41c2-aaa8-5405fb665c76"
}
]
}
Get Image
curl https://api.aihubmix.com/v1/tasks/<taskId> \
-H "Authorization: Bearer sk-***" \
-X GET
Ideogram V3
- Les versions inférieures à V3 (V_2, V_1, etc.) correspondent à d’anciennes interfaces et ne sont pas prises en charge.
- Les liens retournés nécessitent un proxy réseau pour être accessibles.
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"
}
}'