Zum Inhalt springen
API-Referenz
API-Referenz

Wan Text zu Video

Erzeuge Videos mit Erzählungen über mehrere Einstellungen und 720p-/1080p-Ausgabe mit Alibaba Wan.

01

Übersicht

Verwenden Sie den Endpunkt „Text zu Video" mit einem unterstützten Modell. Verwenden Sie die zurückgegebene Task-ID, um den Status abzurufen, oder geben Sie callback_url für die unten dokumentierten Zustellungen an.

Schnellstart

  1. Erstellen Sie einen API-Schlüssel und setzen Sie ihn als RUNAPI_API_KEY.
  2. Wählen Sie ein unterstütztes Modell und senden Sie eine POST-Anfrage, deren Body dem Schema dieses Modells entspricht.
  3. Speichern Sie die zurückgegebene Task-ID und fragen Sie den Status ab, bis ein Endzustand erreicht ist, oder verarbeiten Sie die unten dokumentierten Callbacks.

Endpunkt

POST /api/v1/wan/text_to_video
Basis-URL
https://runapi.ai
API-Version
v1
Authentifizierung
Authorization: Bearer YOUR_API_TOKEN
02

Unterstützte Modelle

Öffnen Sie eine Modellseite für aktuelle Preise, Ratenlimits und Details zur kommerziellen Nutzung.

03

Anfrage-Schema

JSON-Body

Felder und zulässige Werte hängen vom ausgewählten Modell ab. Wenn angegeben, empfängt callback_url die unten dokumentierten Task-Zustellungen.

wan-2.2-a14b-text-to-video-turbo18 Felder
accelerationstring
Optional
aspect_ratiostring
Optional
background_audio_urlstring
Optional
callback_urlstring
Optional
duration_secondsinteger
Optional
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Optional
modelstring
Optional
negative_promptstring
Optional
output_resolutionstring
Optional Zulässige Werte: 480p, 580p, 720p Standard: 720p
promptstring
Optional
ratiostring
Optional
reference_audio_urlstring
Optional
reference_image_urlsarray
Optional
reference_video_urlsarray
Optional
seedinteger
Optional
watermarkboolean
Optional
wan-2.5-text-to-video18 Felder
accelerationstring
Optional
aspect_ratiostring
Optional
background_audio_urlstring
Optional
callback_urlstring
Optional
duration_secondsinteger
Optional Zulässige Werte: 5, 10
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Optional
modelstring
Optional
negative_promptstring
Optional
output_resolutionstring
Erforderlich Zulässige Werte: 720p, 1080p
promptstring
Optional
ratiostring
Optional
reference_audio_urlstring
Optional
reference_image_urlsarray
Optional
reference_video_urlsarray
Optional
seedinteger
Optional
watermarkboolean
Optional
wan-2.6-text-to-video18 Felder
accelerationstring
Optional
aspect_ratiostring
Optional
background_audio_urlstring
Optional
callback_urlstring
Optional
duration_secondsinteger
Optional
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Optional
modelstring
Optional
multi_shotsboolean
Optional

Steuert, ob das generierte Video mehrere Aufnahmen mit Übergängen statt einer einzigen durchgehenden Aufnahme verwendet.

negative_promptstring
Optional
output_resolutionstring
Optional Zulässige Werte: 720p, 1080p Standard: 1080p
promptstring
Optional
ratiostring
Optional
reference_audio_urlstring
Optional
reference_image_urlsarray
Optional
reference_video_urlsarray
Optional
watermarkboolean
Optional
wan-2.7-r2v18 Felder
accelerationstring
Optional
aspect_ratiostring
Optional Zulässige Werte: 16:9, 9:16, 1:1, 4:3, 3:4
background_audio_urlstring
Optional
callback_urlstring
Optional
duration_secondsinteger
Optional Standard: 5 Bereich: 2 - 10
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Optional
modelstring
Optional
negative_promptstring
Optional
output_resolutionstring
Optional Zulässige Werte: 720p, 1080p Standard: 1080p
promptstring
Optional
ratiostring
Optional
reference_audio_urlstring
Optional
reference_image_urlsarray
Optional
reference_video_urlsarray
Optional
seedinteger
Optional
watermarkboolean
Optional
wan-2.7-text-to-video18 Felder
accelerationstring
Optional
aspect_ratiostring
Optional
background_audio_urlstring
Optional
callback_urlstring
Optional
duration_secondsinteger
Optional
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Optional
modelstring
Optional
negative_promptstring
Optional
output_resolutionstring
Optional Zulässige Werte: 720p, 1080p Standard: 1080p
promptstring
Optional
ratiostring
Optional
reference_audio_urlstring
Optional
reference_image_urlsarray
Optional
reference_video_urlsarray
Optional
seedinteger
Optional
watermarkboolean
Optional

