跳到导航

MiniMax H3 Image

根据文本和最多 16 张参考图生成或编辑图片,支持 1K、2K、4K 或精确像素尺寸,按每次渲染实际使用的 token 计费。

  • 异步:创建调用会立即返回任务 ID;任务成功后才能拿到图片。
  • 每个任务生成一张图片。需要多张图片时,请创建多个任务。
  • 文生图,或编辑、合成最多 16 张以公网 HTTPS 链接给出的参考图。
  • 用 resolution 和 aspect_ratio 选择画幅,或用一个精确的 size,例如 2720x1536。两者不能同时使用。aspect_ratio 默认为 auto,由模型根据提示词和参考图自行决定画幅。
  • 按 token 计费:文本输入(提示词,含 MiniMax 的提示词增强)、参考图输入和图片输出,各有每 100 万 token 的单价。下方的单张价格是估算价。resolution 默认为 4K;1K 与 2K 的输出 token 相同,价格也相同。
  • 结果是 png(默认)、jpeg 或 webp 文件,由 output_format 选择。失败的任务不收费。

MiniMax H3 Image 是 MiniMax 的图片模型,按 token 计费,价格为 MiniMax 官方牌价的 7 折。需要 Highspeed 线路时请使用 minimax-h3-image-highspeed:请求相同,图片输入和图片输出的每百万 token 单价更高。

POST/v1/images/tasks试一试

在调试窗口里打开本模型,填入你的 BeatAPI API 密钥即可创建任务。调用是真实的,费用从你自己的余额中扣除。

模型 ID

两个 MiniMax H3 Image 模型使用同一个接口和同一组字段。下方的取值直接来自网关契约。

模型 IDresolutionimages 上限output_format说明
minimax-h3-image1K, 2K, 4K16png, jpeg, webpMiniMax 的图片模型。每百万 token 单价见价格表。
minimax-h3-image-highspeed1K, 2K, 4K16png, jpeg, webpHighspeed 线路。字段和限制相同;图片输入和图片输出的单价更高,见价格表。

接口与鉴权

POST https://api.beatapi.io/v1/images/tasks

Authorization string 必需

你的 BeatAPI API 密钥,以 Bearer <BEATAPI_API_KEY> 形式发送。在控制台创建密钥。密钥只能保存在你的服务端,不要放进浏览器或移动端应用。

请求体使用 JSON,并设置 Content-Type: application/json。Idempotency-Key 为可选:每个逻辑请求发送一个唯一值(最长 255 个字符),仅在重试完全相同的请求体时复用。24 小时内,用相同的键和请求体重试会再次返回第一次的响应,并带上 Idempotent-Replayed: true;相同的键搭配不同的请求体则返回 409 idempotency_conflict。非 2xx 的响应不会被保存,因此 400 或 402 之后的重试会重新执行。

请求流程

1

创建任务

向接口 POST 下方的参数。返回 201 表示任务已被接受,其价格已从你的余额中预留;任务在后台运行。保存 data.id。

2

等待任务完成

调用 GET /v1/tasks/{task_id},两次调用之间等待 data.poll_after_seconds 秒(图片 5 秒,视频 8 秒),直到 status 为 succeeded 或 failed。也可以为 task.succeeded 和 task.failed 注册 Webhook;仍需保留轮询作为兜底,因为因处理超时而终止的任务不会发送事件。

3

保存结果

状态为 succeeded 时,下载每个 data.output.media[].url 并保存你需要的文件;BeatAPI 不承诺结果链接的保留时长。状态为 failed 时,读取 data.error_code 和 data.error_message:预扣的金额已退回你的余额,data.retryable 表示再次发送相同请求是否可能成功。

输入模式

模式必填输入说明
文生图model、prompt不要传 images。
编辑或合成图片model、prompt、images1 到 16 个公网 HTTPS 图片链接。在 prompt 中说明要修改、保留或合成什么。

请求参数

model string 必需

要运行的模型。

取值:minimax-h3-image

取值有误时

  • 缺失:"model" is required
  • 未知的模型 ID:"model" minimax-image-9 is not catalogued
  • 把视频模型发到了这个接口:"model" seedance-2.5 is served by POST /v1/videos/tasks, not this endpoint

