xAI Grok Models
xAI models use canonical model IDs under xai/.... Text models use /v1/responses; image, video, and voice models use their dedicated gateway endpoints.
LLMTR sends store:false for xAI text models and rejects store:true, previous_response_id, and xAI server-side tools. xAI may retain API requests and responses for 30 days for audit/security purposes; LLMTR does not store prompt/response content in its own DB. When xAI reports the actual cost for a request, billing follows that cost.
Public text models:
| Model | Endpoint | Notes |
|---|---|---|
xai/grok-4.7 |
/v1/responses |
Newest flagship. Text+image input, function calling, structured outputs, and low/medium/high/xhigh reasoning. Default effort is high; 500K context. |
xai/grok-4.6 |
/v1/responses |
Previous generation. Text+image input, function calling, structured outputs, and low/medium/high/xhigh reasoning. Default effort is high; 500K context. |
xai/grok-4.5 |
/v1/responses |
Text+image input, function calling, structured outputs, and low/medium/high reasoning. Default effort is high; 500K context. |
xai/grok-4.3 |
/v1/responses |
Long-context text model. |
xai/grok-4.20-multi-agent |
/v1/responses |
reasoning.effort controls agent count; high/xhigh may cost more. |
xai/grok-4.20-0309-reasoning |
/v1/responses |
Long-context reasoning model. |
xai/grok-4.20-0309-non-reasoning |
/v1/responses |
Text work that does not need reasoning. |
curl "$LLMTR_BASE_URL/v1/responses" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-4.3", "input": "Simplify a TypeScript service function." }'Grok 4.7 and Grok 4.6 support the :low, :medium, :high, and :max suffixes, where :max maps to xAI's xhigh effort. Grok 4.5 accepts only :low, :medium, and :high. Without a suffix, LLMTR makes the provider default explicit and sends high; reasoning cannot be disabled on these models. xAI does not support stop, presence_penalty, or frequency_penalty on its reasoning models, so the gateway rejects those fields with 400.
curl "$LLMTR_BASE_URL/v1/responses" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-4.7:medium", "input": [ { "role": "user", "content": [ { "type": "input_text", "text": "Summarize the error flow in this screenshot." }, { "type": "input_image", "image_url": "https://example.com/screenshot.png" } ] } ] }'For the multi-agent model, use a suffix or body field:
curl "$LLMTR_BASE_URL/v1/responses" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-4.20-multi-agent:high", "input": "Evaluate this architecture decision across cost, risk, and maintenance." }'xai/grok-imagine-image is cataloged at $0.02 per image, and xai/grok-imagine-image-quality at $0.05 per image. xai/grok-imagine-image-2.0 is priced by quality and resolution:
quality |
1k |
2k |
|---|---|---|
low |
$0.04 |
$0.06 |
medium |
$0.06 |
$0.08 |
The quality field applies only to xai/grok-imagine-image-2.0 and takes low, medium, or auto. auto is the default and currently runs low for generation and medium for edits; you are billed for the quality served. On this model, a /v1/images/edits request also adds $0.01 per source image.
When xAI reports the actual cost, that cost is used; when it does not, the per-image price above applies. For xai/grok-imagine-image and xai/grok-imagine-image-quality image edits, xAI bills both the images you send and the images produced, so both are counted.
curl "$LLMTR_BASE_URL/v1/images/generations" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-imagine-image", "prompt": "A clean product photo of a copper desk lamp", "aspect_ratio": "16:9", "resolution": "1k", "response_format": "url", "n": 1 }'Image edit:
curl "$LLMTR_BASE_URL/v1/images/edits" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-imagine-image", "prompt": "Render this image as a pencil sketch.", "image": { "url": "https://example.com/source.jpg" }, "aspect_ratio": "1:1", "response_format": "url" }'For multi-image edits, send up to 5 inputs in images.
xai/grok-imagine-video is priced at $0.05 per second at 480p and $0.07 at 720p. The gateway starts the async xAI video request and polls until the result is ready.
curl "$LLMTR_BASE_URL/v1/video/generations" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-imagine-video", "prompt": "A calm time-lapse of clouds over a mountain ridge", "duration_seconds": 5, "aspect_ratio": "16:9", "resolution": "480p", "max_wait_seconds": 120 }'xai/grok-imagine-video-1.5 and xai/grok-imagine-video-1.5-lite generate video with sound from a text prompt or a starting frame. Prices, resolutions, and image_url usage are on the Video Generation page.
The TTS model is xai/grok-voice-tts; the REST STT model is xai/grok-voice-stt. Streaming STT and realtime voice are not public in this phase.
curl "$LLMTR_BASE_URL/v1/audio/speech" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-voice-tts", "input": "Hello, this is a Grok Voice TTS example.", "voice": "eve", "language": "en" }' \ --output voice.mp3STT accepts base64 audio in the JSON body. Because billing is per hour of audio, sending duration_seconds for short files reduces the preflight hold.
curl "$LLMTR_BASE_URL/v1/audio/transcriptions" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-voice-stt", "audio_base64": "<base64 mp3>", "audio_format": "mp3", "language": "en", "format": true, "duration_seconds": 12 }'Cost Safety
Section titled “Cost Safety”- For text/image/video, LLMTR uses xAI
cost_in_usd_tickswhen it is returned. xai/grok-4.7andxai/grok-4.6are cataloged at official prices: input$2/1M, cached input$0.50/1M, and output$6/1M; billing still follows the actual cost xAI reports.xai/grok-4.5is cataloged at official prices: input$2/1M, cached input$0.30/1M, and output$6/1M.- Once a prompt reaches 200K tokens, xAI bills the whole request (input, cached input, and output) at double the rate; this applies to every Grok text model. For
xai/grok-4.7that tier is input$4/1M, cached input$1/1M, and output$12/1M. Your balance is checked against this tier before the request is sent. - xAI adds a fixed prefix of its own to every request, and it shows up in
usage.input_tokens. On Grok 4.7 even a short request reports about 1.2K input tokens; most of them are billed at the cached input price. - Image and video fall back to the official fixed prices only when xAI does not report an actual cost.
- TTS is calculated from input characters; STT is calculated from provider response
duration. - xAI server-side tools, files/collections, streaming STT, and realtime voice are not public.