Tạo hình ảnh bằng Grok
Tạo hình ảnh Grok bằng các yêu cầu JSON, tùy chọn kiểm soát tỷ lệ khung hình, độ phân giải và đầu ra URL hoặc Base64.
application/json.
Yêu cầu hỗ trợ model, prompt, n, aspect_ratio, resolution và response_format.
Chọn một mô hình
Chọn một ID mô hình hình ảnh Grok từ trang Models. Các ví dụ API sử dụnggrok-imagine-image-quality.
Cấu hình đầu ra
- Dùng
aspect_ratiođể chọn hình dạng đầu ra hoặc dùngautođể mô hình tự chọn hình dạng. - Dùng
resolutionđể yêu cầu đầu ra1khoặc2k. - Dùng
nđể yêu cầu tối đa 10 hình ảnh. - Dùng
response_formatđể trả về URL tạm thời hoặc dữ liệu hình ảnh được mã hóa Base64.
Ủy quyền
Use your CometAPI API key as the bearer value.
Nội dung
The Grok image model ID. See the Models page for available model IDs.
grok-imagine-image, grok-imagine-image-quality "grok-imagine-image-quality"
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.
1k, 2k "1k"
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