prompt string 必需

要画什么,或要如何修改参考图。用平实的语言效果最好:主体、风格、光线、构图,以及必须出现在图中的文字。

长度:1–5000 个字符

  • 长度按字符计算(一个中日韩字符算一个)。
  • 传了 images 时,请说明每张图的用途,例如「产品用第一张图,背景用第二张图」。
  • MiniMax 的提示词增强对每个订单都会开启。它会给输入增加文本 token,按文本输入的单价计费。

取值有误时

  • 缺失:"prompt" is required
  • 为空或超过长度上限:"prompt" has an unsupported length
  • 不是字符串:"prompt" must be a string

images string[] 可选

要编辑或合成的参考图。传了这个字段,请求就从文生图变为图片编辑。

数量:1–16
每一项都必须是公网 https:// 链接。本地文件请先上传(POST /v1/files),再传入返回的 data.url。

  • 每个链接必须通过公网 HTTPS 直接返回图片文件本身(PNG、JPEG 或 WebP),不超过 50 MB。网关在创建任务前会下载每个链接的开头字节,并根据这些字节识别类型,而不是看文件名或 Content-Type。
  • 指向网页、登录页、已过期的签名链接或有防盗链的主机的链接会被拒绝,因为它们不会返回图片。
  • 报错信息里的序号从 0 开始:images[0] 是第一个链接。
  • 参考图按图片输入计费,有各自的每 100 万 token 单价(见价格)。

取值有误时

  • 超过上限:"images" accepts at most 16 items
  • 空数组:"images" requires at least 1 item
  • 不是 https:// 链接:"images[0]" must be a public HTTPS URL
  • 私有或不安全的地址:"images[0]" must be a publicly reachable HTTPS image URL
  • 主机返回 4xx 错误:"images[0]" could not be downloaded: the URL returned HTTP 404
  • 链接返回的不是 PNG、JPEG 或 WebP:"images[0]" is not a PNG, JPEG or WebP image: the URL returned text/html
  • 超过 50 MB:"images[2]" is 63.4 MB; images must be 50 MB or smaller

示例

"images": [
"https://cdn.beatapi.io/samples/smart-bottle.png",
"https://cdn.beatapi.io/samples/neon-singer.png"
]

aspect_ratio string 可选默认值: auto

图片的宽高比,格式为宽:高。与 resolution 一起传;或者两者都不传,改传 size。

可选值:auto, 1:1, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 2:1, 1:2, 3:1, 1:3, 21:9, 9:21
默认值:auto

  • 默认值是 auto:由模型根据提示词和参考图(如果有)决定画幅。需要特定形状时请明确写出比例。
  • 支持全景比例 2:1、1:2、3:1、1:3、21:9 和 9:21。最宽或最高的画幅是 3:1。
  • 不能与 size 同时使用。

取值有误时

  • 取值不在列表中:"aspect_ratio" must be one of: [auto 1:1 3:2 2:3 4:3 3:4 5:4 4:5 16:9 9:16 2:1 1:2 3:1 1:3 21:9 9:21]
  • 与 size 同时传:"size" already fixes the output; do not send "aspect_ratio" with it

resolution string 可选默认值: 4K

图片的尺寸档位:1K、2K 或 4K。档位越高图片越大;具体像素尺寸取决于 aspect_ratio,由模型决定。

可选值:1K, 2K, 4K
默认值:4K

  • 不传这个字段时使用 4K。
  • 1K 与 2K 的输出 token 相同,所以价格也相同。4K 的输出 token 约为它们的四倍,价格更高(见价格)。
  • 请使用大写的 K:2k 会被拒绝。
  • 本页不承诺每个档位的确切像素尺寸。需要确切画幅时请传 size。
  • 不能与 size 同时使用,size 自带尺寸。

取值有误时

  • 取值不在列表中:"resolution" must be one of: [1K 2K 4K]
  • 与 size 同时传:"size" already fixes the output; do not send "resolution" with it

size string 可选

