curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}
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/videos/generations";
const payload = {
model: "wan2.6",
prompt: "草原を走るかわいい猫",
aspect_ratio: "16:9",
resolution: "720p",
duration: 5
};
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/videos/generations"
payload := map[string]interface{}{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5,
}
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 url = "https://api.apimart.ai/v1/videos/generations";
String payload = """
{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$url = "https://api.apimart.ai/v1/videos/generations";
$payload = [
"model" => "wan2.6",
"prompt" => "草原を走るかわいい猫",
"aspect_ratio" => "16:9",
"resolution" => "720p",
"duration" => 5
];
$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/videos/generations")
payload = {
model: "wan2.6",
prompt: "草原を走るかわいい猫",
aspect_ratio: "16:9",
resolution: "720p",
duration: 5
}
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/videos/generations")!
let payload: [String: Any] = [
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
]
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 responseString = String(data: data, encoding: .utf8) {
print(responseString)
}
}
task.resume()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var url = "https://api.apimart.ai/v1/videos/generations";
var payload = @"{
""model"": ""wan2.6"",
""prompt"": ""草原を走るかわいい猫"",
""aspect_ratio"": ""16:9"",
""resolution"": ""720p"",
""duration"": 5
}";
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(url, content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
}
]
}
{
"error": {
"code": 400,
"message": "リクエストパラメータが無効です",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "認証に失敗しました。APIキーを確認してください",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "残高が不足しています。チャージしてください",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "リクエストが多すぎます。しばらくしてからお試しください",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "サーバー内部エラー。しばらくしてからお試しください",
"type": "server_error"
}
}
Wan2.6
Wan2.6 動画生成
- Alibaba Cloud 万相動画生成モデル
- テキストから動画 (Text-to-Video) と画像から動画 (Image-to-Video) をサポート
- 720p/1080p 解像度、5/10/15 秒の動画時間をサポート
- プロンプト自動拡張とオーディオ生成をサポート
POST
/
v1
/
videos
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}
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/videos/generations";
const payload = {
model: "wan2.6",
prompt: "草原を走るかわいい猫",
aspect_ratio: "16:9",
resolution: "720p",
duration: 5
};
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/videos/generations"
payload := map[string]interface{}{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5,
}
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 url = "https://api.apimart.ai/v1/videos/generations";
String payload = """
{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$url = "https://api.apimart.ai/v1/videos/generations";
$payload = [
"model" => "wan2.6",
"prompt" => "草原を走るかわいい猫",
"aspect_ratio" => "16:9",
"resolution" => "720p",
"duration" => 5
];
$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/videos/generations")
payload = {
model: "wan2.6",
prompt: "草原を走るかわいい猫",
aspect_ratio: "16:9",
resolution: "720p",
duration: 5
}
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/videos/generations")!
let payload: [String: Any] = [
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
]
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 responseString = String(data: data, encoding: .utf8) {
print(responseString)
}
}
task.resume()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var url = "https://api.apimart.ai/v1/videos/generations";
var payload = @"{
""model"": ""wan2.6"",
""prompt"": ""草原を走るかわいい猫"",
""aspect_ratio"": ""16:9"",
""resolution"": ""720p"",
""duration"": 5
}";
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(url, content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
}
]
}
{
"error": {
"code": 400,
"message": "リクエストパラメータが無効です",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "認証に失敗しました。APIキーを確認してください",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "残高が不足しています。チャージしてください",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "リクエストが多すぎます。しばらくしてからお試しください",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "サーバー内部エラー。しばらくしてからお試しください",
"type": "server_error"
}
}
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}
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/videos/generations";
const payload = {
model: "wan2.6",
prompt: "草原を走るかわいい猫",
aspect_ratio: "16:9",
resolution: "720p",
duration: 5
};
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/videos/generations"
payload := map[string]interface{}{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5,
}
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 url = "https://api.apimart.ai/v1/videos/generations";
String payload = """
{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$url = "https://api.apimart.ai/v1/videos/generations";
$payload = [
"model" => "wan2.6",
"prompt" => "草原を走るかわいい猫",
"aspect_ratio" => "16:9",
"resolution" => "720p",
"duration" => 5
];
$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/videos/generations")
payload = {
model: "wan2.6",
prompt: "草原を走るかわいい猫",
aspect_ratio: "16:9",
resolution: "720p",
duration: 5
}
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/videos/generations")!
let payload: [String: Any] = [
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
]
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 responseString = String(data: data, encoding: .utf8) {
print(responseString)
}
}
task.resume()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var url = "https://api.apimart.ai/v1/videos/generations";
var payload = @"{
""model"": ""wan2.6"",
""prompt"": ""草原を走るかわいい猫"",
""aspect_ratio"": ""16:9"",
""resolution"": ""720p"",
""duration"": 5
}";
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(url, content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
}
]
}
{
"error": {
"code": 400,
"message": "リクエストパラメータが無効です",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "認証に失敗しました。APIキーを確認してください",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "残高が不足しています。チャージしてください",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "リクエストが多すぎます。しばらくしてからお試しください",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "サーバー内部エラー。しばらくしてからお試しください",
"type": "server_error"
}
}
認証
すべてのAPIエンドポイントでBearer Token認証が必要ですAPIキーの取得:APIキー管理ページからAPIキーを取得してくださいリクエストヘッダーに追加:
Authorization: Bearer YOUR_API_KEY
リクエストパラメータ
動画生成モデル名、
wan2.6 に固定動画の内容説明テキストから動画モードでは必須。シーン、アクション、スタイルを詳細に記述してください例:
"日差しの中で伸びをするかわいい猫"参照画像URL配列(1枚のみサポート)画像から動画モードでは必須。公開アクセス可能な画像URLをサポート例:
["https://example.com/image.jpg"]システムは
image_urls の有無に基づいてテキストから動画または画像から動画モードを自動選択しますネガティブプロンプト、望まない内容を記述例:
"ぼやけ, 低品質, 歪み"動画のアスペクト比オプション:
16:9- 横向き(デフォルト)9:16- 縦向き1:1- 正方形4:3- 横向き3:4- 縦向き
16:9画像から動画モードではこのパラメータはサポートされていません
動画解像度オプション:
720p- 標準(デフォルト)1080p- 高解像度
720p480p解像度はサポートされていません
秒単位で課金されます。解像度によって料金が異なります。具体的な料金はモデルマーケットプレイスをご参照ください
動画時間(秒)サポート値:
5、10、15 秒のみデフォルト:5再現可能な結果のためのランダムシード例:
12345プロンプトを自動拡張するかどうか有効にすると、システムがプロンプトを自動的に最適化・充実させます
オーディオを自動追加するかどうか有効にすると、システムが動画に合ったオーディオを生成します
指定オーディオURL
audio パラメータより優先されますオーディオの長さは動画の長さを超えることはできません。オーディオが動画より短い場合、動画の前半には音声がありますが、後半は無音になります。
ショットタイプオプション:
single- シングルショットmulti- マルチショット
ウォーターマークを追加するかどうか
画像から動画への特殊効果モード用のエフェクトテンプレート名汎用エフェクト:
エフェクトモード使用時:
- 画像は1枚のみ必要(
image_urlsで渡す) - プロンプトは不要(モデルは
promptフィールドを無視します)
squish- スクイッシュrotation- 回転poke- つんつんinflate- 風船膨張dissolve- 分子拡散melt- 熱波融解icecream- アイスクリーム惑星flying- マジック浮遊
carousel- タイムカルーセルsingleheart- ラブユーdance1- スウィングモーメントdance2- ダンスムーブ
解像度とアスペクト比の組み合わせ
| アスペクト比 | 説明 | 720p サイズ | 1080p サイズ |
|---|---|---|---|
16:9 | 横向き(デフォルト) | 1280×720 | 1920×1080 |
9:16 | 縦向き | 720×1280 | 1080×1920 |
1:1 | 正方形 | 960×960 | 1440×1440 |
4:3 | 横向き | 1088×832 | 1632×1248 |
3:4 | 縦向き | 832×1088 | 1248×1632 |
レスポンス
レスポンスステータスコード、成功時は200
使用シナリオ
シナリオ 1:テキストから動画(シンプルリクエスト)
{
"model": "wan2.6",
"prompt": "日差しの中で伸びをするかわいい猫"
}
シナリオ 2:テキストから動画(全パラメータ)
{
"model": "wan2.6",
"prompt": "草原を走るかわいい猫",
"negative_prompt": "ぼやけ, 低品質, 歪み",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5,
"seed": 12345,
"prompt_extend": true,
"audio": true,
"shot_type": "single",
"watermark": false
}
シナリオ 3:画像から動画
{
"model": "wan2.6",
"prompt": "子猫が地面を走る",
"image_urls": ["https://upload.apimart.ai/f/apimart-models-images/9998233432754770-c059992d-9b01-47d5-810d-ea0502ac9279-image_task_01KD7SSXDBCEWZ869D6PF249ZW_0.png"],
"resolution": "1080p",
"duration": 10
}
シナリオ 4:画像から動画(Base64画像)
{
"model": "wan2.6",
"prompt": "猫を立ち上がらせて歩かせる",
"image_urls": ["data:image/png;base64,iVBORw0KGgo..."],
"duration": 5
}
モード説明
テキストから動画 (Text-to-Video)
promptパラメータが必須image_urlsパラメータは不要
画像から動画 (Image-to-Video)
image_urlsパラメータが必須(1枚のみサポート)promptパラメータはオプション、期待するアクションを記述
システムはリクエストに
image_urls が含まれているかどうかに基づいてモードを自動選択しますタスク結果のクエリ動画生成は非同期タスクで、送信時に
task_id を返します。タスクステータス取得 エンドポイントを使用して生成の進行状況と結果をクエリしてください。⌘I