GET
/v1/schemas/grok/chat/v1/chat/completions?kind=output
Accept:
| field | recorded source |
|---|---|
| schema | Source linked above. upstream-spec Source trace9d3bba5a4bc352e14d619266f397ca689140f67989db997818ba2747dfb0765b{
"fetchedAt": 1790226635,
"extractorVersion": "1",
"verifiedAt": null
} |
Response body
10 properties · 6 required · 13 $defs| property | type | description | constraints |
|---|---|---|---|
| choices* | Choice[] | A list of response choices from the model. The length corresponds to the `n` in request body (default to 1). | |
| created* | integer | The chat completion creation time in Unix timestamp. | format: int64 |
| id* | string | A unique ID for the chat response. | |
| model* | string | Model ID used to create chat completion. | |
| object* | string | The object type, which is always `"chat.completion"`. | |
| service_tier* | enum | The processing tier used for this request. | default | priority | fast |
| citations | any | List of all the external pages used by the model to answer. | |
| output_files | any | Files generated during the response (e.g., by the code execution tool). Only populated when `code_execution_files_output` is included. | |
| system_fingerprint | any | System fingerprint, used to indicate xAI system configuration changes. | |
| usage | Usage | Token usage information. | nullable |
Types
13 $defsChoiceobject
| finish_reason | any | Finish reason. `"stop"` means the inference has reached a model-defined or user-supplied stop sequence in `stop`. `"length"` means the inference result has reached models' maximum allowed token length or user defined value in `max_tokens`. `"end_turn"` or `nul… | |
| index* | integer | Index of the choice within the response choices, starting from 0. | format: int32 |
| logprobs | LogProbs | The log probabilities of each output token returned in the content of message. | nullable |
| message* | ChoiceMessage | The generated chat completion message. |
ChoiceMessageobject
| content | any | The content of the message. | |
| reasoning_content | any | The reasoning trace generated by the model. | |
| refusal | any | The reason given by model if the model is unable to generate a response. null if model is able to generate. | |
| role* | string | The role that the message belongs to, the response from model is always `"assistant"`. | |
| tool_calls | any | A list of tool calls asked by model for user to perform. |
CompletionUsageDetailobject
Details of completion usage.
| accepted_prediction_tokens* | integer | The number of tokens in the prediction that appeared in the completion. | format: int32 |
| audio_tokens* | integer | Audio input tokens generated by the model. | format: int32 |
| reasoning_tokens* | integer | Tokens generated by the model for reasoning. | format: int32 |
| rejected_prediction_tokens* | integer | The number of tokens in the prediction that did not appear in the completion. | format: int32 |
Functionobject
| arguments* | string | ||
| name* | string |
LogProbsobject
| content | any | An array the log probabilities of each output token returned. |
OutputFileobject
A file generated during the model's response (e.g., by the code execution tool).
| file_id* | string | The file ID from the Files API. Use this to download the file. | |
| name* | string | The display name of the file. |
PromptUsageDetailobject
Details of prompt usage.
| audio_tokens* | integer | Audio prompt token used. | format: int32 |
| cached_tokens* | integer | Token cached by xAI from previous requests and reused for this request. | format: int32 |
| image_tokens* | integer | Image prompt token used. | format: int32 |
| text_tokens* | integer | Total text prompt token used (cached + non-cached text tokens). | format: int32 |
ServerSideToolUsageDetailsobject
| code_interpreter_calls* | integer | Number of code interpreter calls. | format: int32 |
| document_search_calls* | integer | Number of document search calls. | format: int32 |
| file_search_calls* | integer | Number of file search calls. | format: int32 |
| image_generation_calls* | integer | Number of image generation calls. | format: int32 |
| mcp_calls* | integer | Number of MCP calls. | format: int32 |
| web_search_calls* | integer | Number of web search calls. | format: int32 |
| x_posts_fetched* | integer | Number of X posts fetched across all X search calls, including nested parent/quote posts and every post of a fetched thread, without de-duplication. X search is billed per fetched item. | format: int32 |
| x_search_calls* | integer | Number of X search calls. | format: int32 |
| x_users_fetched* | integer | Number of X user profiles fetched across all X search calls, without de-duplication. X search is billed per fetched item. | format: int32 |
ServiceTierenum
Processing tier for a request. `Fast` and `Priority` are interchangeable: the model's fast deployment and its rates where configured, else higher scheduling priority at a higher price.
default | priority | fast
TokenLogProbobject
| bytes | any | The ASCII encoding of the output character. | |
| logprob* | number | The log probability of returning this token. | format: float |
| token* | string | The token. | |
| top_logprobs* | TopLogProb[] | An array of the most likely tokens to return at this token position. |
ToolCallobject
| function* | Function | Function to call for the tool call. | |
| id* | string | A unique ID of the tool call generated by xAI. After performing tool call's function, user provides this ID with tool call's result in the subsequent request to xAI. xAI can then match the tool call result sent with tool call request. | |
| index | any | Index of the tool call. | format: int32 |
| type | any | Type of tool call, should be `"function"` or `"web_search_call"` or `"x_search_call"` or `"code_interpreter_call"` or `"mcp_call"` |
TopLogProbobject
| bytes | any | The ASCII encoding of the output character. | |
| logprob* | number | The log probability of returning this token. | format: float |
| token* | string | The token. |
Usageobject
| completion_tokens* | integer | Total completion token used. | format: int32 |
| completion_tokens_details* | CompletionUsageDetail | Breakdown of completion token usage of different types. | |
| cost_in_usd_ticks* | integer | Accurate cost of this request in USD ticks, where "tick" is defined as follows: TICKS_IN_USD_CENT: i64 = 100_000_000 which means there is 10'000'000'000 ticks in one *dollar*. | format: int64 |
| num_sources_used* | integer | Number of individual live search source used. | format: int32 |
| prompt_tokens* | integer | Total prompt token used. | format: int32 |
| prompt_tokens_details* | PromptUsageDetail | Breakdown of prompt token usage of different types. | |
| server_side_tool_usage_details | ServerSideToolUsageDetails | Details about the server side tool usage. | nullable |
| total_tokens* | integer | Total token used, the sum of prompt token and completion token amount. | format: int32 |
Validate a payload
before you spend tokensshell
$ curl -X POST https://modelschemas.com/v1/validate \
-d '{"provider":"grok","endpointId":"v1/chat/completions","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}