Grok
Grok で画像を生成
JSON リクエスト、アスペクト比制御、解像度制御、URL または Base64 出力を使用して Grok 画像を生成します。
POST
このルートを使用して、Grok 画像モデルでテキストから画像を作成します。リクエスト本文では
application/json を使用します。
リクエストでは model、prompt、n、aspect_ratio、resolution、response_format をサポートしています。
モデルを選択
Grok 画像モデル ID は、 モデルページから選択します。API の例ではgrok-imagine-image-quality を使用します。
出力を設定
- 出力形状を選択するには
aspect_ratioを使用するか、モデルに形状を選択させるにはautoを使用します。 resolutionを使用して、1kまたは2k形式の出力をリクエストします。nを使用して、最大 10 枚の画像をリクエストします。response_formatを使用して、一時 URL または Base64 エンコードされた画像データを返します。
URL で返された結果は、リクエストの完了後にダウンロードしてください。生成された画像 URL は期限切れになる場合があります。
承認
Use your CometAPI API key as the bearer value.
ボディ
application/json
The Grok image model ID. See the Models page for available model IDs.
利用可能なオプション:
grok-imagine-image, grok-imagine-image-quality 例:
"grok-imagine-image-quality"
A text description of the image to generate.
Minimum string length:
1例:
"A glass observatory above a quiet alpine lake at sunrise"
The number of images to generate. Use an integer from 1 through 10.
必須範囲:
1 <= x <= 10The output shape. Use auto to let the model select the aspect ratio.
利用可能なオプション:
1:1, 3:4, 4:3, 9:16, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2, 2:1, auto 例:
"16:9"
The requested output resolution.
利用可能なオプション:
1k, 2k 例:
"1k"
The image representation in each response item. Use url for a temporary download URL or b64_json for Base64-encoded image bytes.
利用可能なオプション:
url, b64_json