Skip to content

开始

重要约定

  • 提交任务时,必须携带header Authorization: Bearer hk-替换为你的key 或者 Mj-Api-Secret: hk-替换为你的key
  • Midjourney接口地址 https://api.openai-hk.com
  • 以提交Imagine任务为DEMO 点击查看快速接入

任务提交

模式接入点

  • 混合模式(将去除) https://api.openai-hk.com
  • fast模式 https://api.openai-hk.com/fast
  • relax模式 https://api.openai-hk.com/relax
  • 各种模式价格不一致,请 控制台->购买KEY 查看价格

执行动作

接口地址:/mj/submit/action

请求方式:POST

请求数据类型:application/json

响应数据类型:*/*

接口描述:

请求示例:

json
{
  "customId": "MJ::JOB::upsample::2::3dbbd469-36af-4a0f-8f02-df6c579e7011",
  "notifyHook": "",
  "state": "",
  "taskId": "14001934816969359"
}
{
  "customId": "MJ::JOB::upsample::2::3dbbd469-36af-4a0f-8f02-df6c579e7011",
  "notifyHook": "",
  "state": "",
  "taskId": "14001934816969359"
}

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
actionDTOactionDTObodytrue执行动作参数执行动作参数
  customId动作标识truestring
  notifyHook回调地址, 为空时使用全局notifyHookfalsestring
  state自定义参数falsestring
  taskId任务IDtruestring

响应状态:

状态码说明schema
200OK提交结果
201Created
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
code状态码: 1(提交成功), 22(排队中), other(错误)integer(int32)integer(int32)
description描述string
properties扩展字段object
result任务IDstring

响应示例:

json
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}

提交Blend任务

接口地址:/mj/submit/blend

请求方式:POST

请求数据类型:application/json

响应数据类型:*/*

接口描述:

请求示例:

json
{
  "base64Array": [
    "data:image/png;base64,xxx1",
    "data:image/png;base64,xxx2"
  ],
  "dimensions": "SQUARE",
  "instanceId": "",
  "modes": [],
  "notifyHook": "",
  "remix": true,
  "state": ""
}
{
  "base64Array": [
    "data:image/png;base64,xxx1",
    "data:image/png;base64,xxx2"
  ],
  "dimensions": "SQUARE",
  "instanceId": "",
  "modes": [],
  "notifyHook": "",
  "remix": true,
  "state": ""
}

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
blendDTOblendDTObodytrueBlend提交参数Blend提交参数
  base64Array图片base64数组truearraystring
  dimensions比例: PORTRAIT(2:3); SQUARE(1:1); LANDSCAPE(3:2),可用值:PORTRAIT,SQUARE,LANDSCAPEfalsestring
  instanceId账号实例ID,指定账号执行任务falsestring
  modes账号模式,筛选账号执行任务falsearraystring
  notifyHook回调地址, 为空时使用全局notifyHookfalsestring
  remix账号remix,筛选账号执行任务falseboolean
  state自定义参数falsestring

响应状态:

状态码说明schema
200OK提交结果
201Created
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
code状态码: 1(提交成功), 22(排队中), other(错误)integer(int32)integer(int32)
description描述string
properties扩展字段object
result任务IDstring

响应示例:

json
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}

提交图生文任务

接口地址:/mj/submit/describe

请求方式:POST

请求数据类型:application/json

响应数据类型:*/*

接口描述:

请求示例:

json
{
  "base64": "data:image/png;base64,xxx",
  "instanceId": "",
  "modes": [],
  "notifyHook": "",
  "remix": true,
  "state": ""
}
{
  "base64": "data:image/png;base64,xxx",
  "instanceId": "",
  "modes": [],
  "notifyHook": "",
  "remix": true,
  "state": ""
}

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
describeDTOdescribeDTObodytrueDescribe提交参数Describe提交参数
  base64图片base64truestring
  instanceId账号实例ID,指定账号执行任务falsestring
  modes账号模式,筛选账号执行任务falsearraystring
  notifyHook回调地址, 为空时使用全局notifyHookfalsestring
  remix账号remix,筛选账号执行任务falseboolean
  state自定义参数falsestring

响应状态:

状态码说明schema
200OK提交结果
201Created
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
code状态码: 1(提交成功), 22(排队中), other(错误)integer(int32)integer(int32)
description描述string
properties扩展字段object
result任务IDstring

响应示例:

json
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}

提交Imagine任务

接口地址:/mj/submit/imagine

请求方式:POST

请求数据类型:application/json

响应数据类型:*/*

接口描述:

请求示例:

