Skip to content

任务:绘图变化

概览

  • 接口:POST /mj/submit/change
  • 说明:对已生成的图片执行二次变化,包括放大(UPSCALE)、生成变体(VARIATION)和重滚(REROLL)。
  • 内容类型:application/json

认证

  • 使用 HTTP Bearer Token,示例:Authorization: Bearer sk-xxxxx

请求参数

参数类型必填描述
taskIdstring需要变更的绘画任务 ID
actionstring操作类型:UPSCALEVARIATIONREROLL
indexinteger当选择具体子图时,指定从 1 到 4 的索引
notifyHookstring回调地址;为空时使用全局 notifyHook
statestring自定义参数,透传回调或用于任务标识

建议字段顺序:taskId, action, index, notifyHook, state


请求示例

json
{
  "action": "UPSCALE",
  "index": 1,
  "taskId": "1725017986212425",
  "notifyHook": "",
  "state": "change-001"
}

curl

bash
curl -X POST "https://api.gpt.ge/mj/submit/change" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxxx" \
  -d '{"action":"UPSCALE","index":1,"taskId":"1725017986212425","notifyHook":"","state":"change-001"}'

JavaScript (fetch)

javascript
fetch('https://api.gpt.ge/mj/submit/change', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer sk-xxxx' },
  body: JSON.stringify({ action: 'UPSCALE', index: 1, taskId: '1725017986212425', notifyHook: '', state: 'change-001' })
}).then(r => r.json()).then(console.log)

Python (requests)

python
import requests

payload = {
  'action': 'UPSCALE',
  'index': 1,
  'taskId': '1725017986212425',
  'notifyHook': '',
  'state': 'change-001'
}

resp = requests.post('https://api.gpt.ge/mj/submit/change', 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"
  }
}