Skip to main content
POST
Grok image modelleriyle bir veya daha fazla görseli düzenlemek için bu route’u kullanın. İstek gövdesi application/json kullanır.

Görsel girdisi sağlayın

  • Tam olarak image veya images gönderin.
  • Tek bir kaynak görsel için image kullanın.
  • İki veya üç kaynak görsel için images kullanın.
  • Her image nesnesinde, herkese açık bir URL veya data URI için url kullanın. image_url, url için bir uyumluluk takma adıdır.
  • Çoklu görsel düzenlemelerinde çıktı şeklini kontrol etmek için aspect_ratio kullanın.
Bir Grok image model ID’sini Models sayfasından seçin. API örneklerinde grok-imagine-image-quality kullanılır.
Grok image edit isteklerini JSON olarak gönderin. Multipart form data, bu istek biçimini temsil etmez.
OpenAI SDK’sındaki images.edit() yöntemi multipart form data gönderir. Grok JSON image edit işlemleri için doğrudan bir HTTP isteği kullanın. Sağlayıcı parametresi ayrıntıları için şu kılavuza bakın: xAI image editing kılavuzu.

Yetkilendirmeler

Authorization
string
header
gerekli

Use your CometAPI API key as the bearer value.

Gövde

application/json
model
enum<string>
gerekli

The Grok image model ID. See the Models page for available model IDs.

Mevcut seçenekler:
grok-imagine-image,
grok-imagine-image-quality
Örnek:

"grok-imagine-image-quality"

prompt
string
gerekli

A text instruction that describes the requested edit.

Minimum string length: 1
Örnek:

"Replace the daytime sky with a soft sunset and preserve the building"

image
object
gerekli

One source image. Use this field instead of images.

images
object[]

Two or three source images. Use this field instead of image.

Required array length: 2 - 3 elements

A source image represented by url or the compatibility alias image_url.

n
integer
varsayılan:1

The number of edited images to generate. Use an integer from 1 through 10.

Gerekli aralık: 1 <= x <= 10
aspect_ratio
enum<string>

The output shape for a multi-image edit.

Mevcut seçenekler:
1:1,
3:4,
4:3,
16:9,
2:3,
3:2,
9:19.5,
19.5:9,
9:20,
20:9,
1:2
Örnek:

"16:9"

resolution
enum<string>

The requested output resolution.

Mevcut seçenekler:
1k,
2k
Örnek:

"1k"

response_format
enum<string>
varsayılan:url

The image representation in each response item. Use url for a temporary download URL or b64_json for Base64-encoded image bytes.

Mevcut seçenekler:
url,
b64_json

Yanıt

200 - application/json

The edited image results.

data
object[]
gerekli

The edited images.

Minimum array length: 1
usage
object
gerekli

Usage details for the request.