Zum Hauptinhalt springen
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": "wan2.7-image-pro",
    "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
  }'
import requests

url = "https://api.apimart.ai/v1/images/generations"

payload = {
    "model": "wan2.7-image-pro",
    "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
}

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: "wan2.7-image-pro",
  prompt: "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
};

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));
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    url := "https://api.apimart.ai/v1/images/generations"

    payload := map[string]interface{}{
        "model":  "wan2.7-image-pro",
        "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display",
    }

    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class Main {
    public static void main(String[] args) throws Exception {
        String payload = """
        {
          "model": "wan2.7-image-pro",
          "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
        }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.apimart.ai/v1/images/generations"))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(payload))
            .build();

        System.out.println(client.send(request,
            HttpResponse.BodyHandlers.ofString()).body());
    }
}
<?php

$url = "https://api.apimart.ai/v1/images/generations";

$payload = [
    "model" => "wan2.7-image-pro",
    "prompt" => "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
require 'net/http'
require 'json'
require 'uri'

url = URI("https://api.apimart.ai/v1/images/generations")

payload = {
  model: "wan2.7-image-pro",
  prompt: "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
}

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = payload.to_json

response = http.request(request)
puts response.body
import Foundation

let url = URL(string: "https://api.apimart.ai/v1/images/generations")!

let payload: [String: Any] = [
    "model": "wan2.7-image-pro",
    "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
]

var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let error = error { print("Error: \(error)"); return }
    if let data = data, let str = String(data: data, encoding: .utf8) { print(str) }
}
task.resume()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        var payload = @"{
            ""model"": ""wan2.7-image-pro"",
            ""prompt"": ""A flower shop with exquisite windows, beautiful wooden door, flowers on display""
        }";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");

        var content = new StringContent(payload, Encoding.UTF8, "application/json");
        var response = await client.PostAsync(
            "https://api.apimart.ai/v1/images/generations", content);
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
{
  "code": "success",
  "data": [
    {
      "task_id": "task_01HX...",
      "status": "processing"
    }
  ]
}
{
  "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 your account.",
    "type": "payment_required"
  }
}
{
  "error": {
    "code": 429,
    "message": "Too many requests. Please try again later.",
    "type": "rate_limit_error"
  }
}
{
  "error": {
    "code": 500,
    "message": "Internal server error. Please try again later.",
    "type": "server_error"
  }
}
curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "wan2.7-image-pro",
    "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
  }'
import requests

url = "https://api.apimart.ai/v1/images/generations"

payload = {
    "model": "wan2.7-image-pro",
    "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
}

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: "wan2.7-image-pro",
  prompt: "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
};

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));
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    url := "https://api.apimart.ai/v1/images/generations"

    payload := map[string]interface{}{
        "model":  "wan2.7-image-pro",
        "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display",
    }

    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class Main {
    public static void main(String[] args) throws Exception {
        String payload = """
        {
          "model": "wan2.7-image-pro",
          "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
        }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.apimart.ai/v1/images/generations"))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(payload))
            .build();

        System.out.println(client.send(request,
            HttpResponse.BodyHandlers.ofString()).body());
    }
}
<?php

$url = "https://api.apimart.ai/v1/images/generations";

$payload = [
    "model" => "wan2.7-image-pro",
    "prompt" => "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
require 'net/http'
require 'json'
require 'uri'

url = URI("https://api.apimart.ai/v1/images/generations")

payload = {
  model: "wan2.7-image-pro",
  prompt: "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
}

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = payload.to_json

response = http.request(request)
puts response.body
import Foundation

let url = URL(string: "https://api.apimart.ai/v1/images/generations")!

let payload: [String: Any] = [
    "model": "wan2.7-image-pro",
    "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
]

var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let error = error { print("Error: \(error)"); return }
    if let data = data, let str = String(data: data, encoding: .utf8) { print(str) }
}
task.resume()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        var payload = @"{
            ""model"": ""wan2.7-image-pro"",
            ""prompt"": ""A flower shop with exquisite windows, beautiful wooden door, flowers on display""
        }";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");

        var content = new StringContent(payload, Encoding.UTF8, "application/json");
        var response = await client.PostAsync(
            "https://api.apimart.ai/v1/images/generations", content);
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
{
  "code": "success",
  "data": [
    {
      "task_id": "task_01HX...",
      "status": "processing"
    }
  ]
}
{
  "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 your account.",
    "type": "payment_required"
  }
}
{
  "error": {
    "code": 429,
    "message": "Too many requests. Please try again later.",
    "type": "rate_limit_error"
  }
}
{
  "error": {
    "code": 500,
    "message": "Internal server error. Please try again later.",
    "type": "server_error"
  }
}