Bedingte Regeln

Diese Anforderungen gelten, wenn alle aufgeführten Bedingungen zutreffen.

  1. Wenn model = wan-2.2-a14b-text-to-video-turbo
    Erforderlich
    Nicht akzeptiert
    multi_shots
  2. Wenn model = wan-2.5-text-to-video
    Erforderlich
    Nicht akzeptiert
    multi_shots
  3. Wenn model = wan-2.6-text-to-video
    Erforderlich
    Nicht akzeptiert
    seed
  4. Wenn model = wan-2.7-r2v
    Erforderlich
    Nicht akzeptiert
    multi_shots
  5. Wenn model = wan-2.7-text-to-video
    Erforderlich
    Nicht akzeptiert
    multi_shots
04

Annahme erstellen

HTTP 202

POST /api/v1/wan/text_to_video

Antwort-Schema
JSON
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
05

Abfrage wird verarbeitet

HTTP 200

GET /api/v1/wan/text_to_video/:id

Antwort-Schema
JSON
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
06

Abfrage abgeschlossen

HTTP 200

GET /api/v1/wan/text_to_video/:id

Antwort-Schema
JSON
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "usage": {
    "cost": 0.05
  },
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
07

Abfrage fehlgeschlagen

HTTP 200

GET /api/v1/wan/text_to_video/:id

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
08

Kunden-Callback: abgeschlossen

HTTP 200

POST callback_url

Antwort-Schema
JSON
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "usage": {
    "cost": 0.05
  },
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
09

Kunden-Callback: fehlgeschlagen

HTTP 200

POST callback_url

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
10

Fehler

HTTP 401

POST /api/v1/wan/text_to_video

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Authentication required"
}
11

Fehler

HTTP 401

GET /api/v1/wan/text_to_video/:id

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Authentication required"
}
12

Fehler

HTTP 400

POST /api/v1/wan/text_to_video

Antwort-Schema
JSON
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Für Menschen lesbare Fehlermeldung.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Menschenlesbare Validierungszusammenfassung.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Validierungsmeldungen nach öffentlichem Anforderungsfeld gegliedert, mit einem Array menschenlesbarer Zeichenketten für jedes Feld.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}

Antwortbeispiel

JSON
{
  "error": "model must be one of: wan-2.2-a14b-text-to-video-turbo, wan-2.5-text-to-video, wan-2.6-text-to-video, wan-2.7-r2v, wan-2.7-text-to-video"
}
13

Fehler

HTTP 402

POST /api/v1/wan/text_to_video

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Insufficient balance"
}
14

Fehler

HTTP 429

POST /api/v1/wan/text_to_video

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "API key credit limit exceeded"
}
15

Fehler

HTTP 409

POST /api/v1/wan/text_to_video

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "The request uses features that are not supported for the selected model"
}
16

Fehler

HTTP 429

POST /api/v1/wan/text_to_video

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Rate limit reached. Please retry later."
}
17

Fehler

HTTP 503

POST /api/v1/wan/text_to_video

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Service under maintenance, please try again later"
}
18

Fehler

HTTP 504

POST /api/v1/wan/text_to_video

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "The request timed out"
}
19

Fehler

HTTP 404

GET /api/v1/wan/text_to_video/:id

Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
20

Generierte Code-Beispiele

Verwende cURL direkt oder installiere ein SDK für deine Programmiersprache. Jedes Beispiel übermittelt die in dieser Referenz gezeigte validierte Anfrage.

Installieren

Shell
pip install runapi-wan
PYTHON
import os
from runapi.wan import WanClient

client = WanClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_video.create(
  model="wan-2.2-a14b-text-to-video-turbo",
  prompt="A paper kite flying above a quiet coastal town at sunrise."
)