以像素为单位的精确输出画幅,格式为 宽x高,例如 2720x1536。它取代 resolution 和 aspect_ratio。

  • 总像素必须在 655,360 到 20,000,000 之间,长边不超过短边的 3 倍。对边长没有倍数要求。
  • 画幅按所传的值精确渲染,不会取整。
  • 分隔符可以是 x、X 或 ×;两侧的空格会被忽略。
  • 计费跟随渲染实际使用的 token:画幅越大,输出 token 越多,价格越高(见价格)。
  • 不要同时传 resolution 或 aspect_ratio,即使是默认值也不行。

取值有误时

  • 不是字符串:"size" must be a string
  • 不是 宽x高 的形式(单个数字、auto、逗号):"size" must be WIDTHxHEIGHT in pixels, for example 2720x1536
  • 像素太少或太多:"size" must have between 655,360 and 20,000,000 pixels; 512x512 has 262,144
  • 宽高比超过 3:1:"size" must not be wider or taller than 3:1
  • 与 resolution 同时传:"size" already fixes the output; do not send "resolution" with it
  • 与 aspect_ratio 同时传:"size" already fixes the output; do not send "aspect_ratio" with it

示例

"size": "2720x1536"

output_format string 可选默认值: png

图片的文件类型:png、jpeg 或 webp。

可选值:png, jpeg, webp
默认值:png

  • 默认值是 png。
  • 格式不影响价格。
  • 存储文件的类型请读取输出里的 mime_type。

取值有误时

  • 取值不在列表中:"output_format" must be one of: [png jpeg webp]

示例

"output_format": "webp"

网关还会在创建任务之前检查以下组合:

  • size 写为 宽x高,替代 resolution 和 aspect_ratio:总像素为 655,360–20,000,000;最长边与最短边之比不超过 3:1;按所传值精确渲染,不会取整。
  • 按 token 以牌价计费,token 数按每次出图实际用到的计(文本输入含提示词增强、参考图、图片输出);列出的每张价格是估算;1K 与 2K 的输出 token 相同。
  • aspect_ratio: auto 由模型根据提示词和输入图决定画幅。

输入素材限制

网关会在创建任务之前读取每一项输入,超出这些限制的输入会被拒绝,并返回点名该输入的 400 bad_request。不扣费。

  • 参考图:PNG、JPEG 或 WebP,根据文件内容识别;每张不超过 50 MB(十进制 MB;主机声明大小时检查);1 到 16 个链接。GIF、HEIC 和 SVG 会被拒绝。
  • 不检查参考图本身的像素或宽高比限制。
  • 如果主机没有及时响应,创建时不会拒绝该链接。网关会在任务派发时再次获取;仍然无法获取的链接会使任务失败,并退款。
  • 有本地文件?用 POST /v1/files 上传,再传返回的 data.url。

选择画幅:resolution 与 aspect_ratio,或 size

指定图片多大、多宽有两种方式,二者互斥:

  • 档位加比例。 传 resolution(1K、2K 或 4K),需要特定形状时再传 aspect_ratio。两者都不传则为 4K 和 auto:由模型决定画幅。
  • 精确尺寸。 只传 size,例如 2720x1536:655,360 到 20,000,000 像素,宽高比不超过 3:1,按所传值精确渲染。

同时传 size 与 resolution 或 aspect_ratio 会被拒绝,报错为 "size" already fixes the output; do not send "resolution" with it(或 "aspect_ratio")。另一个字段即使是默认值,也会触发这项检查。

估算价的前提

下方价格表中的单张价格是估算价。每一项都假设 3,000 个文本 token(提示词和 MiniMax 的提示词增强)加上该档位的输出 token,且没有参考图。实际收费按这次渲染真正使用的 token 结算。

resolution估算采用的输出 token
1K4,096
2K4,096
4K16,384

这个模型不接受的字段

图片接口认识一些其他图片模型使用的字段。在这里传它们会被拒绝,而不是被忽略,所以你不会为一个没有效果的设置付费:

  • background、quality、seed、enhance_prompt → field "background" is not supported by model minimax-h3-image(会写出你传的字段和你调用的模型)。
  • 其他任何未知字段,例如 n 或 moderation → unknown field: n。没有 n:一个任务只生成一张图片。