json
{
  "base64Array": [],
  "instanceId": "",
  "modes": [],
  "notifyHook": "",
  "prompt": "Cat",
  "remix": true,
  "state": ""
}
{
  "base64Array": [],
  "instanceId": "",
  "modes": [],
  "notifyHook": "",
  "prompt": "Cat",
  "remix": true,
  "state": ""
}

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
imagineDTOimagineDTObodytrueImagine提交参数Imagine提交参数
  base64Array垫图base64数组falsearraystring
  instanceId账号实例ID,指定账号执行任务falsestring
  modes账号模式,筛选账号执行任务falsearraystring
  notifyHook回调地址, 为空时使用全局notifyHookfalsestring
  prompt提示词truestring
  remix账号remix,筛选账号执行任务falseboolean
  state自定义参数falsestring

响应状态:

状态码说明schema
200OK提交结果
201Created
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
code状态码: 1(提交成功), 22(排队中), other(错误)integer(int32)integer(int32)
description描述string
properties扩展字段object
result任务IDstring

响应示例:

json
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}

提交Modal

接口地址:/mj/submit/modal

请求方式:POST

请求数据类型:application/json

响应数据类型:*/*

接口描述:

请求示例:

json
{
  "maskBase64": "",
  "prompt": "",
  "taskId": "14001934816969359"
}
{
  "maskBase64": "",
  "prompt": "",
  "taskId": "14001934816969359"
}

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
modalDTOmodalDTObodytrueModal提交参数Modal提交参数
  maskBase64局部重绘的蒙版base64falsestring
  prompt提示词falsestring
  taskId任务IDtruestring

响应状态:

状态码说明schema
200OK提交结果
201Created
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
code状态码: 1(提交成功), 22(排队中), other(错误)integer(int32)integer(int32)
description描述string
properties扩展字段object
result任务IDstring

响应示例:

json
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}

提交swap_face变脸任务

接口地址:/mj/insight-face/swap

请求方式:POST

请求数据类型:application/json

响应数据类型:*/*

接口描述:

请求示例:

javascript
{
  "sourceBase64": "data:image/png;base64,xxx1",
  "targetBase64": "data:image/png;base64,xxx2",
  "accountFilter": {
    "instanceId": ""
  },
  "notifyHook": "",
  "state": ""
}
{
  "sourceBase64": "data:image/png;base64,xxx1",
  "targetBase64": "data:image/png;base64,xxx2",
  "accountFilter": {
    "instanceId": ""
  },
  "notifyHook": "",
  "state": ""
}

请求参数:

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
swapFaceDTOswapFaceDTObodytrueSwapFace提交参数SwapFace提交参数
  sourceBase64人脸源图片base64truestring
  targetBase64目标图片base64truestring
  accountFilter筛选账号执行任务,不需要筛选时设置为null或移除该参数falseFilterFilter
    instanceId账号实例IDfalsestring
  notifyHook回调地址, 为空时使用全局notifyHookfalsestring
  state自定义参数falsestring

响应状态:

状态码说明schema
200OKMessage«string»
201Created
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
codeinteger(int32)integer(int32)
descriptionstring
resultstring

响应示例:

javascript
{
	"code": 0,
	"description": "",
	"result": ""
}
{
	"code": 0,
	"description": "",
	"result": ""
}

提交Shorten任务

接口地址:/mj/submit/shorten

请求方式:POST

请求数据类型:application/json

响应数据类型:*/*

接口描述:

请求示例:

json
{
  "instanceId": "",
  "modes": [],
  "notifyHook": "",
  "prompt": "Cat",
  "remix": true,
  "state": ""
}
{
  "instanceId": "",
  "modes": [],
  "notifyHook": "",
  "prompt": "Cat",
  "remix": true,
  "state": ""
}

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
shortenDTOshortenDTObodytrueShorten提交参数Shorten提交参数
  instanceId账号实例ID,指定账号执行任务falsestring
  modes账号模式,筛选账号执行任务falsearraystring
  notifyHook回调地址, 为空时使用全局notifyHookfalsestring
  prompt提示词truestring
  remix账号remix,筛选账号执行任务falseboolean
  state自定义参数falsestring

响应状态:

状态码说明schema
200OK提交结果
201Created
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
code状态码: 1(提交成功), 22(排队中), other(错误)integer(int32)integer(int32)
description描述string
properties扩展字段object
result任务IDstring

响应示例:

json
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}
{
	"code": 1,
	"description": "提交成功",
	"properties": {},
	"result": 1320098173412546
}

任务查询

指定ID获取任务

接口地址:/mj/task/{id}/fetch

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:*/*

