docs: update Midjourney.md

This commit is contained in:
CaIon 2024-01-09 20:07:19 +08:00
parent db29c96361
commit 4a4df75830
2 changed files with 192 additions and 152 deletions

View File

@ -1,254 +1,291 @@
# Midjourney Proxy API文档 # Midjourney Proxy API文档
**简介**:Midjourney Proxy API文档 **简介**:Midjourney Proxy API文档
## 模型价格设置(在设置-运营设置-模型固定价格设置中设置)
**HOST**:https://api.nekoedu.com ```json
{
"gpt-4-gizmo-*": 0.1,
"mj_imagine": 0.1,
"mj_variation": 0.1,
"mj_reroll": 0.1,
"mj_blend": 0.1,
"mj_describe": 0.05,
"mj_upscale": 0.05
}
```
## 渠道设置
**Version**:v2.3.5 ### 对接 midjourney-proxy
1. 部署Midjourney-Proxy并配置好midjourney账号等强烈建议设置密钥[项目地址](https://github.com/novicezk/midjourney-proxy)
2. 在渠道管理中添加渠道渠道类型选择Midjourney Proxy模型选择midjourney
3. 地址填写midjourney-proxy部署的地址例如http://localhost:8080
4. 密钥填写midjourney-proxy的密钥如果没有设置密钥可以随便填
### 对接上游new api
1. 在渠道管理中添加渠道渠道类型选择Midjourney Proxy模型选择midjourney
2. 地址填写上游new api的地址例如http://localhost:8080
3. 密钥填写上游new api的密钥
[TOC] ## 任务提交
# 任务提交
## 绘图变化
### 绘图变化
**接口地址**:`/mj/submit/change` **接口地址**:`/mj/submit/change`
**请求方式**:`POST` **请求方式**:`POST`
**请求数据类型**:`application/json` **请求数据类型**:`application/json`
**响应数据类型**:`*/*` **响应数据类型**:`*/*`
**接口描述**: **接口描述**:
**请求示例**: **请求示例**:
```javascript ```javascript
{ {
"action": "UPSCALE", "action"
"index": 1, :
"notifyHook": "", "UPSCALE",
"state": "", "index"
"taskId": "1320098173412546" :
1,
"notifyHook"
:
"",
"state"
:
"",
"taskId"
:
"1320098173412546"
} }
``` ```
**请求参数**: **请求参数**:
| 参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 | schema |
| 参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 | schema | |------------------------|-----------------------------------------------------------------------|------|-------|----------------|----------|
| -------- | -------- | ----- | -------- | -------- | ------ | | changeDTO | changeDTO | body | true | 变化任务提交参数 | 变化任务提交参数 |
|changeDTO|changeDTO|body|true|变化任务提交参数|变化任务提交参数| |   action | UPSCALE(放大); VARIATION(变换); REROLL(重新生成),可用值:UPSCALE,VARIATION,REROLL | | true | string | |
|  action|UPSCALE(放大); VARIATION(变换); REROLL(重新生成),可用值:UPSCALE,VARIATION,REROLL||true|string|| |   index | 序号(1~4), action为UPSCALE,VARIATION时必传 | | false | integer(int32) | |
|  index|序号(1~4), action为UPSCALE,VARIATION时必传||false|integer(int32)|| |   notifyHook | 回调地址, 为空时使用全局notifyHook | | false | string | |
|  notifyHook|回调地址, 为空时使用全局notifyHook||false|string|| |   state | 自定义参数 | | false | string | |
|  state|自定义参数||false|string|| |   taskId | 任务ID | | true | string | |
|  taskId|任务ID||true|string||
**响应状态**: **响应状态**:
| 状态码 | 说明 | schema |
| 状态码 | 说明 | schema | |-----|--------------|--------|
| -------- | -------- | ----- | | 200 | OK | 提交结果 |
|200|OK|提交结果| | 201 | Created | |
|201|Created|| | 401 | Unauthorized | |
|401|Unauthorized|| | 403 | Forbidden | |
|403|Forbidden|| | 404 | Not Found | |
|404|Not Found||
**响应参数**: **响应参数**:
| 参数名称 | 参数说明 | 类型 | schema |
| 参数名称 | 参数说明 | 类型 | schema | |-------------|-------------------------------------------|----------------|----------------|
| -------- | -------- | ----- |----- | | code | 状态码: 1(提交成功), 21(已存在), 22(排队中), other(错误) | integer(int32) | integer(int32) |
|code|状态码: 1(提交成功), 21(已存在), 22(排队中), other(错误)|integer(int32)|integer(int32)| | description | 描述 | string | |
|description|描述|string|| | properties | 扩展字段 | object | |
|properties|扩展字段|object|| | result | 任务ID | string | |
|result|任务ID|string||
**响应示例**: **响应示例**:
```javascript ```javascript
{ {
"code": 1, "code"
"description": "提交成功", :
"properties": {}, 1,
"result": 1320098173412546 "description"
:
"提交成功",
"properties"
:
{
}
,
"result"
:
1320098173412546
} }
``` ```
## 提交Imagine任务 ### 提交Imagine任务
**接口地址**:`/mj/submit/imagine` **接口地址**:`/mj/submit/imagine`
**请求方式**:`POST` **请求方式**:`POST`
**请求数据类型**:`application/json` **请求数据类型**:`application/json`
**响应数据类型**:`*/*` **响应数据类型**:`*/*`
**接口描述**: **接口描述**:
**请求示例**: **请求示例**:
```javascript ```javascript
{ {
"base64": "", "base64"
"notifyHook": "", :
"prompt": "Cat", "",
"state": "" "notifyHook"
:
"",
"prompt"
:
"Cat",
"state"
:
""
} }
``` ```
**请求参数**: **请求参数**:
| 参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 | schema |
| 参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 | schema | |------------------------|-------------------------|------|-------|-------------|-------------|
| -------- | -------- | ----- | -------- | -------- | ------ | | imagineDTO | imagineDTO | body | true | Imagine提交参数 | Imagine提交参数 |
|imagineDTO|imagineDTO|body|true|Imagine提交参数|Imagine提交参数| |   base64 | 垫图base64 | | false | string | |
|  base64|垫图base64||false|string|| |   notifyHook | 回调地址, 为空时使用全局notifyHook | | false | string | |
|  notifyHook|回调地址, 为空时使用全局notifyHook||false|string|| |   prompt | 提示词 | | true | string | |
|  prompt|提示词||true|string|| |   state | 自定义参数 | | false | string | |
|  state|自定义参数||false|string||
**响应状态**: **响应状态**:
| 状态码 | 说明 | schema |
| 状态码 | 说明 | schema | |-----|--------------|--------|
| -------- | -------- | ----- | | 200 | OK | 提交结果 |
|200|OK|提交结果| | 201 | Created | |
|201|Created|| | 401 | Unauthorized | |
|401|Unauthorized|| | 403 | Forbidden | |
|403|Forbidden|| | 404 | Not Found | |
|404|Not Found||
**响应参数**: **响应参数**:
| 参数名称 | 参数说明 | 类型 | schema |
| 参数名称 | 参数说明 | 类型 | schema | |-------------|-------------------------------------------|----------------|----------------|
| -------- | -------- | ----- |----- | | code | 状态码: 1(提交成功), 21(已存在), 22(排队中), other(错误) | integer(int32) | integer(int32) |
|code|状态码: 1(提交成功), 21(已存在), 22(排队中), other(错误)|integer(int32)|integer(int32)| | description | 描述 | string | |
|description|描述|string|| | properties | 扩展字段 | object | |
|properties|扩展字段|object|| | result | 任务ID | string | |
|result|任务ID|string||
**响应示例**: **响应示例**:
```javascript ```javascript
{ {
"code": 1, "code"
"description": "提交成功", :
"properties": {}, 1,
"result": 1320098173412546 "description"
:
"提交成功",
"properties"
:
{
}
,
"result"
:
1320098173412546
} }
``` ```
## 任务查询
# 任务查询 ### 指定ID获取任务
## 指定ID获取任务
**接口地址**:`/mj/task/{id}/fetch` **接口地址**:`/mj/task/{id}/fetch`
**请求方式**:`GET` **请求方式**:`GET`
**请求数据类型**:`application/x-www-form-urlencoded` **请求数据类型**:`application/x-www-form-urlencoded`
**响应数据类型**:`*/*` **响应数据类型**:`*/*`
**接口描述**: **接口描述**:
**请求参数**: **请求参数**:
| 参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 | schema |
| 参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 | schema | |------|------|------|-------|--------|--------|
| -------- | -------- | ----- | -------- | -------- | ------ | | id | 任务ID | path | false | string | |
|id|任务ID|path|false|string||
**响应状态**: **响应状态**:
| 状态码 | 说明 | schema |
| 状态码 | 说明 | schema | |-----|--------------|--------|
| -------- | -------- | ----- | | 200 | OK | 任务 |
|200|OK|任务| | 401 | Unauthorized | |
|401|Unauthorized|| | 403 | Forbidden | |
|403|Forbidden|| | 404 | Not Found | |
|404|Not Found||
**响应参数**: **响应参数**:
| 参数名称 | 参数说明 | 类型 | schema |
| 参数名称 | 参数说明 | 类型 | schema | |-------------|----------------------------------------------------------|----------------|----------------|
| -------- | -------- | ----- |----- | | action | 可用值:IMAGINE,UPSCALE,VARIATION,REROLL,DESCRIBE,BLEND | string | |
|action|可用值:IMAGINE,UPSCALE,VARIATION,REROLL,DESCRIBE,BLEND|string|| | description | 任务描述 | string | |
|description|任务描述|string|| | failReason | 失败原因 | string | |
|failReason|失败原因|string|| | finishTime | 结束时间 | integer(int64) | integer(int64) |
|finishTime|结束时间|integer(int64)|integer(int64)| | id | 任务ID | string | |
|id|任务ID|string|| | imageUrl | 图片url | string | |
|imageUrl|图片url|string|| | progress | 任务进度 | string | |
|progress|任务进度|string|| | prompt | 提示词 | string | |
|prompt|提示词|string|| | promptEn | 提示词-英文 | string | |
|promptEn|提示词-英文|string|| | startTime | 开始执行时间 | integer(int64) | integer(int64) |
|startTime|开始执行时间|integer(int64)|integer(int64)| | state | 自定义参数 | string | |
|state|自定义参数|string|| | status | 任务状态,可用值:NOT_START,SUBMITTED,IN_PROGRESS,FAILURE,SUCCESS | string | |
|status|任务状态,可用值:NOT_START,SUBMITTED,IN_PROGRESS,FAILURE,SUCCESS|string|| | submitTime | 提交时间 | integer(int64) | integer(int64) |
|submitTime|提交时间|integer(int64)|integer(int64)|
**响应示例**: **响应示例**:
```javascript ```javascript
{ {
"action": "", "action"
"description": "", :
"failReason": "", "",
"finishTime": 0, "description"
"id": "", :
"imageUrl": "", "",
"progress": "", "failReason"
"prompt": "", :
"promptEn": "", "",
"startTime": 0, "finishTime"
"state": "", :
"status": "", 0,
"submitTime": 0 "id"
:
"",
"imageUrl"
:
"",
"progress"
:
"",
"prompt"
:
"",
"promptEn"
:
"",
"startTime"
:
0,
"state"
:
"",
"status"
:
"",
"submitTime"
:
0
} }
``` ```

View File

@ -23,6 +23,7 @@
+ [x] /mj/submit/describe + [x] /mj/submit/describe
+ [x] /mj/image/{id} (通过此接口获取图片,**请必须在系统设置中填写服务器地址!!** + [x] /mj/image/{id} (通过此接口获取图片,**请必须在系统设置中填写服务器地址!!**
+ [x] /mj/task/{id}/fetch 此接口返回的图片地址为经过One API转发的地址 + [x] /mj/task/{id}/fetch 此接口返回的图片地址为经过One API转发的地址
+ [x] /task/list-by-condition
3. 支持在线充值功能,可在系统设置中设置,当前支持的支付接口: 3. 支持在线充值功能,可在系统设置中设置,当前支持的支付接口:
+ [x] 易支付 + [x] 易支付
4. 支持用key查询使用额度: 4. 支持用key查询使用额度:
@ -55,6 +56,8 @@ docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -
# 例如: # 例如:
docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:123456@tcp(宝塔的服务器地址:宝塔数据库端口)/宝塔数据库名称" -e TZ=Asia/Shanghai -v /www/wwwroot/new-api:/data calciumion/new-api:latest docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:123456@tcp(宝塔的服务器地址:宝塔数据库端口)/宝塔数据库名称" -e TZ=Asia/Shanghai -v /www/wwwroot/new-api:/data calciumion/new-api:latest
``` ```
## Midjourney接口设置文档
[对接文档](Midjourney.md)
## 交流群 ## 交流群
<img src="https://github.com/Calcium-Ion/new-api/assets/61247483/de536a8a-0161-47a7-a0a2-66ef6de81266" width="300"> <img src="https://github.com/Calcium-Ion/new-api/assets/61247483/de536a8a-0161-47a7-a0a2-66ef6de81266" width="300">