curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-2.0",
"prompt": "A cute orange cat napping in the sunshine"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "qwen-image-2.0",
"prompt": "A cute orange cat napping in the sunshine"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/images/generations";
const payload = {
model: "qwen-image-2.0",
prompt: "A cute orange cat napping in the sunshine",
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01JGXYZ1234567890ABCDEF"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Authentication failed, please check your API key",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient balance, please top up",
"type": "payment_required"
}
}
Qwen Image 2.0
Qwen Image 2.0 Bildgenerierung
- Asynchroner Verarbeitungsmodus, gibt eine Aufgaben-ID für nachfolgende Abfragen zurück
- Unterstützt Text-zu-Bild, Bild-zu-Bild und andere Generierungsmodi
- Unterstützt Auflösungsstufen 1K/2K, generiert bis zu 6 Bilder
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-2.0",
"prompt": "A cute orange cat napping in the sunshine"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "qwen-image-2.0",
"prompt": "A cute orange cat napping in the sunshine"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/images/generations";
const payload = {
model: "qwen-image-2.0",
prompt: "A cute orange cat napping in the sunshine",
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01JGXYZ1234567890ABCDEF"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Authentication failed, please check your API key",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient balance, please top up",
"type": "payment_required"
}
}
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-2.0",
"prompt": "A cute orange cat napping in the sunshine"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "qwen-image-2.0",
"prompt": "A cute orange cat napping in the sunshine"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/images/generations";
const payload = {
model: "qwen-image-2.0",
prompt: "A cute orange cat napping in the sunshine",
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01JGXYZ1234567890ABCDEF"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Authentication failed, please check your API key",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient balance, please top up",
"type": "payment_required"
}
}
Unterstützte Modelle
| Modell | Beschreibung | Max. Bilder | Preis |
|---|---|---|---|
qwen-image-2.0 | Standardversion, ausgewogene Qualität und Leistung | 6 | Festpreis |
qwen-image-2.0-pro | Pro-Version, stärkere Textwiedergabe, feinere realistische Texturen | 6 | Festpreis |
Autorisierung
string
erforderlich
Alle Endpunkte erfordern eine Bearer-Token-AuthentifizierungAPI-Key abrufen:Besuchen Sie die API-Key-Verwaltung, um Ihren API-Key zu erhaltenZum Request-Header hinzufügen:
Authorization: Bearer YOUR_API_KEY
Body
string
erforderlich
Modellname
qwen-image-2.0– Standardversion, ausgewogene Qualität und Leistungqwen-image-2.0-pro– Pro-Version, stärkere Textwiedergabe, feinere realistische Texturen
boolean
Standard:"false"
Legt fest, ob der Inhalt vor dem Absenden des Bildauftrags moderiert wird.
true: Prompts und Eingabebilder mitomni-moderation-latestprüfenfalseoder nicht angegeben: keine Moderationsanfrage und damit keine zusätzlichen Moderationskosten oder Verzögerung (Standard)
string
erforderlich
Textbeschreibung für die Bildgenerierung, bis zu 800 Zeichen
string
Standard:"1:1"
Seitenverhältnis des BildesUnterstützte Seitenverhältnisse:
1:1– Quadrat (Standard)4:3– Querformat 4:33:4– Hochformat 3:416:9– Querformat Breitbild9:16– Hochformat vertikal3:2– Querformat 3:22:3– Hochformat 2:3
string
Standard:"1K"
Auflösungsstufe
1K– Standardauflösung (Standard)2K– Hochauflösend
integer
Standard:"1"
Anzahl der zu generierenden BilderBereich: 1–6
string
Negativer Prompt (Inhalt, der nicht erscheinen soll), bis zu 500 Zeichen
array
Array von Referenzbild-URLs (Bild-zu-Bild-Modus)Einschränkungen:
- Müssen öffentlich zugängliche URLs sein
- Base64-Format wird nicht unterstützt
Auflösungs-Referenztabelle
Die Ausgabegröße wird durch die Kombination vonsize (Verhältnis) + resolution (Auflösungsstufe) gesteuert.
| Verhältnis | Stufe 1K | Stufe 2K |
|---|---|---|
1:1 | 1024×1024 | 2048×2048 |
4:3 | 1152×864 | 2048×1536 |
3:4 | 864×1152 | 1536×2048 |
16:9 | 1280×720 | 2048×1152 |
9:16 | 720×1280 | 1152×2048 |
3:2 | 1248×832 | 2048×1360 |
2:3 | 832×1248 | 1360×2048 |
- Nur
size→ standardmäßig Stufe 1K:{"size": "16:9"}→ 1280×720 size+resolution→ angegebene Stufe:{"size": "16:9", "resolution": "2K"}→ 2048×1152
Anwendungsbeispiele
Text-zu-Bild (minimale Anfrage){
"model": "qwen-image-2.0",
"prompt": "A cute orange cat napping in the sunshine"
}
{
"model": "qwen-image-2.0-pro",
"prompt": "Cyberpunk-style futuristic city nightscape with flickering neon lights",
"size": "16:9",
"n": 4
}
{
"model": "qwen-image-2.0-pro",
"prompt": "Exquisite food photography, sushi platter",
"size": "4:3",
"resolution": "2K",
"n": 2
}
{
"model": "qwen-image-2.0",
"prompt": "Change the background to a seaside sunset",
"image_urls": ["https://example.com/my-photo.jpg"]
}
Response
integer
Antwort-Statuscode
array
Hinweise
- Asynchrone Verarbeitung: Nach dem Senden wird eine
task_idzurückgegeben. Fragen Sie/v1/tasks/{task_id}ab, um die Ergebnisse zu erhalten - Bildspeicherung: Generierte Bilder werden auf das Plattform-CDN gespiegelt und sind langfristig gültig
- Abrechnungsregeln: Abrechnung pro erfolgreich generiertem Bild, keine Gebühr bei Fehlern
- Anforderungen an Bild-URLs: Eingabebilder müssen öffentlich zugängliche URLs sein, base64 wird nicht unterstützt