跳轉到主要內容
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 或 Base64 圖片資料 URI,大小上限為 5 MB。Prompt 可接受 1 至 1,000 個 UTF-16 編碼單元。

選擇尺寸

將 ratio 設為 schema 中其中一組完全相符的尺寸組合。例如, 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日