curl --request POST \
--url https://api.tikway.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "V8.2",
"prompt": "a cute cat",
"parameters": {
"stylize": 1000,
"chaos": 100,
"weird": 1000,
"seed": 1231231,
"sw": 1000,
"iw": 1,
"no": "black cat",
"aspect": "9:16",
"raw": true,
"tile": true
},
"images": [
{
"type": "style_reference",
"image_url": "https://example.com/style.png"
},
{
"type": "image_reference",
"image_url": "https://example.com/reference.png"
}
],
"mode": "fast"
}
'import requests
url = "https://api.tikway.ai/v1/images/generations"
payload = {
"model": "V8.2",
"prompt": "a cute cat",
"parameters": {
"stylize": 1000,
"chaos": 100,
"weird": 1000,
"seed": 1231231,
"sw": 1000,
"iw": 1,
"no": "black cat",
"aspect": "9:16",
"raw": True,
"tile": True
},
"images": [
{
"type": "style_reference",
"image_url": "https://example.com/style.png"
},
{
"type": "image_reference",
"image_url": "https://example.com/reference.png"
}
],
"mode": "fast"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'V8.2',
prompt: 'a cute cat',
parameters: {
stylize: 1000,
chaos: 100,
weird: 1000,
seed: 1231231,
sw: 1000,
iw: 1,
no: 'black cat',
aspect: '9:16',
raw: true,
tile: true
},
images: [
{type: 'style_reference', image_url: 'https://example.com/style.png'},
{type: 'image_reference', image_url: 'https://example.com/reference.png'}
],
mode: 'fast'
})
};
fetch('https://api.tikway.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tikway.ai/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'V8.2',
'prompt' => 'a cute cat',
'parameters' => [
'stylize' => 1000,
'chaos' => 100,
'weird' => 1000,
'seed' => 1231231,
'sw' => 1000,
'iw' => 1,
'no' => 'black cat',
'aspect' => '9:16',
'raw' => true,
'tile' => true
],
'images' => [
[
'type' => 'style_reference',
'image_url' => 'https://example.com/style.png'
],
[
'type' => 'image_reference',
'image_url' => 'https://example.com/reference.png'
]
],
'mode' => 'fast'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tikway.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"V8.2\",\n \"prompt\": \"a cute cat\",\n \"parameters\": {\n \"stylize\": 1000,\n \"chaos\": 100,\n \"weird\": 1000,\n \"seed\": 1231231,\n \"sw\": 1000,\n \"iw\": 1,\n \"no\": \"black cat\",\n \"aspect\": \"9:16\",\n \"raw\": true,\n \"tile\": true\n },\n \"images\": [\n {\n \"type\": \"style_reference\",\n \"image_url\": \"https://example.com/style.png\"\n },\n {\n \"type\": \"image_reference\",\n \"image_url\": \"https://example.com/reference.png\"\n }\n ],\n \"mode\": \"fast\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tikway.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"V8.2\",\n \"prompt\": \"a cute cat\",\n \"parameters\": {\n \"stylize\": 1000,\n \"chaos\": 100,\n \"weird\": 1000,\n \"seed\": 1231231,\n \"sw\": 1000,\n \"iw\": 1,\n \"no\": \"black cat\",\n \"aspect\": \"9:16\",\n \"raw\": true,\n \"tile\": true\n },\n \"images\": [\n {\n \"type\": \"style_reference\",\n \"image_url\": \"https://example.com/style.png\"\n },\n {\n \"type\": \"image_reference\",\n \"image_url\": \"https://example.com/reference.png\"\n }\n ],\n \"mode\": \"fast\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/v1/images/generations")
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 = "{\n \"model\": \"V8.2\",\n \"prompt\": \"a cute cat\",\n \"parameters\": {\n \"stylize\": 1000,\n \"chaos\": 100,\n \"weird\": 1000,\n \"seed\": 1231231,\n \"sw\": 1000,\n \"iw\": 1,\n \"no\": \"black cat\",\n \"aspect\": \"9:16\",\n \"raw\": true,\n \"tile\": true\n },\n \"images\": [\n {\n \"type\": \"style_reference\",\n \"image_url\": \"https://example.com/style.png\"\n },\n {\n \"type\": \"image_reference\",\n \"image_url\": \"https://example.com/reference.png\"\n }\n ],\n \"mode\": \"fast\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "image.generation",
"model": "<string>",
"status": "pending",
"polling_url": "<string>",
"data": {
"prompt": "<string>",
"effective_prompt": "<string>",
"mode": "fast",
"parameters": {},
"progress": 50,
"actions": [
"<string>"
],
"native_url": {
"url": "<string>",
"split_image_urls": [
"<string>"
]
},
"image_url": {
"url": "<string>",
"split_image_urls": [
"<string>"
]
}
},
"error": {
"code": "<string>",
"message": "<string>"
},
"parent_task_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>"
}
}提交Action
model 可用模型库 ID 或已支持的别名;模型与 prompt 中的版本参数必须一致。此操作只描述首次生图,不包含同路径的任务动作。
curl --request POST \
--url https://api.tikway.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "V8.2",
"prompt": "a cute cat",
"parameters": {
"stylize": 1000,
"chaos": 100,
"weird": 1000,
"seed": 1231231,
"sw": 1000,
"iw": 1,
"no": "black cat",
"aspect": "9:16",
"raw": true,
"tile": true
},
"images": [
{
"type": "style_reference",
"image_url": "https://example.com/style.png"
},
{
"type": "image_reference",
"image_url": "https://example.com/reference.png"
}
],
"mode": "fast"
}
'import requests
url = "https://api.tikway.ai/v1/images/generations"
payload = {
"model": "V8.2",
"prompt": "a cute cat",
"parameters": {
"stylize": 1000,
"chaos": 100,
"weird": 1000,
"seed": 1231231,
"sw": 1000,
"iw": 1,
"no": "black cat",
"aspect": "9:16",
"raw": True,
"tile": True
},
"images": [
{
"type": "style_reference",
"image_url": "https://example.com/style.png"
},
{
"type": "image_reference",
"image_url": "https://example.com/reference.png"
}
],
"mode": "fast"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'V8.2',
prompt: 'a cute cat',
parameters: {
stylize: 1000,
chaos: 100,
weird: 1000,
seed: 1231231,
sw: 1000,
iw: 1,
no: 'black cat',
aspect: '9:16',
raw: true,
tile: true
},
images: [
{type: 'style_reference', image_url: 'https://example.com/style.png'},
{type: 'image_reference', image_url: 'https://example.com/reference.png'}
],
mode: 'fast'
})
};
fetch('https://api.tikway.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tikway.ai/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'V8.2',
'prompt' => 'a cute cat',
'parameters' => [
'stylize' => 1000,
'chaos' => 100,
'weird' => 1000,
'seed' => 1231231,
'sw' => 1000,
'iw' => 1,
'no' => 'black cat',
'aspect' => '9:16',
'raw' => true,
'tile' => true
],
'images' => [
[
'type' => 'style_reference',
'image_url' => 'https://example.com/style.png'
],
[
'type' => 'image_reference',
'image_url' => 'https://example.com/reference.png'
]
],
'mode' => 'fast'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tikway.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"V8.2\",\n \"prompt\": \"a cute cat\",\n \"parameters\": {\n \"stylize\": 1000,\n \"chaos\": 100,\n \"weird\": 1000,\n \"seed\": 1231231,\n \"sw\": 1000,\n \"iw\": 1,\n \"no\": \"black cat\",\n \"aspect\": \"9:16\",\n \"raw\": true,\n \"tile\": true\n },\n \"images\": [\n {\n \"type\": \"style_reference\",\n \"image_url\": \"https://example.com/style.png\"\n },\n {\n \"type\": \"image_reference\",\n \"image_url\": \"https://example.com/reference.png\"\n }\n ],\n \"mode\": \"fast\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tikway.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"V8.2\",\n \"prompt\": \"a cute cat\",\n \"parameters\": {\n \"stylize\": 1000,\n \"chaos\": 100,\n \"weird\": 1000,\n \"seed\": 1231231,\n \"sw\": 1000,\n \"iw\": 1,\n \"no\": \"black cat\",\n \"aspect\": \"9:16\",\n \"raw\": true,\n \"tile\": true\n },\n \"images\": [\n {\n \"type\": \"style_reference\",\n \"image_url\": \"https://example.com/style.png\"\n },\n {\n \"type\": \"image_reference\",\n \"image_url\": \"https://example.com/reference.png\"\n }\n ],\n \"mode\": \"fast\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/v1/images/generations")
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 = "{\n \"model\": \"V8.2\",\n \"prompt\": \"a cute cat\",\n \"parameters\": {\n \"stylize\": 1000,\n \"chaos\": 100,\n \"weird\": 1000,\n \"seed\": 1231231,\n \"sw\": 1000,\n \"iw\": 1,\n \"no\": \"black cat\",\n \"aspect\": \"9:16\",\n \"raw\": true,\n \"tile\": true\n },\n \"images\": [\n {\n \"type\": \"style_reference\",\n \"image_url\": \"https://example.com/style.png\"\n },\n {\n \"type\": \"image_reference\",\n \"image_url\": \"https://example.com/reference.png\"\n }\n ],\n \"mode\": \"fast\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "image.generation",
"model": "<string>",
"status": "pending",
"polling_url": "<string>",
"data": {
"prompt": "<string>",
"effective_prompt": "<string>",
"mode": "fast",
"parameters": {},
"progress": 50,
"actions": [
"<string>"
],
"native_url": {
"url": "<string>",
"split_image_urls": [
"<string>"
]
},
"image_url": {
"url": "<string>",
"split_image_urls": [
"<string>"
]
}
},
"error": {
"code": "<string>",
"message": "<string>"
},
"parent_task_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>"
}
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求头
上游速度cost、stable、fast
请求体
父任务必须已完成、属于当前 API Key,且 data.actions 包含待执行动作。默认继承父任务的模型、模式、Prompt 和参数;显式 model/mode 必须与父任务一致。未知字段和不支持的模型参数会被过滤。 提交路径为 POST /v1/images/generations,请求头使用 Authorization: Bearer YOUR_API_KEY 和 Content-Type: application/json。Idempotency-Key 是可选请求头,不放入 JSON 请求体。
必填。父任务的 id,使用字符串。父任务须通过同一 API Key 创建且 status=completed。
1"imgtask_parent"
必填。从父任务查询结果 data.actions 中原样选择,建议使用大写。常见值:U1~U4(选择第 1~4 张)、V1~V4(生成变体)、REROLL(重做)、VARY_SUBTLE/VARY_STRONG(轻微/强烈变体)、VARY_REGION(局部重绘)、PAN_LEFT/PAN_RIGHT/PAN_UP/PAN_DOWN(扩图)、ZOOM_OUT_1_5X/ZOOM_OUT_2X(缩小扩图)、CUSTOM_ZOOM(自定义缩放)、MAKE_SQUARE、UPSCALE_SUBTLE/UPSCALE_CREATIVE、ENHANCE。可用值随父任务及模型变化,不以此示例清单作为固定枚举。图片接口不接受 ANIMATE_、EXTEND_、REMASTER 或 DESCRIBE_* 动作。U1~U4 免费,其他动作按现有 MJ 任务价格结算。
1"U1"
"V1"
"REROLL"
"VARY_REGION"
"CUSTOM_ZOOM"
可省略,继承父任务。显式填写时必须解析为与父任务相同的模型 ID。
1"midjourney/v7"
可省略,继承父任务。显式值必须与父任务一致;Action 不允许切换模式,不支持 turbo。
relax, fast 可省略并继承父任务。仅 V1~V4、REROLL、VARY_SUBTLE、VARY_STRONG、VARY_REGION、CUSTOM_ZOOM 和 PAN_* 接受内容覆盖;U1~U4 等动作请省略。按当前 MJ 上游约束使用英文 Prompt。CUSTOM_ZOOM 也可在这里提供 --zoom 1.5;推荐使用 parameters.zoom。
1"a red apple on a wooden table"
仅支持参数覆盖的动作可用。归一化为 parameters.aspect,与显式 parameters.aspect 冲突时返回 400。
^[1-9][0-9]*:[1-9][0-9]*$"1:1"
"2:3"
仅支持参数覆盖的动作可用。兼容字段,接受 auto 或宽高比;推荐使用 aspect_ratio。不接受 1024x1024 等像素尺寸。
^(auto|[1-9][0-9]*:[1-9][0-9]*)$仅支持参数覆盖的动作可用。实际可用档位由父模型决定;模型不支持的质量字段会被过滤。
auto, low, medium, standard, high, xhigh 仅支持内容覆盖的动作可用。参考图类型、数量和参数依赖按父模型校验;当前模型不支持的参考图会被过滤。
仅 VARY_REGION 可用,且该动作必填。目标图片由父任务确定;蒙版应与该单张原图像素宽高一致。使用不透明的黑白 PNG:白色为要重绘的涂鸦区域,黑色为要保留的未涂鸦区域。
Hide child attributes
Hide child attributes
蒙版的 HTTP(S) URL、完整 data URL(例如 data:image/png;base64,...)或标准纯 Base64 字符串;解码后最大 10 MiB,且必须为可识别的图片。推荐导出为不透明黑底、白色选区的 PNG:涂鸦区域设为纯白,未涂鸦区域设为纯黑,不要依赖透明背景表示选区。画板高亮色仅用于显示选区,不代表生成颜色。
1^(https?://|data:image/|(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$)"https://example.com/mask.png"
可选。本次动作的用户回调地址,请为子任务单独传入,不自动继承父任务的回调地址。终态回调通过 POST 发送与查询接口相同的任务对象。
1^https?://[^\s]+$"https://your-service.example/mj/callback"
是否向 webhook_url 推送过程图,默认 false。仅控制过程图通知,终态通知始终发送;无 webhook_url 时仍可查询任务。
响应
任务已接受,使用 polling_url 查询结果。
11pending, in_progress, completed, failed 1Hide child attributes
Hide child attributes
1fast, relax 0 <= x <= 10011
