任务:执行动作
概览
- 接口:
POST /mj/submit/action - 说明:触发与图像相关的各种按钮动作(例如放大 UPSCALE、生成变体 VARIATION、重滚 REROLL、缩放 ZOOM 等)。
- 内容类型:
application/json
认证
- 使用 HTTP Bearer Token,示例:
Authorization: Bearer sk-xxxxx
请求参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| taskId | string | 是 | 原始绘画任务 ID,表示要对哪个任务执行动作 |
| customId | string | 是 | 动作标识。平台可能使用复合 customId 表示具体操作与参数,例如 MJ::JOB::upsample::2::... |
| notifyHook | string | 否 | 回调地址;为空时使用全局 notifyHook |
| state | string | 否 | 自定义透传参数,用于回调或任务追踪 |
建议字段顺序:taskId, customId, notifyHook, state。
请求示例
json
{
"customId": "MJ::JOB::upsample::2::3dbbd469-36af-4a0f-8f02-df6c579e7011",
"taskId": "1725017986212425",
"notifyHook": "",
"state": "exec-001"
}curl
bash
curl -X POST "https://api.gpt.ge/mj/submit/action" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxx" \
-d '{"customId":"MJ::JOB::upsample::2::3dbbd469-36af-4a0f-8f02-df6c579e7011","taskId":"1725017986212425","notifyHook":"","state":"exec-001"}'JavaScript (fetch)
javascript
fetch('https://api.gpt.ge/mj/submit/action', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer sk-xxxx' },
body: JSON.stringify({ customId: 'MJ::JOB::upsample::2::3dbbd469-36af-4a0f-8f02-df6c579e7011', taskId: '1725017986212425', notifyHook: '', state: 'exec-001' })
}).then(r => r.json()).then(console.log)Python (requests)
python
import requests
payload = {
'customId': 'MJ::JOB::upsample::2::3dbbd469-36af-4a0f-8f02-df6c579e7011',
'taskId': '1725017986212425',
'notifyHook': '',
'state': 'exec-001'
}
resp = requests.post('https://api.gpt.ge/mj/submit/action', headers={'Content-Type':'application/json','Authorization':'Bearer sk-xxxx'}, json=payload)
print(resp.json())返回示例(200)
json
{
"code": 1,
"description": "Submit success",
"result": "1725017986212425",
"properties": {
"discordChannelId": "1278917486263402612",
"discordInstanceId": "1550466896007176192"
}
}