请求示例

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "minimax-h3-image",
"prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
"aspect_ratio": "3:2",
"resolution": "2K"
}'

文生图

用提示词生成一张 2K 横幅图片,指定档位和比例。

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "minimax-h3-image",
"prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
"aspect_ratio": "3:2",
"resolution": "2K"
}'

让模型决定画幅

只传提示词:resolution 为 4K,aspect_ratio 为 auto,由模型决定画幅。

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "minimax-h3-image",
"prompt": "A tall, narrow travel poster of a mountain railway at dawn, bold flat colours"
}'

编辑一张图片

更换背景,保留产品。

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "minimax-h3-image",
"prompt": "Keep the bottle exactly as it is. Replace the background with a sunlit kitchen counter and add a soft reflection under the bottle.",
"images": [
"https://cdn.beatapi.io/samples/smart-bottle.png"
],
"aspect_ratio": "1:1",
"resolution": "2K"
}'

合成多张图片

在提示词里按位置称呼每张参考图。

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "minimax-h3-image",
"prompt": "Place the bottle from the first image on a neon-lit stage like the one in the second image. Keep the bottle label readable.",
"images": [
"https://cdn.beatapi.io/samples/smart-bottle.png",
"https://cdn.beatapi.io/samples/neon-singer.png"
],
"aspect_ratio": "16:9",
"resolution": "2K"
}'

精确尺寸

一个 2720x1536 的 WebP 画幅。size 单独使用:不传 resolution,也不传 aspect_ratio。

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "minimax-h3-image",
"prompt": "A flat illustration of a lighthouse on a cliff at dawn, pastel colours, clean shapes",
"size": "2720x1536",
"output_format": "webp"
}'

响应

创建任务(201)

任务对象。任务成功之前 output 为 null。标注“运行中”的字段会在任务结束后消失。

{
"data": {
"id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"object": "task",
"task_kind": "image",
"capability_id": "minimax-h3-image",
"capability_version": 1,
"media_type": "image",
"model": "minimax-h3-image",
"status": "queued",
"stage": "queued",
"created_at": 1791993600,
"updated_at": 1791993600,
"completed_at": null,
"poll_after_seconds": 5,
"output": null,
"usage": {
"credits_reserved": 0.015725,
"credits_settled": 0,
"credits_refunded": 0,
"credits_charged": 0.015725
},
"request_id": "req_5f0c2a9e4b7d4e31",
"error_code": null,
"error_message": null
}
}
字段类型说明
data.idstring任务 ID:task_ 后接 32 位字母和数字。用于轮询以及匹配 Webhook 事件。
data.objectstring固定为 task。
data.task_kindstringimage 或 video。
data.capability_idstring你发送的模型 ID。
data.capability_versioninteger模型的契约版本,当前为 1。
data.media_typestringimage 或 video。
data.modelstring你发送的模型 ID(与 capability_id 相同)。
data.statusstringqueued、processing、succeeded 或 failed。只有后两个是终态。
data.stagestring与 status 相同;为旧版客户端保留。
data.created_atinteger任务创建时间,Unix 秒。
data.updated_atinteger最后一次变更时间,Unix 秒。
data.completed_atinteger | null任务结束时间,Unix 秒;运行中为 null。
data.poll_after_secondsinteger运行中:下一次轮询前需要等待的秒数(图片 5,视频 8)。
data.typical_secondsobject运行中且近期样本足够时出现:在最近的 window 内,根据 samples 个任务统计的完成时间 p50 和 p90,单位为秒。
data.outputobject | null任务结果;status 为 succeeded 之前为 null。见下方输出字段。
data.usage.credits_reservednumber创建任务时从你的余额中预扣的美元金额。
data.usage.credits_chargednumber该任务的费用(美元);失败的任务为 0。
data.usage.credits_settlednumber最终结算扣除的美元金额;任务成功时设置,否则为 0。
data.usage.credits_refundednumber退回你余额的美元金额;失败的任务在退款记录完成后等于预扣金额。
data.usage.billable_duration_secondsinteger仅视频:计价所依据的秒数。模型未上报时长时不出现。
data.request_idstring请求 ID。联系支持时请附上。
data.error_codestring | null失败码;任务未失败时为 null。
data.error_messagestring | null出了什么问题以及该改什么;任务未失败时为 null。

