Grokで画像を編集
画像URLまたはdata URIをJSONリクエストで送信して、Grokで1枚以上の画像を編集します。
application/jsonを使用します。
画像入力を指定
imageまたはimagesのいずれか一方のみを送信します。- 1枚のソース画像には
imageを使用します。 - 2枚または3枚のソース画像には
imagesを使用します。 - 各画像オブジェクトでは、公開URLまたはdata URIに
urlを使用します。image_urlはurlの互換性エイリアスです。 - 複数画像編集の出力形式を制御するには
aspect_ratioを使用します。
grok-imagine-image-qualityを使用しています。
OpenAI SDKのimages.edit()メソッドはmultipart form dataを送信します。Grok JSON画像編集には直接HTTPリクエストを使用してください。
プロバイダーパラメータの詳細については、 xAI画像編集ガイドを参照してください。.承認
Use your CometAPI API key as the bearer value.
ボディ
- Option 1
- Option 2
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 instruction that describes the requested edit.
1"Replace the daytime sky with a soft sunset and preserve the building"
One source image. Use this field instead of images.
- Option 1
- Option 2
Two or three source images. Use this field instead of image.
2 - 3 elementsA source image represented by url or the compatibility alias image_url.
- Option 1
- Option 2
The number of edited images to generate. Use an integer from 1 through 10.
1 <= x <= 10The output shape for a multi-image edit.
1:1, 3:4, 4:3, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2 "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