图像生成
curl --request POST \
--url https://api.ephone.ai/midjourney/imagine \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "a lighthouse on a rocky coast at dawn --ar 16:9 --v 7"
}
'import requests
url = "https://api.ephone.ai/midjourney/imagine"
payload = { "prompt": "a lighthouse on a rocky coast at dawn --ar 16:9 --v 7" }
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({prompt: 'a lighthouse on a rocky coast at dawn --ar 16:9 --v 7'})
};
fetch('https://api.ephone.ai/midjourney/imagine', 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/imagine"
payload := strings.NewReader("{\n \"prompt\": \"a lighthouse on a rocky coast at dawn --ar 16:9 --v 7\"\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": "imagine",
"status": "submitted",
"created_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
图像生成
Midjourney 文生图,一次四张。默认 V8.2,也支持 V8.1、V8、V7 与 Niji 7 / 6,在提示词末尾写 --v 7 这样的参数选版本;可以垫图,Midjourney 参数照常写。
POST
/
midjourney
/
imagine
图像生成
curl --request POST \
--url https://api.ephone.ai/midjourney/imagine \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "a lighthouse on a rocky coast at dawn --ar 16:9 --v 7"
}
'import requests
url = "https://api.ephone.ai/midjourney/imagine"
payload = { "prompt": "a lighthouse on a rocky coast at dawn --ar 16:9 --v 7" }
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({prompt: 'a lighthouse on a rocky coast at dawn --ar 16:9 --v 7'})
};
fetch('https://api.ephone.ai/midjourney/imagine', 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/imagine"
payload := strings.NewReader("{\n \"prompt\": \"a lighthouse on a rocky coast at dawn --ar 16:9 --v 7\"\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": "imagine",
"status": "submitted",
"created_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-imagine,参数放进 input。两种写法效果与计费完全一样。notify_hook 等推送。完成后结果里的 actions 列出还能接着做的加工,调 图像操作 继续。授权
在请求头 Authorization: Bearer YOUR_API_KEY 里带上 API Key。
请求体
application/json
提示词:描述画面,可以带 Midjourney 参数,如 a cat in the rain --ar 16:9 --v 7。只传 images 时可以不写。
Maximum string length:
6000垫图:最多 5 张,作为画面参考放在提示词前面。图片 URL(公网可访问)或 base64 data URI,单张不超过 20 MB。
Maximum array length:
5速度:慢速(relax)价格最低、排队较久;极速(turbo)最快、2 倍价格。也可以在提示词里写 --relax / --fast / --turbo,请求参数优先;都不写为快速。
可用选项:
relax, fast, turbo 推送地址:任务结束后,把和查询结果相同的内容 POST 到这个地址(公网可以访问的 http / https 地址)。不传就自己查询。
此页面对您有帮助吗?