任务完成

GET /v1/tasks/{task_id} 返回 HTTP 200 和 status: "succeeded",结果在 data.output 中。

{
"data": {
"id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"object": "task",
"task_kind": "image",
"capability_id": "minimax-h3-image",
"capability_version": 1,
"media_type": "image",
"model": "minimax-h3-image",
"status": "succeeded",
"stage": "succeeded",
"created_at": 1791993600,
"updated_at": 1791993690,
"completed_at": 1791993690,
"output": {
"media": [
{
"type": "image",
"url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.png",
"mime_type": "image/png"
}
],
"r2_url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.png"
},
"usage": {
"credits_reserved": 0.015725,
"credits_settled": 0.015725,
"credits_refunded": 0,
"credits_charged": 0.015725
},
"request_id": "req_5f0c2a9e4b7d4e31",
"error_code": null,
"error_message": null
}
}

输出字段

字段类型说明
output.mediaobject[]生成的文件;这个模型只有一项。
output.media[].typestring始终为 image。
output.media[].urlstring已存储图片的 HTTPS 链接。请下载并自行保存;不承诺保留期限。
output.media[].mime_typestring已存储文件的类型:image/png、image/jpeg 或 image/webp,与 output_format 一致。
output.r2_urlstring第一个媒体 URL 的重复,供旧客户端使用。请读取 media。

任务失败

失败的任务在 GET /v1/tasks/{task_id} 上仍然是 HTTP 200:失败信息在响应体里。预扣金额会全额退回,因此不会扣费。

{
"data": {
"id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"object": "task",
"task_kind": "image",
"capability_id": "minimax-h3-image",
"capability_version": 1,
"media_type": "image",
"model": "minimax-h3-image",
"status": "failed",
"stage": "failed",
"created_at": 1791993600,
"updated_at": 1791993690,
"completed_at": 1791993690,
"output": null,
"usage": {
"credits_reserved": 0.015725,
"credits_settled": 0,
"credits_refunded": 0.015725,
"credits_charged": 0
},
"retryable": true,
"request_id": "req_5f0c2a9e4b7d4e31",
"error_code": "processing_failed",
"error_message": "The task failed during processing on our side. Retry; a failed task is refunded."
}
}
字段类型说明
data.error_codestringbad_request 和 content_policy_violation(需修改请求)之一,或 processing_unavailable、processing_timeout、processing_failed 和 result_transfer_failed(稍后重试)之一。见错误码。
data.error_messagestring一句话,指出问题和处理方式。
data.retryableboolean仅在任务失败时出现:为 true 表示再次发送相同请求可能成功。
data.usageobject退款记录完成后(通常就在任务失败的那一刻):credits_charged 和 credits_settled 为 0;credits_refunded 等于 credits_reserved。

完整示例

创建任务,按服务端给出的轮询提示等待,然后打印结果链接。请在环境变量中设置 BEATAPI_API_KEY 并安装 requests。

import os
import time
import uuid
import requests
API = "https://api.beatapi.io"
HEADERS = {"Authorization": f"Bearer {os.environ['BEATAPI_API_KEY']}"}
def create_task(body: dict) -> dict:
# One Idempotency-Key per logical request: a retry with the same key cannot create a second task.
headers = {**HEADERS, "Idempotency-Key": str(uuid.uuid4())}
for attempt in range(3):
response = requests.post(f"{API}/v1/images/tasks", headers=headers, json=body, timeout=60)
if response.status_code in (429, 503) and attempt < 2:
time.sleep(int(response.headers.get("Retry-After", 10)))
continue
break
try:
payload = response.json()
except ValueError: # an edge error page is not JSON
response.raise_for_status()
raise
if not response.ok:
error = payload["error"]
raise RuntimeError(f"{response.status_code} {error['code']}: {error['message']} (request_id={error.get('request_id')})")
return payload["data"]
def wait_for_task(task_id: str, timeout_seconds: int = 1800) -> dict:
deadline = time.monotonic() + timeout_seconds
while time.monotonic() < deadline:
response = requests.get(f"{API}/v1/tasks/{task_id}", headers=HEADERS, timeout=30)
if response.status_code == 429 or response.status_code >= 500:
time.sleep(int(response.headers.get("Retry-After", 10)))
continue
response.raise_for_status()
task = response.json()["data"]
if task["status"] in ("succeeded", "failed"):
return task
time.sleep(task.get("poll_after_seconds", 5))
raise TimeoutError(f"task {task_id} is still running; keep polling later")
task = create_task({
"model": "minimax-h3-image",
"prompt": "A minimalist product photo of a glass water bottle on wet black stone, soft rim light, shallow depth of field",
"aspect_ratio": "3:2",
"resolution": "2K"
})
print("created", task["id"])
task = wait_for_task(task["id"])
if task["status"] == "failed":
raise SystemExit(f"{task['error_code']}: {task['error_message']}")
for item in task["output"]["media"]:
print(item["url"])

