xAI의 Grok Imagine 모델로 이미지를 생성합니다. Grok Imagine Video와 동일한 Grok Imagine 아키텍처를 공유하는 자매 모델로, 빠른 text-to-image 생성을 제공합니다.
콘솔의 Playground에서 별도 코드 없이 이 모델을 즉시 테스트할 수 있어요
이 모델의 사용법을 Claude, ChatGPT 등에 복사
curl -X POST "https://api.core.today/v1/predictions" \
-H "Content-Type: application/json" \
-H "X-API-Key: cdt_your_api_key" \
-d '{
"model": "xai/grok-imagine-image",
"input": {
"prompt": "A futuristic city skyline at sunset, flying vehicles, neon reflections on glass towers",
"aspect_ratio": "16:9"
}
}'| 파라미터 | 타입 | 필수 | 기본값 | 설명 |
|---|---|---|---|---|
prompt | string | Yes | - | 이미지 생성 또는 편집을 위한 텍스트 프롬프트입니다. |
image | string | No | - | 편집할 입력 이미지입니다. 제공되면 모델이 프롬프트를 기반으로 이 이미지를 편집합니다. jpg, jpeg, png, webp 형식을 지원합니다. |
aspect_ratio | string | No | 1:1 | 생성된 이미지의 종횡비입니다. 이미지를 편집할 때는 무시됩니다. 1:116:99:164:33:43:22:32:11:219.5:99:19.520:99:20auto |
이 모델의 image 파라미터에 파일을 전달하는 방법은 3가지입니다.
POST /v1/predictions/upload에 파일을 직접 첨부합니다. 별도 업로드 과정이 필요 없습니다.
curl -X POST "https://api.core.today/v1/predictions/upload" \
-H "X-API-Key: cdt_your_api_key" \
-F "model=xai/grok-imagine-image" \
-F 'input={"prompt":"your prompt here"}' \
-F "file:image=@your_file.png"공개 접근 가능한 URL을 직접 전달합니다. Storage API로 업로드한 파일의 file_url도 사용 가능합니다.
{
"model": "xai/grok-imagine-image",
"input": {
"prompt": "your prompt here",
"image": "https://example.com/image.jpg"
}
}POST /v1/predictions 요청 시 사용되는 공통 파라미터입니다.
| 파라미터 | 타입 | 필수 | 기본값 | 설명 |
|---|---|---|---|---|
model | string | Yes | - | 모델 식별자 |
input | object | Yes | - | 위 테이블의 모델별 파라미터를 포함하는 객체 |
output_folder | string | No | - | 결과물 저장 폴더 경로 (최대 256자, '..' 사용 불가) |
webhook_url | string | No | - | 완료 시 호출할 Webhook URL |
is_public | boolean | No | false | true 시 결과물을 영구 공개 URL로도 제공 |
텍스트 프롬프트만으로 16:9 종횡비의 새 이미지를 생성합니다.
curl -X POST "https://api.core.today/v1/predictions" \
-H "Content-Type: application/json" \
-H "X-API-Key: cdt_your_api_key" \
-d '{
"model": "xai/grok-imagine-image",
"input": {
"prompt": "A futuristic city skyline at sunset, flying vehicles, neon reflections on glass towers",
"aspect_ratio": "16:9"
}
}'업로드한 이미지를 프롬프트에 따라 편집합니다. 이때 aspect_ratio는 무시됩니다.
curl -X POST "https://api.core.today/v1/predictions" \
-H "Content-Type: application/json" \
-H "X-API-Key: cdt_your_api_key" \
-d '{
"model": "xai/grok-imagine-image",
"input": {
"prompt": "Change the background to a snowy mountain landscape",
"image": "https://example.com/input-photo.jpg"
}
}'