Skip to main content
POST
이 경로를 사용하여 Grok 이미지 모델로 텍스트에서 이미지를 생성합니다. 요청 본문에는 application/json을 사용합니다. 요청은 model, prompt, n, aspect_ratio, resolutionresponse_format을 지원합니다.

모델 선택

Grok 이미지 모델 ID는 모델 페이지에서 선택하세요. API 예시에서는 grok-imagine-image-quality을 사용합니다.

출력 구성

  • 출력 형상을 선택하려면 aspect_ratio을 사용하고, 모델이 형상을 선택하도록 하려면 auto을 사용하세요.
  • resolution을 사용하여 1k 또는 2k 출력을 요청하세요.
  • n을 사용하여 최대 10개의 이미지를 요청하세요.
  • response_format을 사용하여 임시 URL 또는 Base64로 인코딩된 이미지 데이터를 반환하세요.
제공업체 매개변수에 대한 자세한 내용은 xAI 이미지 생성 가이드를 참조하세요..
요청이 완료된 후 URL 결과를 다운로드하세요. 생성된 이미지 URL은 만료될 수 있습니다.

인증

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 description of the image to generate.

Minimum string length: 1
예시:

"A glass observatory above a quiet alpine lake at sunrise"

n
integer
기본값:1

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

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

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

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 generated image results.

data
object[]
필수

The generated images.

Minimum array length: 1
usage
object
필수

Usage details for the request.