GET
/v1/schemas/grok/chat/v1/completions?kind=output
Accept:
| field | recorded source |
|---|---|
| schema | Source linked above. upstream-spec Source trace04a3a2d03a8279009e24e16710d4f54931867b30702aaf837fc0cb7d66838967{
"fetchedAt": 1789881070,
"extractorVersion": "1",
"verifiedAt": null
} |
Response body
7 properties · 5 required · 5 $defs| property | type | description | constraints |
|---|---|---|---|
| choices* | SampleChoice[] | 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 | ID of the request. | |
| model* | string | Model to be used. | |
| object* | string | Object type of the response. This is always `"text_completion"`. | |
| system_fingerprint | any | System fingerprint, used to indicate xAI system configuration changes. | |
| usage | Usage | Token usage information. | nullable |
Types
5 $defsCompletionUsageDetailobject
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 |
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 |
SampleChoiceobject
| finish_reason* | string | 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. | format: int32 |
| text* | string | Text response. |
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 |
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/completions","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}