接口描述:

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
id任务IDpathfalsestring

响应状态:

状态码说明schema
200OK任务
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
action任务类型,可用值:IMAGINE,UPSCALE,VARIATION,ZOOM,PAN,DESCRIBE,BLEND,SHORTENstring
buttonsarray可执行按钮
  customId动作标识string
  emoji图标string
  label文本string
  style样式: 2(Primary)、3(Green)integer(int32)
  type类型,系统内部使用integer(int32)
description任务描述string
failReason失败原因string
finishTime结束时间integer(int64)integer(int64)
idIDstring
imageUrl图片urlstring
progress任务进度string
prompt提示词string
promptEn提示词-英文string
propertiesobject
startTime开始执行时间integer(int64)integer(int64)
state自定义参数string
status任务状态,可用值:NOT_START,SUBMITTED,MODAL,IN_PROGRESS,FAILURE,SUCCESSstring
submitTime提交时间integer(int64)integer(int64)

响应示例:

json
{
	"action": "",
	"buttons": [
		{
			"customId": "",
			"emoji": "",
			"label": "",
			"style": 0,
			"type": 0
		}
	],
	"description": "",
	"failReason": "",
	"finishTime": 0,
	"id": "",
	"imageUrl": "",
	"progress": "",
	"prompt": "",
	"promptEn": "",
	"properties": {},
	"startTime": 0,
	"state": "",
	"status": "",
	"submitTime": 0
}
{
	"action": "",
	"buttons": [
		{
			"customId": "",
			"emoji": "",
			"label": "",
			"style": 0,
			"type": 0
		}
	],
	"description": "",
	"failReason": "",
	"finishTime": 0,
	"id": "",
	"imageUrl": "",
	"progress": "",
	"prompt": "",
	"promptEn": "",
	"properties": {},
	"startTime": 0,
	"state": "",
	"status": "",
	"submitTime": 0
}

获取任务图片的seed

接口地址:/mj/task/{id}/image-seed

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:*/*

接口描述:

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
id任务IDpathfalsestring

响应状态:

状态码说明schema
200OKMessage«string»
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
codeinteger(int32)integer(int32)
descriptionstring
resultstring

响应示例:

json
{
	"code": 0,
	"description": "",
	"result": ""
}
{
	"code": 0,
	"description": "",
	"result": ""
}

根据ID列表查询任务

接口地址:/mj/task/list-by-condition

请求方式:POST

请求数据类型:application/json

响应数据类型:*/*

接口描述:

请求示例:

json
{
  "ids": []
}
{
  "ids": []
}

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
conditionDTOconditionDTObodytrue任务查询参数任务查询参数
  ids任务ID数组falsearraystring

响应状态:

状态码说明schema
200OK任务
201Created
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
action任务类型,可用值:IMAGINE,UPSCALE,VARIATION,ZOOM,PAN,DESCRIBE,BLEND,SHORTENstring
buttonsarray可执行按钮
  customId动作标识string
  emoji图标string
  label文本string
  style样式: 2(Primary)、3(Green)integer(int32)
  type类型,系统内部使用integer(int32)
description任务描述string
failReason失败原因string
finishTime结束时间integer(int64)integer(int64)
idIDstring
imageUrl图片urlstring
progress任务进度string
prompt提示词string
promptEn提示词-英文string
propertiesobject
startTime开始执行时间integer(int64)integer(int64)
state自定义参数string
status任务状态,可用值:NOT_START,SUBMITTED,MODAL,IN_PROGRESS,FAILURE,SUCCESSstring
submitTime提交时间integer(int64)integer(int64)

响应示例:

json
[
	{
		"action": "",
		"buttons": [
			{
				"customId": "",
				"emoji": "",
				"label": "",
				"style": 0,
				"type": 0
			}
		],
		"description": "",
		"failReason": "",
		"finishTime": 0,
		"id": "",
		"imageUrl": "",
		"progress": "",
		"prompt": "",
		"promptEn": "",
		"properties": {},
		"startTime": 0,
		"state": "",
		"status": "",
		"submitTime": 0
	}
]
[
	{
		"action": "",
		"buttons": [
			{
				"customId": "",
				"emoji": "",
				"label": "",
				"style": 0,
				"type": 0
			}
		],
		"description": "",
		"failReason": "",
		"finishTime": 0,
		"id": "",
		"imageUrl": "",
		"progress": "",
		"prompt": "",
		"promptEn": "",
		"properties": {},
		"startTime": 0,
		"state": "",
		"status": "",
		"submitTime": 0
	}
]