计费

  • 按 token 计费,单价见下表(每 100 万 token):文本输入(提示词,含 MiniMax 的提示词增强)、图片输入(images 中的参考图)和图片输出。token 由模型统计;resolution 或 size、提示词和参考图都会改变 token 数。
  • 单张价格是每个 resolution 在没有参考图时渲染一次的估算价,按 3,000 个文本 token 和上表中的输出 token 计算。1K 与 2K 的输出 token 相同,所以估算价相同。
  • 创建任务时,会从你的余额(以及密钥的额度,如果设置了)中预留该档位的估算价。任务成功后,按这次渲染实际使用的 token 结算,所以最终的 data.usage 可能与预留不同。任务创建之前就被拒绝的请求不收费。
  • 失败的任务全额退款。

当前牌价,与价格页一致。享有协商折扣的账户实付更低;任务的 data.usage 始终显示实际扣费金额。

选项牌价(美元)
1 张图片 · 1K · 按实测 token 估算$0.015725
1 张图片 · 2K · 按实测 token 估算$0.015725
1 张图片 · 4K · 按实测 token 估算$0.048411
文本输入 · 每 100 万 tokens$1.61
图片输入 · 每 100 万 tokens$1.05
图片输出 · 每 100 万 tokens$2.66

常见错误

错误或现象原因处理方式
400 "size" already fixes the output; do not send "resolution" with itsize 与 resolution 或 aspect_ratio 同时传了,即使后者是默认值。只传 size,或者传 resolution 和 aspect_ratio 而不传 size。
400 "size" must have between 655,360 and 20,000,000 pixels; 512x512 has 262,144画幅的像素太少或太多。让总像素保持在 655,360 到 20,000,000 之间。
400 "size" must not be wider or taller than 3:1长边超过了短边的 3 倍。使用不超过 3:1 的画幅,例如 3000x1000。
400 "resolution" must be one of: [1K 2K 4K]小写的 2k、8K,或在 resolution 里写了像素尺寸,例如 2048x2048。传 1K、2K 或 4K,或用 size 字段指定像素。
400 "output_format" must be one of: [png jpeg webp]传了 gif、jpg 或其他文件类型。传 png、jpeg 或 webp,或不传该字段(默认 png)。
400 field "background" is not supported by model minimax-h3-image传了其他图片模型的字段(background、quality、seed、enhance_prompt)。删除该字段。
400 unknown field: n想在一个任务里生成多张图片。删除 n,每张图片创建一个任务。
400 "images[0]" must be a public HTTPS URL传了 http:// 链接、data: URI 或本地路径。把文件放到 HTTPS 上,或用 POST /v1/files 上传并使用 data.url。
400 "images[1]" is not a PNG, JPEG or WebP image: the URL returned text/html链接打开的是网页、登录页或已过期的签名链接,而不是文件。直接链接到图片文件。
400 "images[0]" could not be downloaded: the URL returned HTTP 403主机屏蔽了服务器下载(防盗链或私有存储桶)。把文件设为公开,或用 POST /v1/files 上传。
实际收费与单张价格不同收费按这次渲染实际使用的 token 结算;单张价格只是估算价。读取已完成任务的 data.usage。
任务以 content_policy_violation 失败提示词、参考图或生成的图片被内容审核拒绝。修改提示词或图片。原样重试仍会失败;不收费。
任务以 processing_timeout 失败图片没有在处理时限内完成。重试;失败的任务已退款。

