Midjourney
请求 Midjourney 平台绘图接口
POST /bp/ai/imagine
请求头部参数 (Headers):
- X-BytePower-Session-Token:登录后获取用户的 session。
- X-BytePower-Sign:请求体签名
请求体
content-type: "application/json"
描述:绘图所需信息
参数类型
名字 类型 示例 是否必填 描述 strategy string XXX true console 配置的策略名称 type string XXX true 支持 imagine, reroll, upscale, variation, inpaint, outpaint, pan, describe, blend, seed data object true 按 type 要求输入,参考文档 image_url string ai/storage/test2.png false 非必传,是用 AI storage 存储图片后使用,会自动将完整路径加到 data 里 prompt 字符串前面 注意,image_url 可使用 BytePower 上传图片,参考AI storage 请求体示例:
json
{
"strategy": "yx_image",
"type": "imagine",
"data": {
"prompt": "change rabbit color"
},
"image_url": "ai/storage/rabbit.png"
}
响应
HTTP 状态码:200
描述:成功,data 里内容参考文档fetch 返回值 响应示例:
json
{
"current_count": 1,
"current_total_count": 1,
"data": {
"meta": {
"account_id": "899",
"bot_hash": "",
"bot_id": 593,
"created_at": 1703750788,
"ended_at": 1703750878,
"frozen_credit": 0,
"model_version": "unknown",
"origin_task_id": "",
"process_mode": "relax",
"quota_frozen": 9,
"started_at": 1703750789,
"task_param": {
"aspect_ratio": "1:1",
"direction": "",
"index": "",
"prompt": "你知道1990北京样貌 --relax",
"zoom_ratio": "2"
},
"task_request": {
"aspect_ratio": "",
"auto_upload": false,
"process_mode": "",
"prompt": "你知道1990北京样貌",
"skip_prompt_check": false,
"upload_prompt_image": false
},
"task_type": "imagine"
},
"process_time": 89,
"retry_count": 0,
"status": "finished",
"task_id": "48798bdc-1e48-4a4f-9005-4fca73dd00b5",
"task_result": {
"actions": ["reroll", "upscale1", "upscale2", "upscale3", "upscale4", "variation1", "variation2", "variation3", "variation4"],
"credit": 0,
"discord_image_url": "https://img.midjourneyapi.xyz/mj/0df2cb4d-9116-4c7f-a058-f4588383cef2.png",
"error_messages": [],
"image_id": "0708ac3a-7244-4304-bcf6-51024036adae",
"image_url": "https://img.midjourneyapi.xyz/mj/0df2cb4d-9116-4c7f-a058-f4588383cef2.png",
"message": "",
"need_retry": true,
"permanent_url": "",
"quota_used": 3,
"result_message_id": "1189842146849738823",
"seed": "",
"task_progress": 100
}
}
}
HTTP 状态码:4xx 描述:错误 响应示例:
json
{
"error": {
"error_type": "invalid_parameter",
"message": "xxxxx"
}
}
error_type:
- invalid_parameter(参数错误)
- item_not_found(找不到相应内容)
- config_invalid (console 配置问题)
- api_rate_limit (超过请求频率限制)
- ai_free_limit (超过配置限额)