跳转到主要内容
POST
使用此端点可根据 Prompt 生成图像,并可选择提供参考 图像,用于 gen4_image。请通过 Bearer 身份验证发送您的 CometAPI API 密钥 以及 JSON 请求正文。

选择模型和参考图像

每个请求都需要 model、promptText 和 ratio。 对于 gen4_image_turbo,referenceImages 为必填项,且必须包含一到 三张图像。每个参考对象都包含图像 uri 和可选的 tag。请使用由 3 至 16 个小写字母、 数字或下划线组成且以字母开头的标签。在 promptText 中引用该标签 时使用 @tag,例如 @cat_ref。 图像 URI 可接受可访问的 HTTPS URL 或最大为 5 MB 的 Base64 图像数据 URI。Prompt 接受 1 到 1,000 个 UTF-16 代码单元。

选择尺寸

将 ratio 设置为架构中列出的任一精确尺寸对。例如, 1024:1024 会请求方形图像,1280:720 会请求横向图像,而 720:1280 会请求纵向图像。请使用 ratio 选择尺寸;请勿向这些模型发送 resolution 或 size。 如需指定采样种子,请使用 1 至 4294967295。省略该字段或使用 0 会选择随机种子。如果包含 contentModeration,请将其 publicFigureThreshold 设置为 auto 或 low;否则请省略该对象。

获取结果

保存返回的 id 并使用 获取 Runway 任务. 当 status 为 SUCCEEDED 时,请在 output 中读取生成的图像 URL。

授权

Authorization
string
header
必填

Use your CometAPI API key.

请求体

application/json

Request parameters for gen4_image.

model
enum<string>
必填

Model ID for this request variant.

可用选项:
gen4_image
Allowed value: "gen4_image"
promptText
string
必填

Describe the requested scene or motion in 1 to 1,000 UTF-16 code units.

Required string length: 1 - 1000
ratio
enum<string>
必填

Requested output dimensions, expressed as width:height. Choose a value listed for this model and endpoint.

可用选项:
1024:1024,
1080:1080,
1168:880,
1360:768,
1440:1080,
1080:1440,
1808:768,
1920:1080,
1080:1920,
2112:912,
1280:720,
720:1280,
720:720,
960:720,
720:960,
1680:720
seed
integer

Optional sampling seed. Use a positive integer for an explicit seed. Omission or 0 selects a random seed.

必填范围: 0 <= x <= 4294967295
referenceImages
object[]

Optional array of up to three reference images. Omit it or use an empty array for text-only generation.

Maximum array length: 3
contentModeration
object

Optional content moderation settings. Omit the object to use standard moderation.

响应

Task submitted. Save its id to retrieve task status.

id
string
必填

Task ID for GET /runwayml/v1/tasks/{id}.

status
string

Task state, when returned.

createdAt
string<date-time>

Task submission timestamp, when returned.

output
string<uri>[]

Result URLs, when returned.

failure
string

Failure explanation, when returned.

failureCode
string

Machine-readable failure code, when returned.

estimatedCost
object

Task estimate metadata, when returned.

cost
object

Task cost metadata, when returned.

最后修改于 2026年9月22日