DrawNew.comPOST /api/v1/generate · GET /api/v1/tasks
Öffentliche Endpunkte für Batch- und Agent-Integrationen. Authentifizieren Sie sich mit dem API-Key, der bereits Ihrem Konto zugewiesen wurde — kein separates Token erforderlich.
/api/v1/generateSendet den Auftrag an den übergeordneten Bildanbieter und gibt sofort task_ids zurück. Um das resultierende Bild zu erhalten, können Sie entweder (A) selbst GET /v1/tasks/:id abfragen oder (B) einfach die Website öffnen — dieselbe Kontos Bildenerstellung-Registerkarte übernimmt den Auftrag automatisch und speichert die Ergebnisse in "Meine Werke".
curl -X POST https://www.drawnew.com/api/v1/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene Japanese garden in autumn",
"model": "flash",
"mode": "text",
"aspect": "16:9",
"imageSize": "2K",
"count": 1
}'{
"task_ids": ["task_abc123"]
}| Feld | Typ | Erforderlich | Standard | Beschreibung |
|---|---|---|---|---|
| prompt | string | ✓ | — | Generierungsprompt |
| model | string | gpt-image-2 | Modell-ID (siehe unten) | |
| mode | text | edit | fusion | text | text=Text-zu-Bild; edit=Einzelbild-Bearbeitung; fusion=Mehrbild-Mischung | |
| aspect | string | 1:1 | Verhältnis: 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9, … | |
| imageSize | 1K | 2K | 4K | 2K | Ausgabeauflösung | |
| count | number | 1 | Bildanzahl (pro Modell begrenzt) | |
| imageUrls | string[] | [] | Referenzbild-URLs für edit / fusion |
| model | Name | Unterstützte Modi |
|---|---|---|
| gpt-image-2 | GPT Image 2 | text, edit |
| pro | Nano Banana Pro | text, edit |
| flash2 | Nano Banana 2 | text, edit |
| flash | Nano Banana | text, edit |
| HTTP | error.type | Wann |
|---|---|---|
| 400 | invalid_request | Body ist kein JSON, Prompt ist leer, Modell unbekannt oder Modell unterstützt den Modus nicht |
| 401 | unauthorized | Fehlender Authorization-Header oder falsches Format |
| 401 | invalid_api_key | API-Key in user_keys nicht gefunden |
| 403 | no_credits | Monatliches Kontingent erreicht. Upgrade unter https://drawnew.com/pricing |
/api/v1/tasks/{task_id}Gibt den übergeordneten Auftragsstatus zurück. status ist einer von queued / in_progress / completed / failed. completed fügt ein imageUrl-Feld hinzu; failed fügt ein error-Feld hinzu.
curl https://www.drawnew.com/api/v1/tasks/task_abc123{
"task_id": "task_abc123",
"status": "completed",
"progress": 100,
"imageUrl": "https://files.example.com/generated/xxx.png"
}/api/v1/tasks?ids=t1,t2Fragt mehrere Aufträge in einem Aufruf ab, um Roundtrips und Auth-Abfragen zu sparen. Ergebnisse werden in derselben Reihenfolge wie die Eingabe-IDs zurückgegeben. Maximal 20 IDs pro Anfrage.
curl "https://www.drawnew.com/api/v1/tasks?ids=task_abc,task_def,task_ghi"{
"tasks": [
{ "task_id": "task_abc", "status": "completed", "progress": 100, "imageUrl": "https://..." },
{ "task_id": "task_def", "status": "in_progress", "progress": 60 },
{ "task_id": "task_ghi", "status": "failed", "progress": 0, "error": "model overloaded" }
]
}| HTTP | error.type | Wann |
|---|---|---|
| 400 | invalid_request | Fehlender ids-Parameter oder mehr als 20 IDs |
| 401 | unauthorized | Fehlender Authorization-Header oder falsches Format |
| 401 | invalid_api_key | API-Key in user_keys nicht gefunden |
/api/v1/uploadServerseitiger Abruf eines Bildes von einer öffentlichen URL und erneutes Hosting auf dem übergeordneten CDN, Rückgabe einer stabilen URL. Übergeben Sie das Ergebnis an generate_image's imageUrls. Maximal 25 MB pro Bild; png / jpeg / webp / gif / bmp akzeptiert.
curl -X POST https://www.drawnew.com/api/v1/upload \
-H "Content-Type: application/json" \
-d '{"source_url": "https://example.com/cat.png"}'{
"url": "https://files.example.com/uploads/abc123.png",
"filename": "cat.png",
"content_type": "image/png",
"bytes": 524288
}Für LLM-Agenten ist der einfachste Weg, DrawNew zu nutzen, über den offiziellen MCP-Server, der als @drawnew/mcp-server auf npm veröffentlicht wird. Er stellt 6 Tools (generate_image, get_task, batch_get_tasks, upload_reference_image, list_my_generations, get_account_status) über stdio bereit und funktioniert mit jedem MCP-kompatiblen Client. Fügen Sie den folgenden Snippet zur MCP-Konfiguration Ihres Clients hinzu — das war's.
Pfad: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) · %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"drawnew": {
"command": "npx",
"args": ["-y", "@drawnew/mcp-server"]
}
}
}