Zum Inhalt springen
API-Referenz
API-Referenz

Wan Bild zu Video

Verwenden Sie den Endpunkt „Bild zu Video", um einen asynchronen Task zu erstellen.

01

Übersicht

Verwenden Sie den Endpunkt „Bild 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/image_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-image-to-video-turbo19 Felder
accelerationstring
Optional
aspect_ratiostring
Optional
audioboolean
Optional
background_audio_urlstring
Optional
callback_urlstring
Optional
driving_audio_urlstring
Optional
duration_secondsinteger
Optional
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Erforderlich
last_frame_image_urlstring
Optional
modelstring
Optional
negative_promptstring
Optional
output_resolutionstring
Optional Zulässige Werte: 480p, 720p
promptstring
Optional
ratiostring
Optional
seedinteger
Optional
source_video_urlstring
Optional
watermarkboolean
Optional
wan-2.5-image-to-video19 Felder
accelerationstring
Optional
aspect_ratiostring
Optional
audioboolean
Optional
background_audio_urlstring
Optional
callback_urlstring
Optional
driving_audio_urlstring
Optional
duration_secondsinteger
Erforderlich
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Erforderlich
last_frame_image_urlstring
Optional
modelstring
Optional
negative_promptstring
Optional
output_resolutionstring
Optional Zulässige Werte: 720p, 1080p
promptstring
Optional
ratiostring
Optional
seedinteger
Optional
source_video_urlstring
Optional
watermarkboolean
Optional
wan-2.6-flash-image-to-video19 Felder
accelerationstring
Optional
aspect_ratiostring
Optional
audioboolean
Erforderlich
background_audio_urlstring
Optional
callback_urlstring
Optional
driving_audio_urlstring
Optional
duration_secondsinteger
Optional Zulässige Werte: 5, 10, 15 Standard: 5
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Erforderlich
last_frame_image_urlstring
Optional
modelstring
Optional
multi_shotsboolean
Optional
negative_promptstring
Optional
output_resolutionstring
Optional Zulässige Werte: 720p, 1080p Standard: 1080p
promptstring
Erforderlich
ratiostring
Optional
source_video_urlstring
Optional
watermarkboolean
Optional
wan-2.6-image-to-video19 Felder
accelerationstring
Optional
aspect_ratiostring
Optional
audioboolean
Optional
background_audio_urlstring
Optional
callback_urlstring
Optional
driving_audio_urlstring
Optional
duration_secondsinteger
Optional
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Erforderlich
last_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
promptstring
Erforderlich
ratiostring
Optional
source_video_urlstring
Optional
watermarkboolean
Optional
wan-2.7-image-to-video19 Felder
accelerationstring
Optional
aspect_ratiostring
Optional
audioboolean
Optional
background_audio_urlstring
Optional
callback_urlstring
Optional
driving_audio_urlstring
Optional
duration_secondsinteger
Optional
enable_prompt_expansionboolean
Optional
enable_safety_checkerboolean
Optional
first_frame_image_urlstring
Optional
last_frame_image_urlstring
Optional
modelstring
Optional
negative_promptstring
Optional
output_resolutionstring
Optional Zulässige Werte: 720p, 1080p
promptstring
Erforderlich
ratiostring
Optional
seedinteger
Optional
source_video_urlstring
Optional
watermarkboolean
Optional

Bedingte Regeln

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

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

Annahme erstellen

HTTP 202

POST /api/v1/wan/image_to_video

Antwort-Schema
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
05

Abfrage wird verarbeitet

HTTP 200

GET /api/v1/wan/image_to_video/:id

Antwort-Schema
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
06

Abfrage abgeschlossen

HTTP 200

GET /api/v1/wan/image_to_video/:id

Antwort-Schema
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed",
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
07

Abfrage fehlgeschlagen

HTTP 200

GET /api/v1/wan/image_to_video/:id

Antwort-Schema
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "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"
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "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/image_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/image_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/image_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-image-to-video-turbo, wan-2.5-image-to-video, wan-2.6-flash-image-to-video, wan-2.6-image-to-video, wan-2.7-image-to-video"
}
13

Fehler

HTTP 402

POST /api/v1/wan/image_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/image_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/image_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/image_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/image_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/image_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/image_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.image_to_video.create(
  model="wan-2.2-a14b-image-to-video-turbo",
  first_frame_image_url="https://file.runapi.ai/first-frame.png",
  prompt="Gentle ocean waves move in the background."
)