Generowanie obrazów za pomocą Grok
Generuj obrazy za pomocą Grok, używając żądań JSON, ustawień proporcji obrazu, ustawień rozdzielczości oraz danych wyjściowych URL lub Base64.
application/json.
Żądanie obsługuje model, prompt, n, aspect_ratio, resolution i response_format.
Wybierz model
Wybierz identyfikator modelu obrazu Grok na stronie modeli. Przykłady API używajągrok-imagine-image-quality.
Skonfiguruj dane wyjściowe
- Użyj
aspect_ratio, aby wybrać format danych wyjściowych, lubauto, aby pozwolić modelowi wybrać format. - Użyj
resolution, aby zażądać danych wyjściowych1klub2k. - Użyj
n, aby zażądać maksymalnie 10 obrazów. - Użyj
response_format, aby zwrócić tymczasowe adresy URL lub dane obrazu zakodowane w Base64.
Autoryzacje
Use your CometAPI API key as the bearer value.
Treść
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