Seedream4.0 文生图
接口
POST /images/generations
完整 URL: https://modelfold.ai/v1/images/generations
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
模型参数直接放在 JSON 请求体中,不要套 input。请求等待生成完成后返回 data[].url;支持的媒体模型也可使用 异步创建、轮询及回调。示例素材地址须替换为自己的公开可访问文件。计费及错误说明见 API 网关。
生成任务的输入参数
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 用于生成任务的模型名称。必填字段。 - 该端点必须使用 bytedance/seedream-v4-text-to-image 模型 默认值:"bytedance/seedream-v4-text-to-image"。 可选值:bytedance/seedream-v4-text-to-image。 示例:bytedance/seedream-v4-text-to-image。 |
prompt | string | 是 | 本站网关要求传入 prompt,最长 2000 字。用于生成图像的文本提示词(最大长度:5000 字符) maxLength: 2000. 示例:在黑板上绘制下列二元一次方程组及对应的解题步骤:5x + 2y = 26;2x - y = 5。 |
image_size | string | 否 | 生成图像的尺寸规格 默认值:"square_hd"。 可选值:square / square_hd / portrait_4_3 / portrait_3_2 / portrait_16_9 / landscape_4_3 / landscape_3_2 / landscape_16_9 / landscape_21_9。 示例:square_hd。 |
image_resolution | string | 否 | 最终图像分辨率由 image_size(宽高比)和 image_resolution(像素尺度)共同决定。 默认值:"1K"。 可选值:1K / 2K / 4K。 示例:1K。 |
seed | integer | 否 | 随机种子,用于复现结果。整数,最大 1000000。不传则随机。 maximum: 1000000. |
nsfw_checker | boolean | 否 | 默认 false。为 false 时不额外进行内容过滤,结果由模型直接返回。 |
请求示例
bash
curl -X POST "https://modelfold.ai/v1/images/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "bytedance/seedream-v4-text-to-image",
"prompt": "在黑板上绘制下列二元一次方程组及对应的解题步骤:5x + 2y = 26;2x - y = 5",
"image_size": "square_hd",
"image_resolution": "1K"
}'json
{
"model": "bytedance/seedream-v4-text-to-image",
"prompt": "在黑板上绘制下列二元一次方程组及对应的解题步骤:5x + 2y = 26;2x - y = 5",
"image_size": "square_hd",
"image_resolution": "1K"
}响应
200 — 生成完成。usage 返回实际计费明细;结果地址仅作结构示例。
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.png"
}
],
"usage": {}
}