GET
/v1/schemas/grok/chat/v1%2Fcompletions
Accept:
Request body
18 properties · 0 required · 2 $defs| property | type | description | constraints |
|---|---|---|---|
| best_of | any | (Unsupported) Generates multiple completions internally and returns the top-scoring one. Not functional yet. | format: int32 |
| echo | any | Option to include the original prompt in the response along with the generated completion. | |
| frequency_penalty | any | (Unsupported) Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. | format: float |
| logit_bias | any | (Unsupported) Accepts a JSON object that maps tokens to an associated bias value from -100 to 100. You can use this tokenizer tool to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact… | |
| logprobs | any | Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the logprob of the sampled token, so there… | |
| max_tokens | any | Limits the number of tokens that can be produced in the output. Ensure the sum of prompt tokens and `max_tokens` does not exceed the model's context limit. | format: int32 |
| model | string | Specifies the model to be used for the request. | |
| n | any | Determines how many completion sequences to produce for each prompt. Be cautious with its use due to high token consumption; adjust `max_tokens` and stop sequences accordingly. | format: int32 |
| presence_penalty | any | (Not supported by `grok-3` and reasoning models) Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. | format: float |
| prompt | string | string[] | Input for generating completions, which can be a string, list of strings, token list, or list of token lists. `<|endoftext|>` is used as a document separator, implying a new context start if omitted. | |
| seed | any | If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed, and you should refer to the system_fingerprint response pa… | format: int32 |
| stop | any | (Not supported by reasoning models) Up to 4 sequences where the API will stop generating further tokens. | |
| stream | any | Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a `data: [DONE]` message. | |
| stream_options | StreamOptions | Options for streaming response. Only set this when you set `stream: true`. | nullable |
| suffix | any | (Unsupported) Optional string to append after the generated text. | |
| temperature | any | What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. | 0 ≤ n ≤ 2 · format: float · default: 1 |
| 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. We generally recommend… | format: float |
| user | any | A unique identifier representing your end-user, which can help xAI to monitor and detect abuse. |
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", …}]}