GET
/v1/schemas/grok/chat/v1/messages
Accept:
| field | recorded source |
|---|---|
| schema | Source linked above. upstream-spec Source trace6910c22b5fda89bcef4649f7f3798b75198027b07a3553f7ad05ec62a3b2b210{
"fetchedAt": 1792559435,
"extractorVersion": "1",
"verifiedAt": null
} |
Request body
12 properties · 0 required · 12 $defs| property | type | description | constraints |
|---|---|---|---|
| max_tokens | integer | The maximum number of tokens to generate before stopping. The model may stop before the max_tokens when it reaches the stop sequence. | format: int32 |
| messages | MessageBody[] | Input messages. | |
| metadata | MessageMetadata | An object describing metadata about the request. | nullable |
| model | string | Model name for the model to use. | |
| stop_sequences | any | (Not supported by reasoning models) Up to 4 sequences where the API will stop generating further tokens. | |
| stream | any | If set, partial message deltas will be sent. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a `data: [DONE]` message. | |
| system | string | SystemMessagePart[] | System prompt message for the model, defining how the model should behave to user messages. | nullable |
| temperature | any | What sampling temperature to use, between 0 and 2. Values above 1 are sampled at 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. It may not work well with reasoning models. | 0 ≤ n ≤ 2 · format: float · default: 1 |
| tool_choice | object | object | object | Controls which (if any) tool is called by the model. `"none"` means the model will not call any tool and instead generates a message. `"auto"` means the model can pick between generating a message or calling one or more tools. `"any"` means the model must call… | nullable |
| tools | any | A list of tools the model may call in JSON-schema. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 1000 functions are supported. | |
| top_k | any | (Unsupported) When generating next tokens, randomly selecting the next token from the k most likely options. | format: int32 |
| top_p | any | An alternative to sampling with `temperature`, called nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. It is generally reco… | 0 < n ≤ 1 · format: float · default: 0.95 |
Types
12 $defsMessageBodyobject
Anthropic compatible message body
| content* | string | MessageContentPart[] | The content message. | |
| role* | string | The role that the message belongs to, `"system"` for system prompt, `"user"` for user prompt, and `"assistant"` for response from the model. |
MessageContentstring | MessageContentPart[]
MessageContentPartobject | object | object | …
MessageImageContentobject | object
MessageMetadataobject
| user_id | any | A unique identifier representing your end-user, which can help xAI to monitor and detect abuse. |
MessageToolChoiceobject | object | object
Tool choice option.
MessageToolInputSchemaobject
| properties* | any | JSON-object of the tool input schema. | |
| required | any | Required properties of the tool input schema, if any. | |
| type* | string | Type of the schema. This is always `"object"`. |
MessageToolsobject
| cache_control | any | (Unsupported) Cache control. | |
| description* | string | Description of the tool. | |
| input_schema* | MessageToolInputSchema | Input schema allowed by the tool. | |
| name* | string | Name of the tool. |
SystemMessageContentstring | SystemMessagePart[]
SystemMessagePartobject
| cache_control | any | (Unsupported) Cache control. | |
| text* | string | System prompt text. | |
| type* | string | Type of the object. This is always `"text"`. |
ToolResultContentstring | ToolResultContentBlock[]
Content of a tool_result block. The Anthropic SDK may send this as either a plain string or an array of typed content blocks (e.g. `[{"type": "text", "text": "..."}]`).
ToolResultContentBlockobject | object
A single content block within a tool_result's array content.
Validate a payload
before you spend tokensshell
$ curl -X POST https://modelschemas.com/v1/validate \
-d '{"provider":"grok","endpointId":"v1/messages","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}