图像描述
curl --request POST \
--url https://api.ephone.ai/midjourney/describe \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "https://example.com/cat.png"
}
'import requests
url = "https://api.ephone.ai/midjourney/describe"
payload = { "image": "https://example.com/cat.png" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({image: 'https://example.com/cat.png'})
};
fetch('https://api.ephone.ai/midjourney/describe', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ephone.ai/midjourney/describe"
payload := strings.NewReader("{\n \"image\": \"https://example.com/cat.png\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"task_id": "mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3",
"action": "describe",
"status": "success",
"descriptions": [
"一只橘猫趴在窗台上晒太阳……"
],
"created_at": 1792000000,
"finished_at": 1792000000
}{
"error": {
"code": "invalid_request",
"message": "index must be between 1 and 4"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient balance"
}
}{
"error": {
"code": "queue_full",
"message": "Queue is full, please try again later"
}
}{
"error": {
"code": "upstream_error",
"message": "The service is temporarily unavailable, please retry"
}
}Midjourney
图像描述
上传一张图,得到可以直接用来生成的提示词描述。
POST
/
midjourney
/
describe
图像描述
curl --request POST \
--url https://api.ephone.ai/midjourney/describe \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "https://example.com/cat.png"
}
'import requests
url = "https://api.ephone.ai/midjourney/describe"
payload = { "image": "https://example.com/cat.png" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({image: 'https://example.com/cat.png'})
};
fetch('https://api.ephone.ai/midjourney/describe', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ephone.ai/midjourney/describe"
payload := strings.NewReader("{\n \"image\": \"https://example.com/cat.png\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"task_id": "mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3",
"action": "describe",
"status": "success",
"descriptions": [
"一只橘猫趴在窗台上晒太阳……"
],
"created_at": 1792000000,
"finished_at": 1792000000
}{
"error": {
"code": "invalid_request",
"message": "index must be between 1 and 4"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient balance"
}
}{
"error": {
"code": "queue_full",
"message": "Queue is full, please try again later"
}
}{
"error": {
"code": "upstream_error",
"message": "The service is temporarily unavailable, please retry"
}
}也可以用统一任务接口
POST /v1/task/submit 提交:model 填 midjourney-describe,参数放进 input。两种写法效果与计费完全一样。status 为 success,描述在 descriptions 里),不用再查询。授权
在请求头 Authorization: Bearer YOUR_API_KEY 里带上 API Key。
请求体
application/json
响应
OK
任务 ID。
动作名,例如 imagine、upscale。
任务状态,取值见上表。
可用选项:
submitted, in_progress, success, failure 创建时间(Unix 秒)。
提交时选的速度档:relax、fast 或 turbo,也是计费的那一档。识图不分速度,没有这一项。
实际提交的提示词。
图片地址,顺序就是图片序号(第 1 张对应 index: 1)。未通过内容审核的位置是空字符串。
视频地址(视频接口),顺序就是视频序号。
识图结果(describe 接口)。
种子值。
这个任务还能接着做的加工,例如 ["upscale", "variation", "reroll"]。调 POST /midjourney/action 时填进 action,再传 task_id;按图操作的还要传 index,reroll 不用。
失败原因。
结束时间(Unix 秒)。
用量,只在 success 时返回,例如 {"type": "call", "multiplier": 2}。multiplier 是规格倍率,相对于价格表里所选速度档的单价:高清为 2,V7 草图为 0.5,视频按分辨率和数量计;不含账户折扣。实际扣了多少钱看响应头 X-Billing-Amount(查询时带 X-Billing-Detail: true)。
此页面对您有帮助吗?