Skip to main content
POST
이 경로를 사용하여 Grok 이미지 모델로 하나 이상의 이미지를 편집하세요. 요청 본문은 application/json을 사용합니다.

이미지 입력 제공

  • image 또는 images 중 정확히 하나를 전송하세요.
  • 소스 이미지 하나에는 image을 사용하세요.
  • 소스 이미지가 두 개 또는 세 개인 경우 images을 사용하세요.
  • 각 이미지 객체에서 공개 URL 또는 data URI에는 url을 사용하세요. image_urlurl의 호환성 별칭입니다.
  • 다중 이미지 편집의 출력 형태를 제어하려면 aspect_ratio을 사용하세요.
Grok 이미지 모델 ID를 선택하려면 모델 페이지를 참조하세요. API 예시에서는 grok-imagine-image-quality을 사용합니다.
Grok 이미지 편집 요청은 JSON으로 전송하세요. 멀티파트 폼 데이터는 이 요청 형식을 나타내지 않습니다.
OpenAI SDK의 images.edit() 메서드는 멀티파트 폼 데이터를 전송합니다. Grok JSON 이미지 편집에는 직접 HTTP 요청을 사용하세요. 공급자 파라미터 세부정보는 xAI 이미지 편집 가이드를 참조하세요.

인증

Authorization
string
header
필수

Use your CometAPI API key as the bearer value.

본문

application/json
model
enum<string>
필수

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

사용 가능한 옵션:
grok-imagine-image,
grok-imagine-image-quality
예시:

"grok-imagine-image-quality"

prompt
string
필수

A text instruction that describes the requested edit.

Minimum string length: 1
예시:

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

image
object
필수

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
기본값:1

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

필수 범위: 1 <= x <= 10
aspect_ratio
enum<string>

The 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"

resolution
enum<string>

The requested output resolution.

사용 가능한 옵션:
1k,
2k
예시:

"1k"

response_format
enum<string>
기본값:url

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

응답

200 - application/json

The edited image results.

data
object[]
필수

The edited images.

Minimum array length: 1
usage
object
필수

Usage details for the request.