Autorisierung

Authorization
string
erforderlich
Alle Anfragen erfordern eine Bearer-Token-Authentifizierung.Besuchen Sie die API-Key-Verwaltungsseite, um Ihren API-Key zu erhalten, und fügen Sie ihn dann dem Request-Header hinzu:
Authorization: Bearer YOUR_API_KEY

Verfügbare Modelle

ModellBeschreibungMax. Auflösung (Text-zu-Bild)Max. Auflösung (Bearbeitung / Sequenziell)Preis
wan2.7-image-proProfessional Edition, bessere Details, unterstützt 4K4K2K¥0,50 / Bild
wan2.7-imageStandard Edition, schnellere Generierung2K2K¥0,20 / Bild
Die Abrechnung erfolgt nach erfolgreich generierte Bilder × Stückpreis. Eingaben werden nicht abgerechnet. Auflösung und Seitenverhältnis beeinflussen den Preis nicht. Fehlgeschlagene Anfragen werden nicht berechnet.

Body

model
string
erforderlich
Name des Bildgenerierungsmodells.
  • wan2.7-image-pro — Professional Edition, bis zu 4K für Text-zu-Bild
  • wan2.7-image — Standard Edition, schneller, bis zu 2K
prompt
string
Textbeschreibung für die Bildgenerierung, bis zu 5000 Zeichen.
  • Text-zu-Bild (ohne image_urls): erforderlich
  • Bildbearbeitung (mit image_urls): optional, aber empfohlen
Beispiel: "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
image_urls
array<string>
Array von Eingabebild-URLs für Bearbeitung und Mehrbild-Referenzszenarien.Die Angabe dieses Feldes schaltet die Anfrage in den Bildbearbeitungsmodus.Unterstützte Formate: HTTP/HTTPS-URLs; data:image/...;base64,... Base64Einschränkungen: Bis zu 9 Bilder; JPEG / PNG / WEBP / BMP; 240–8000 px, Seitenverhältnis 1:8 ~ 8:1; ≤ 20 MB pro Bild
Das Ausgabe-Seitenverhältnis entspricht automatisch dem letzten Eingabebild. Der Bearbeitungsmodus unterstützt nur bis zu 2K — 4K ist nicht verfügbar.
n
integer
Standard:"1"
Anzahl der zu generierenden Bilder.
  • Standardmodus: 1–4 (Standard 1)
  • Sequenzieller Modus (enable_sequential: true): 1–12 (Standard 1)
Abrechnung pro erfolgreich generiertem Bild. Vorausberechnung basierend auf n.
size
string
Ausgabeauflösung oder Seitenverhältnis. Unterstützt drei Formate:① Auflösungsschlüsselwort (empfohlen): 1K / 2K (Standard) / 4K (nur Text-zu-Bild für wan2.7-image-pro)② Seitenverhältnis: 1:1 / 16:9 / 9:16 / 4:3 / 3:4 / 3:2 / 2:3 (standardmäßig 2K-Stufe)③ Pixelmaße: 1024x1024 oder 1024*1024
resolution
string
Schlüsselwort für die Auflösungsstufe: 1K / 2K / 4K. Kann mit size (Seitenverhältnis) kombiniert werden.
ModellSzenarioUnterstützte StufenPixelbereich
wan2.7-image-proText-zu-Bild (nicht sequenziell)1K / 2K / 4K768×768 ~ 4096×4096
wan2.7-image-proBearbeitung / Sequenziell1K / 2K768×768 ~ 2048×2048
wan2.7-imageAlle Szenarien1K / 2K768×768 ~ 2048×2048
negative_prompt
string
Negativer Prompt, der zu vermeidende Elemente beschreibt. Beispiel: "blurry, distorted, low quality"
watermark
boolean
Standard:"false"
Ob ein “AI Generated”-Wasserzeichen in der unteren rechten Ecke hinzugefügt werden soll.
seed
integer
Zufallsseed, Bereich 0–2147483647. Derselbe Seed mit identischen Parametern erzeugt visuell konsistente Ergebnisse.
thinking_mode
boolean
Standard:"true"
Aktiviert den erweiterten Reasoning-Modus, um die Bildqualität auf Kosten einer längeren Generierungszeit zu verbessern.
Nur wirksam, wenn der sequenzielle Modus deaktiviert ist und keine Bildeingabe bereitgestellt wird.
enable_sequential
boolean
Standard:"false"
Aktiviert den sequenziellen Bildgenerierungsmodus — generiert mehrere thematisch zusammenhängende Bilder in einer Anfrage. Ideal für Storyboards und Serien.
  • Maximum n ist 12 bei Aktivierung
  • thinking_mode und color_palette werden im sequenziellen Modus ignoriert
  • wan2.7-image-pro unterstützt im sequenziellen Modus bis zu 2K (4K nicht unterstützt)
