メインコンテンツへスキップ
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-i2v-flash",
    "prompt": "人物が振り向いて微笑む",
    "image_urls": ["https://example.com/portrait.jpg"],
    "resolution": "1080p",
    "duration": 5
  }'
import requests

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

payload = {
    "model": "wan2.6-i2v-flash",
    "prompt": "人物が振り向いて微笑む",
    "image_urls": ["https://example.com/portrait.jpg"],
    "resolution": "1080p",
    "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-i2v-flash",
  prompt: "人物が振り向いて微笑む",
  image_urls: ["https://example.com/portrait.jpg"],
  resolution: "1080p",
  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-i2v-flash",
        "prompt":     "人物が振り向いて微笑む",
        "image_urls": []string{"https://example.com/portrait.jpg"},
        "resolution": "1080p",
        "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-i2v-flash",
          "prompt": "人物が振り向いて微笑む",
          "image_urls": ["https://example.com/portrait.jpg"],
          "resolution": "1080p",
          "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-i2v-flash",
    "prompt" => "人物が振り向いて微笑む",
    "image_urls" => ["https://example.com/portrait.jpg"],
    "resolution" => "1080p",
    "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-i2v-flash",
  prompt: "人物が振り向いて微笑む",
  image_urls: ["https://example.com/portrait.jpg"],
  resolution: "1080p",
  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-i2v-flash",
    "prompt": "人物が振り向いて微笑む",
    "image_urls": ["https://example.com/portrait.jpg"],
    "resolution": "1080p",
    "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-i2v-flash"",
            ""prompt"": ""人物が振り向いて微笑む"",
            ""image_urls"": [""https://example.com/portrait.jpg""],
            ""resolution"": ""1080p"",
            ""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-i2v-flash",
    "prompt": "人物が振り向いて微笑む",
    "image_urls": ["https://example.com/portrait.jpg"],
    "resolution": "1080p",
    "duration": 5
  }'
import requests

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

payload = {
    "model": "wan2.6-i2v-flash",
    "prompt": "人物が振り向いて微笑む",
    "image_urls": ["https://example.com/portrait.jpg"],
    "resolution": "1080p",
    "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-i2v-flash",
  prompt: "人物が振り向いて微笑む",
  image_urls: ["https://example.com/portrait.jpg"],
  resolution: "1080p",
  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-i2v-flash",
        "prompt":     "人物が振り向いて微笑む",
        "image_urls": []string{"https://example.com/portrait.jpg"},
        "resolution": "1080p",
        "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-i2v-flash",
          "prompt": "人物が振り向いて微笑む",
          "image_urls": ["https://example.com/portrait.jpg"],
          "resolution": "1080p",
          "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-i2v-flash",
    "prompt" => "人物が振り向いて微笑む",
    "image_urls" => ["https://example.com/portrait.jpg"],
    "resolution" => "1080p",
    "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-i2v-flash",
  prompt: "人物が振り向いて微笑む",
  image_urls: ["https://example.com/portrait.jpg"],
  resolution: "1080p",
  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-i2v-flash",
    "prompt": "人物が振り向いて微笑む",
    "image_urls": ["https://example.com/portrait.jpg"],
    "resolution": "1080p",
    "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-i2v-flash"",
            ""prompt"": ""人物が振り向いて微笑む"",
            ""image_urls"": [""https://example.com/portrait.jpg""],
            ""resolution"": ""1080p"",
            ""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"
  }
}

認証

Authorization
string
必須
すべてのエンドポイントで Bearer Token 認証が必要ですAPI Key の取得:API Key 管理ページ で API Key を取得してくださいリクエストヘッダーに追加:
Authorization: Bearer YOUR_API_KEY

リクエストパラメータ

model
string
必須
動画生成モデル名、wan2.6-i2v-flash 固定
image_urls
array<string>
必須
参照画像 URL 配列(最初のフレーム画像 1 枚のみサポート)公開アクセス可能な画像 URL または Base64 エンコード(data:image/png;base64,...)をサポート例:["https://example.com/image.jpg"]
画像の要件:
  • 形式:JPEG、JPG、PNG(透明チャンネル不可)、BMP、WEBP
  • 解像度:幅/高さ 240-8000 ピクセル
  • サイズ:≤ 10MB
prompt
string
動画の内容説明画像から動画では任意ですが推奨、期待する動作や効果を記述主体、動作、カメラ、スタイルを明確に指定してください例:"画像の人物が微笑んで手を振り、カメラがゆっくりズームイン"
negative_prompt
string
ネガティブプロンプト、表示したくない内容を記述最大 500 文字例:"ぼやけ, 低品質, 変形"
resolution
string
デフォルト:"1080p"
動画解像度オプション:
  • 720p - HD
  • 1080p - FHD(デフォルト)
デフォルト:1080p
解像度は料金に直接影響します。1080p は 720p より高価です。アスペクト比は入力画像により決定されます。
duration
integer
デフォルト:"5"
動画の長さ(秒)サポート範囲:2 ~ 15 秒(整数)デフォルト:5
audio
boolean
デフォルト:"true"
音声付き動画を生成するかどうかtrue:マッチするBGM/効果音を自動生成(デフォルト)false:無音動画を出力デフォルト:true
モデルが wan2.6-i2v の場合、このパラメータはサポートされません。
audio_url
string
カスタム音声 URL(wav/mp3、3-30 秒、≤ 15MB)audio より優先度が低い:audio=false の場合は無視されます音声が動画より長い場合は自動トリミング、短い場合は残りが無音になります
音声ファイルの要件:
  • 形式:wav、mp3
  • 長さ:3-30 秒
  • サイズ:≤ 15MB
prompt_extend
boolean
デフォルト:"true"
プロンプトのスマート書き換えを有効にするかどうか短いプロンプトの効果を大幅に向上させますが、処理時間が増加しますデフォルト:true
shot_type
string
ショットタイプ、prompt_extend=true と併用が必要オプション:
  • single - シングルショット(デフォルト)、連続した 1 ショットの動画を出力
  • multi - マルチショット、複数ショットの切り替えで構成されたナラティブ動画を出力
shot_typeprompt より優先度が高い。プロンプトに「マルチショット」と書いても、single に設定するとシングルショットが出力されます。
seed
integer
ランダムシード(≥0)、同じシードを指定すると類似の結果を再現できます例:12345
watermark
boolean
デフォルト:"false"
「AI生成」ウォーターマークを追加するかどうか(右下)デフォルト:false

音声制御説明

パラメータの組み合わせ結果
audioaudio_url を渡さない自動音声生成(デフォルト)
audio_url: "https://..."指定した音声を使用
audio: false無音動画
audio: false + audio_url: "..."無音動画(audio の優先度が高い)

レスポンス

code
integer
レスポンスステータスコード、成功時は 200
data
array
レスポンスデータ配列

使用シーン

シーン 1:最小リクエスト

{
  "model": "wan2.6-i2v-flash",
  "image_urls": ["https://example.com/image.jpg"]
}

シーン 2:全パラメータ

{
  "model": "wan2.6-i2v-flash",
  "prompt": "画像の人物が微笑んで手を振り、カメラがゆっくりズームイン",
  "image_urls": ["https://example.com/image.jpg"],
  "negative_prompt": "ぼやけ, 低品質, 変形",
  "resolution": "1080p",
  "duration": 10,
  "seed": 12345,
  "prompt_extend": true,
  "shot_type": "multi",
  "audio": true,
  "watermark": false
}

シーン 3:カスタム音声

{
  "model": "wan2.6-i2v-flash",
  "prompt": "人物が音楽に合わせて踊る",
  "image_urls": ["https://example.com/dancer.jpg"],
  "audio_url": "https://example.com/music.mp3",
  "resolution": "1080p",
  "duration": 10
}

シーン 4:無音動画

{
  "model": "wan2.6-i2v-flash",
  "prompt": "花がゆっくり咲く",
  "image_urls": ["https://example.com/flower.jpg"],
  "audio": false,
  "resolution": "720p",
  "duration": 5
}

シーン 5:エフェクトテンプレート

{
  "model": "wan2.6-i2v-flash",
  "image_urls": ["https://example.com/person.jpg"],
  "template": "flying",
  "resolution": "720p"
}

シーン 6:Base64 画像

{
  "model": "wan2.6-i2v-flash",
  "prompt": "猫を立ち上がって歩かせる",
  "image_urls": ["data:image/png;base64,iVBORw0KGgo..."],
  "duration": 5
}
タスク結果の照会動画生成は非同期タスクであり、送信後に task_id が返されます。タスクステータス取得 エンドポイントを使用して生成の進捗と結果を照会してください。