GET

/v1/schemas/grok/chat/v1%2Fcompletions

kind inputactivity chathash 33e63d46extracted Jul 6, 2026version currentsource upstream spec ↗

Request body

18 properties · 0 required · 2 $defs
propertytypedescriptionconstraints
best_ofany(Unsupported) Generates multiple completions internally and returns the top-scoring one. Not functional yet.format: int32
echoanyOption to include the original prompt in the response along with the generated completion.
frequency_penaltyany(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_biasany(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…
logprobsanyInclude 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_tokensanyLimits 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
modelstringSpecifies the model to be used for the request.
nanyDetermines 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_penaltyany(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
promptstring | 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.
seedanyIf 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
stopany(Not supported by reasoning models) Up to 4 sequences where the API will stop generating further tokens.
streamanyWhether 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_optionsStreamOptionsOptions for streaming response. Only set this when you set `stream: true`.nullable
suffixany(Unsupported) Optional string to append after the generated text.
temperatureanyWhat 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_panyAn 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
useranyA unique identifier representing your end-user, which can help xAI to monitor and detect abuse.

Validate a payload

before you spend tokens
shell
$ curl -X POST https://modelschemas.com/v1/validate \
    -d '{"provider":"grok","endpointId":"v1/completions","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}