HTTP 错误速查

任务生成之前的错误会以非 2xx 响应返回,不扣费。请根据 error.code 或 error.retryable 判断处理方式;message 会指出问题所在。完整列表和重试策略见错误码。

{
"error": {
"code": "bad_request",
"message": "\"prompt\" is required",
"retryable": false,
"request_id": "req_5f0c2a9e4b7d4e31"
}
}
HTTP 状态码error.code处理方式
400bad_request, content_policy_violation修改请求;message 会点名出错的字段。不要原样重试。
401missing_api_key, invalid_api_key(旧版客户端可能看到 unauthorized)以 Authorization: Bearer <key> 发送有效的密钥。
402insufficient_credits充值,或提高密钥的额度,然后重新发送。
403forbidden该密钥或账户不能使用此模型(例如免费额度只覆盖部分模型)。不要原样重试。
404not_found在 GET /v1/tasks/{task_id} 上:该任务在此密钥所属账户下不存在。请检查 ID。
409idempotency_conflict换一个新的 Idempotency-Key,或等待使用该键的第一个请求完成。
429rate_limit_exceeded等待 Retry-After 秒(也见 error.retry_after_seconds)后重试。
500internal_error退避重试;若持续出现,请带上 request_id 联系支持。
503processing_unavailable, processing_timeout, processing_failed, result_transfer_failed未扣费。使用指数退避重试。

身份验证

AuthorizationBearer

通过 Authorization: Bearer <BEATAPI_API_KEY> 发送 API 密钥。

请求头

Idempotency-Keystring可选<=255 characters

请求体使用 JSON,并设置 Content-Type: application/json。Idempotency-Key 为可选:每个逻辑请求发送一个唯一值(最长 255 个字符),仅在重试完全相同的请求体时复用。24 小时内,用相同的键和请求体重试会再次返回第一次的响应,并带上 Idempotent-Replayed: true;相同的键搭配不同的请求体则返回 409 idempotency_conflict。非 2xx 的响应不会被保存,因此 400 或 402 之后的重试会重新执行。

请求

This endpoint expects an object.
modelenum必需

要运行的模型。

取值:minimax-h3-image

取值有误时

  • 缺失:"model" is required
  • 未知的模型 ID:"model" minimax-image-9 is not catalogued
  • 把视频模型发到了这个接口:"model" seedance-2.5 is served by POST /v1/videos/tasks, not this endpoint
允许的值:
promptstring必需1-5000 characters

要画什么,或要如何修改参考图。用平实的语言效果最好:主体、风格、光线、构图,以及必须出现在图中的文字。

长度:1–5000 个字符

  • 长度按字符计算(一个中日韩字符算一个)。
  • 传了 images 时,请说明每张图的用途,例如「产品用第一张图,背景用第二张图」。
  • MiniMax 的提示词增强对每个订单都会开启。它会给输入增加文本 token,按文本输入的单价计费。

取值有误时

  • 缺失:"prompt" is required
  • 为空或超过长度上限:"prompt" has an unsupported length
  • 不是字符串:"prompt" must be a string
aspect_ratioenum可选默认为 auto

图片的宽高比,格式为宽:高。与 resolution 一起传;或者两者都不传,改传 size。

可选值:auto, 1:1, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 2:1, 1:2, 3:1, 1:3, 21:9, 9:21

默认值:auto

  • 默认值是 auto:由模型根据提示词和参考图(如果有)决定画幅。需要特定形状时请明确写出比例。
  • 支持全景比例 2:1、1:2、3:1、1:3、21:9 和 9:21。最宽或最高的画幅是 3:1。
  • 不能与 size 同时使用。

取值有误时

  • 取值不在列表中:"aspect_ratio" must be one of: [auto 1:1 3:2 2:3 4:3 3:4 5:4 4:5 16:9 9:16 2:1 1:2 3:1 1:3 21:9 9:21]
  • 与 size 同时传:"size" already fixes the output; do not send "aspect_ratio" with it
imageslist of strings可选

