Grok으로 이미지 생성
Grok Imagine Image 2.0으로 이미지를 생성하고 품질, 종횡비, 해상도, 이미지 수, 응답 형식을 제어합니다.
application/json을 사용합니다.
model prompt도 필요합니다.
모델 선택
Grok 이미지 모델 ID를 Models 페이지에서 선택하세요. API 예제에서는grok-imagine-image-2.0을 사용합니다.
quality 은 grok-imagine-image-2.0에서만 사용할 수 있으며 low 또는 medium을 허용합니다. 애플리케이션이 특정 품질 수준에 의존하는 경우 명시적으로 설정하세요. Image 2.0에서 resolution을 생략하면 CometAPI는 1k을 사용합니다.
출력 구성
aspect_ratio을 사용하여 출력 형태를 선택하거나auto을 사용하여 모델이 형태를 선택하도록 합니다.resolution을 사용하여1k또는2k출력을 요청합니다.n을 사용하여 1개에서 10개의 이미지를 요청합니다. 기본값은1입니다.response_format을 사용하여 임시 URL 또는 Base64 인코딩 이미지 데이터를 반환합니다.
b64_json을 사용하세요.인증
Use your CometAPI API key as the bearer value.
본문
The Grok image model ID. See the Models page for available model IDs.
grok-imagine-image, grok-imagine-image-quality, grok-imagine-image-2.0 "grok-imagine-image-2.0"
A text description of the image to generate.
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. Image 2.0 uses 1k when this field is omitted.
1k, 2k "1k"
Image quality for grok-imagine-image-2.0. This field is not available for the older Grok image model IDs.
low, medium "low"
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