bbox_list
array
Begrenzungsrahmen für interaktive Bearbeitung — gibt genaue Bereiche zum Bearbeiten oder Einfügen von Inhalten an.Struktur: [[[x1, y1, x2, y2], ...], ...]
  • Die Länge des äußeren Arrays muss der Länge von image_urls entsprechen
  • Übergeben Sie [] für Bilder ohne Begrenzungsrahmen
  • Maximal 2 Rahmen pro Bild; Koordinaten sind absolute Pixelwerte, Ursprung (0,0) oben links
Beispiel: [[], [[989, 515, 1138, 681]]]
color_palette
array<object>
Benutzerdefiniertes Farbthema. Nur Standardmodus (nicht sequenzieller Modus).
  • 3–10 Einträge (8 empfohlen); jeder Eintrag erfordert hex und ratio
  • Die Summe aller ratio-Werte muss genau 100.00% ergeben
[
  { "hex": "#C2D1E6", "ratio": "23.51%" },
  { "hex": "#636574", "ratio": "76.49%" }
]

Response

code
string
Antwortstatus. Gibt bei Erfolg "success" zurück.
data
array

Beispiele

Text-zu-Bild (minimal)

{
  "model": "wan2.7-image-pro",
  "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
}

Text-zu-Bild (mit Auflösung)

{
  "model": "wan2.7-image-pro",
  "prompt": "Summer beach, blue sky and white clouds, 4K ultra HD",
  "size": "4K",
  "thinking_mode": true
}

Text-zu-Bild (benutzerdefinierte Farbpalette)

{
  "model": "wan2.7-image-pro",
  "prompt": "Minimalist modern living room",
  "size": "2K",
  "color_palette": [
    { "hex": "#C2D1E6", "ratio": "23.51%" },
    { "hex": "#CDD8E9", "ratio": "20.13%" },
    { "hex": "#B5C8DB", "ratio": "15.88%" },
    { "hex": "#C0B5B4", "ratio": "13.27%" },
    { "hex": "#DAE0EC", "ratio": "10.11%" },
    { "hex": "#636574", "ratio": "8.93%" },
    { "hex": "#CACAD2", "ratio": "5.55%" },
    { "hex": "#CBD4E4", "ratio": "2.62%" }
  ]
}

Sequenzielle Bildgenerierung

{
  "model": "wan2.7-image-pro",
  "prompt": "Cinematic series: the same stray orange cat, consistent features. First: under cherry blossoms in spring. Second: old street shade in summer. Third: fallen leaves in autumn. Fourth: snow footprints in winter.",
  "enable_sequential": true,
  "n": 4,
  "size": "2K"
}

Einzelbildbearbeitung

{
  "model": "wan2.7-image",
  "prompt": "Replace the background with a sunset scene, warm color tones",
  "image_urls": ["https://example.com/portrait.jpg"],
  "size": "2K"
}

Mehrbild-Referenz / Elementfusion

{
  "model": "wan2.7-image-pro",
  "prompt": "Apply the graffiti from image 2 onto the car in image 1",
  "image_urls": [
    "https://example.com/car.webp",
    "https://example.com/paint.webp"
  ],
  "size": "2K"
}

Interaktive Bearbeitung (Begrenzungsrahmen)

bbox_list entspricht 1:1 dem image_urls. Übergeben Sie [] für Bilder ohne Auswahl.
{
  "model": "wan2.7-image-pro",
  "prompt": "Place the alarm clock from image 1 into the selected area of image 2, blending naturally",
  "image_urls": [
    "https://example.com/clock.webp",
    "https://example.com/desk.webp"
  ],
  "bbox_list": [
    [],
    [[989, 515, 1138, 681]]
  ],
  "size": "2K"
}
Ergebnisse abfragenDie Bildgenerierung erfolgt asynchron. Fragen Sie den Aufgabenstatus-Endpunkt mit der zurückgegebenen task_id ab, bis status == completed.