要编辑或合成的参考图。传了这个字段,请求就从文生图变为图片编辑。

数量:1–16

每一项都必须是公网 https:// 链接。本地文件请先上传(POST /v1/files),再传入返回的 data.url。

  • 每个链接必须通过公网 HTTPS 直接返回图片文件本身(PNG、JPEG 或 WebP),不超过 50 MB。网关在创建任务前会下载每个链接的开头字节,并根据这些字节识别类型,而不是看文件名或 Content-Type。
  • 指向网页、登录页、已过期的签名链接或有防盗链的主机的链接会被拒绝,因为它们不会返回图片。
  • 报错信息里的序号从 0 开始:images[0] 是第一个链接。
  • 参考图按图片输入计费,有各自的每 100 万 token 单价(见价格)。

取值有误时

  • 超过上限:"images" accepts at most 16 items
  • 空数组:"images" requires at least 1 item
  • 不是 https:// 链接:"images[0]" must be a public HTTPS URL
  • 私有或不安全的地址:"images[0]" must be a publicly reachable HTTPS image URL
  • 主机返回 4xx 错误:"images[0]" could not be downloaded: the URL returned HTTP 404
  • 链接返回的不是 PNG、JPEG 或 WebP:"images[0]" is not a PNG, JPEG or WebP image: the URL returned text/html
  • 超过 50 MB:"images[2]" is 63.4 MB; images must be 50 MB or smaller

示例

"images": [
  "https://cdn.beatapi.io/samples/smart-bottle.png",
  "https://cdn.beatapi.io/samples/neon-singer.png"
]
output_formatenum可选默认为 png

图片的文件类型:png、jpeg 或 webp。

可选值:png, jpeg, webp

默认值:png

  • 默认值是 png。
  • 格式不影响价格。
  • 存储文件的类型请读取输出里的 mime_type。

取值有误时

  • 取值不在列表中:"output_format" must be one of: [png jpeg webp]

示例

"output_format": "webp"
允许的值:
resolutionenum可选默认为 4K

图片的尺寸档位:1K、2K 或 4K。档位越高图片越大;具体像素尺寸取决于 aspect_ratio,由模型决定。

可选值:1K, 2K, 4K

默认值:4K

  • 不传这个字段时使用 4K。
  • 1K 与 2K 的输出 token 相同,所以价格也相同。4K 的输出 token 约为它们的四倍,价格更高(见价格)。
  • 请使用大写的 K:2k 会被拒绝。
  • 本页不承诺每个档位的确切像素尺寸。需要确切画幅时请传 size。
  • 不能与 size 同时使用,size 自带尺寸。

取值有误时

  • 取值不在列表中:"resolution" must be one of: [1K 2K 4K]
  • 与 size 同时传:"size" already fixes the output; do not send "resolution" with it
允许的值:
sizestring可选格式: "image-size"

以像素为单位的精确输出画幅,格式为 宽x高,例如 2720x1536。它取代 resolution 和 aspect_ratio。

  • 总像素必须在 655,360 到 20,000,000 之间,长边不超过短边的 3 倍。对边长没有倍数要求。
  • 画幅按所传的值精确渲染,不会取整。
  • 分隔符可以是 x、X 或 ×;两侧的空格会被忽略。
  • 计费跟随渲染实际使用的 token:画幅越大,输出 token 越多,价格越高(见价格)。
  • 不要同时传 resolution 或 aspect_ratio,即使是默认值也不行。

取值有误时

  • 不是字符串:"size" must be a string
  • 不是 宽x高 的形式(单个数字、auto、逗号):"size" must be WIDTHxHEIGHT in pixels, for example 2720x1536
  • 像素太少或太多:"size" must have between 655,360 and 20,000,000 pixels; 512x512 has 262,144
  • 宽高比超过 3:1:"size" must not be wider or taller than 3:1
  • 与 resolution 同时传:"size" already fixes the output; do not send "resolution" with it
  • 与 aspect_ratio 同时传:"size" already fixes the output; do not send "aspect_ratio" with it

示例

"size": "2720x1536"

响应

任务对象。任务成功之前 output 为 null。标注“运行中”的字段会在任务结束后消失。

错误

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
409
Conflict Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error