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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "wan2.7-image-pro",
"prompt": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}
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: "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, { method: "POST", headers, body: JSON.stringify(payload) })
.then(r => r.json()).then(console.log).catch(console.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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている",
}
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")
resp, err := (&http.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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}
""";
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(HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString()).body());
}
}
<?php
$payload = ["model" => "wan2.7-image-pro", "prompt" => "精巧な窓のある花屋、美しい木製ドア、花が飾られている"];
$ch = curl_init("https://api.apimart.ai/v1/images/generations");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => ["Authorization: Bearer <token>", "Content-Type: application/json"]]);
echo curl_exec($ch); curl_close($ch);
?>
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.apimart.ai/v1/images/generations")
payload = {
model: "wan2.7-image-pro",
prompt: "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}
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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
]
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.Net.Http; using System.Text;
var payload = @"{""model"":""wan2.7-image-pro"",""prompt"":""精巧な窓のある花屋、美しい木製ドア、花が飾られている""}";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");
var res = await client.PostAsync("https://api.apimart.ai/v1/images/generations",
new StringContent(payload, Encoding.UTF8, "application/json"));
Console.WriteLine(await res.Content.ReadAsStringAsync());
{
"code": "success",
"data": [{ "task_id": "task_01HX...", "status": "processing" }]
}
{
"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.7-image
wan2.7 画像生成・編集
- Wan2.7 画像シリーズ:テキストから画像、画像編集、インタラクティブ編集、連続生成、複数画像参照をサポート
- 非同期処理モード — タスクを送信し、返却された task_id を使って結果をポーリング
- 1K / 2K / 4K 解像度をサポート;wan2.7-image-pro のテキスト生成は最大 4K
- 課金は成功した生成枚数に基づき、解像度・アスペクト比は料金に影響しない
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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "wan2.7-image-pro",
"prompt": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}
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: "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, { method: "POST", headers, body: JSON.stringify(payload) })
.then(r => r.json()).then(console.log).catch(console.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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている",
}
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")
resp, err := (&http.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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}
""";
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(HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString()).body());
}
}
<?php
$payload = ["model" => "wan2.7-image-pro", "prompt" => "精巧な窓のある花屋、美しい木製ドア、花が飾られている"];
$ch = curl_init("https://api.apimart.ai/v1/images/generations");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => ["Authorization: Bearer <token>", "Content-Type: application/json"]]);
echo curl_exec($ch); curl_close($ch);
?>
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.apimart.ai/v1/images/generations")
payload = {
model: "wan2.7-image-pro",
prompt: "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}
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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
]
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.Net.Http; using System.Text;
var payload = @"{""model"":""wan2.7-image-pro"",""prompt"":""精巧な窓のある花屋、美しい木製ドア、花が飾られている""}";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");
var res = await client.PostAsync("https://api.apimart.ai/v1/images/generations",
new StringContent(payload, Encoding.UTF8, "application/json"));
Console.WriteLine(await res.Content.ReadAsStringAsync());
{
"code": "success",
"data": [{ "task_id": "task_01HX...", "status": "processing" }]
}
{
"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/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.7-image-pro",
"prompt": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "wan2.7-image-pro",
"prompt": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}
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: "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, { method: "POST", headers, body: JSON.stringify(payload) })
.then(r => r.json()).then(console.log).catch(console.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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている",
}
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")
resp, err := (&http.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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}
""";
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(HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString()).body());
}
}
<?php
$payload = ["model" => "wan2.7-image-pro", "prompt" => "精巧な窓のある花屋、美しい木製ドア、花が飾られている"];
$ch = curl_init("https://api.apimart.ai/v1/images/generations");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => ["Authorization: Bearer <token>", "Content-Type: application/json"]]);
echo curl_exec($ch); curl_close($ch);
?>
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.apimart.ai/v1/images/generations")
payload = {
model: "wan2.7-image-pro",
prompt: "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
}
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": "精巧な窓のある花屋、美しい木製ドア、花が飾られている"
]
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.Net.Http; using System.Text;
var payload = @"{""model"":""wan2.7-image-pro"",""prompt"":""精巧な窓のある花屋、美しい木製ドア、花が飾られている""}";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");
var res = await client.PostAsync("https://api.apimart.ai/v1/images/generations",
new StringContent(payload, Encoding.UTF8, "application/json"));
Console.WriteLine(await res.Content.ReadAsStringAsync());
{
"code": "success",
"data": [{ "task_id": "task_01HX...", "status": "processing" }]
}
{
"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" }
}
認証
すべてのリクエストには Bearer Token 認証が必要です。API Key 管理ページ から API Key を取得し、リクエストヘッダーに追加してください:
Authorization: Bearer YOUR_API_KEY
利用可能なモデル
| モデル名 | 説明 | テキスト生成最大解像度 | 編集 / 連続生成最大解像度 | 単価 |
|---|---|---|---|---|
wan2.7-image-pro | プロフェッショナル版、精細度が高く 4K 対応 | 4K | 2K | ¥0.50 / 枚 |
wan2.7-image | スタンダード版、高速生成 | 2K | 2K | ¥0.20 / 枚 |
課金は成功した生成枚数 × 単価で計算されます。入力は課金対象外。解像度とアスペクト比は料金に影響しません。失敗したリクエストは課金されません。
Body
画像生成モデル名
wan2.7-image-pro— プロフェッショナル版、テキスト生成で最大 4Kwan2.7-image— スタンダード版、高速、最大 2K
生成する画像のテキスト説明。最大 5000 文字。
- テキスト生成モード(
image_urlsなし):必須 - 画像編集モード(
image_urlsあり):任意(推奨)
"精巧な窓のある花屋、美しい木製ドア、花が飾られている"入力画像の URL 配列。画像編集・複数画像参照などのシナリオで使用します。指定すると画像編集モードに自動的に切り替わります。対応形式: HTTP / HTTPS 画像リンク;
data:image/...;base64,... Base64 形式制約: 最大 9 枚;JPEG / PNG / WEBP / BMP;240–8000 px;アスペクト比 1:8 ~ 8:1;1 枚あたり ≤ 20MB出力のアスペクト比は最後の入力画像に自動的に合わせられます。編集モードは最大 2K です(4K 非対応)。
生成する画像の枚数
- 標準モード:1–4(デフォルト 1)
- 連続生成モード(
enable_sequential: true):1–12(デフォルト 1)
成功した生成枚数ごとに課金されます。
n に基づいて事前課金されます。出力解像度またはアスペクト比。3つの形式をサポートしています:① 解像度キーワード(推奨):
1K / 2K(デフォルト)/ 4K(wan2.7-image-pro テキスト生成のみ)② アスペクト比: 1:1 / 16:9 / 9:16 / 4:3 / 3:4 / 3:2 / 2:3(デフォルトでは 2K ティアに換算)③ ピクセル値: 1024x1024 または 1024*1024解像度キーワード:
1K / 2K / 4K。size(アスペクト比)と組み合わせて使用できます。| モデル | シナリオ | サポートキーワード | ピクセル範囲 |
|---|---|---|---|
wan2.7-image-pro | テキスト生成(非連続) | 1K / 2K / 4K | 768×768 〜 4096×4096 |
wan2.7-image-pro | 編集 / 連続生成 | 1K / 2K | 768×768 〜 2048×2048 |
wan2.7-image | すべてのシナリオ | 1K / 2K | 768×768 〜 2048×2048 |
ネガティブプロンプト。例:
"ぼやけた、歪んだ、低品質"右下角に「AI 生成」ウォーターマークを追加するかどうか
ランダムシード(0–2147483647)。同じパラメータと同じシードを使用すると、視覚的に一貫した結果を生成できます。
強化推論モード。画像品質が向上しますが生成時間が長くなります。
連続生成モード無効かつ画像入力なしの場合のみ有効です。
連続画像生成モードを有効にします。絵コンテ、漫画、シリーズに最適。
- 有効時の
n上限は 12 - 連続生成モードでは
thinking_modeとcolor_paletteは無効 wan2.7-image-proの連続生成は最大 2K(4K 非対応)
インタラクティブ編集用のバウンディングボックス。編集またはコンテンツ挿入する正確な領域を指定します。構造:
[[[x1, y1, x2, y2], ...], ...]- 外側の配列長は
image_urlsの長さと一致する必要があります - ボックス不要な画像には
[]を渡します - 1枚の画像につき最大2ボックス。座標は元画像の絶対ピクセル値で、左上を (0,0) とします
[[], [[989, 515, 1138, 681]]]カスタムカラーテーマ。標準モードのみ(連続生成モードでは使用不可)。
- 3–10 項目(8項目推奨)。各項目には
hexとratioが必要です - すべての
ratio値の合計は正確に100.00%である必要があります
[{ "hex": "#C2D1E6", "ratio": "23.51%" }, { "hex": "#636574", "ratio": "76.49%" }]
レスポンス
レスポンスステータス。成功時は
"success" を返します。利用例
テキストから画像(最小)
{ "model": "wan2.7-image-pro", "prompt": "精巧な窓のある花屋、美しい木製ドア、花が飾られている" }
テキストから画像(解像度指定)
{ "model": "wan2.7-image-pro", "prompt": "夏のビーチ、青空と白い雲、4K 超高精細", "size": "4K", "thinking_mode": true }
カスタムカラーテーマ
{
"model": "wan2.7-image-pro",
"prompt": "ミニマルなモダンリビング",
"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%" }
]
}
連続画像生成
{
"model": "wan2.7-image-pro",
"prompt": "映画的なシリーズ:同じ野良の茶トラ猫。1枚目:春の桜の木の下。2枚目:夏の古い街路の木陰。3枚目:秋の落ち葉が散る道。4枚目:冬の雪の上の足跡。",
"enable_sequential": true,
"n": 4,
"size": "2K"
}
単一画像編集
{ "model": "wan2.7-image", "prompt": "背景を夕焼けのシーンに変え、全体的に暖色系に", "image_urls": ["https://example.com/portrait.jpg"], "size": "2K" }
複数画像参照 / 要素融合
{
"model": "wan2.7-image-pro",
"prompt": "画像2のグラフィティを画像1の車に描く",
"image_urls": ["https://example.com/car.webp", "https://example.com/paint.webp"],
"size": "2K"
}
インタラクティブ編集(バウンディングボックス)
bbox_list は image_urls と 1 対 1 で対応します。選択範囲がない画像には [] を渡してください。
{
"model": "wan2.7-image-pro",
"prompt": "画像1の目覚まし時計を画像2の指定エリアに置き、シーンと光源に自然に馴染ませる",
"image_urls": ["https://example.com/clock.webp", "https://example.com/desk.webp"],
"bbox_list": [[], [[989, 515, 1138, 681]]],
"size": "2K"
}
結果の照会画像生成は非同期です。返却された
task_id を使用して タスクステータス エンドポイントを status == completed になるまでポーリングしてください。⌘I