Skip to main content
POST
Grok Chat Completions (All Models, Full Parameters)
BaseURL: The default BaseURL is https://direct.evolink.ai, which has better support for text models and long-lived connections. https://api.evolink.ai is the primary endpoint for multimodal services and serves as a fallback address for text models.
Server-side tools (web search, X search, code execution, attachment search, collections search) are only available on the Responses API. The Chat Completions endpoint supports regular function tool calling only.

Authorizations

Authorization
string
header
required

##All APIs require Bearer Token authentication##

Get API Key:

Visit API Key Management Page to get your API Key

Add to request header:

Body

application/json
model
enum<string>
required

Model to call:

Available options:
grok-4.5
Example:

"grok-4.5"

messages
object[]
required

List of chat messages. Supports system, user, and assistant roles.

Minimum array length: 1
Example:
stream
boolean
default:false

Whether to return a streaming response (SSE, chat.completion.chunk events). Default false.

Example:

false

max_tokens
integer

Maximum number of tokens to generate. Passed through to the model as-is.

Example:

1024

temperature
number

Sampling temperature (0-2). Higher values produce more random output.

Example:

0.7

top_p
number

Nucleus sampling parameter (0-1).

Example:

0.95

tools
object[]

Regular OpenAI function tool definitions (client-side function calling, no extra per-call fee). xAI server-side tools are only available on the Responses API.

tool_choice

Controls function selection: "auto" / "none" / "required", or an object pinning a specific function.

Available options:
auto,
none,
required

Response

Chat completion generated successfully (JSON object, or an SSE stream of chat.completion.chunk events when stream=true)

id
string

Unique identifier for the chat completion

Example:

"chatcmpl-20260812164515123456789AbCdEfGh"

model
string

Model name actually used

Example:

"grok-4.5"

object
enum<string>

Response type

Available options:
chat.completion
Example:

"chat.completion"

created
integer

Creation timestamp

Example:

1786538000

choices
object[]

List of chat completion choices

usage
object

Token usage statistics. Prompts of 200K tokens or more are billed at 2x for all token types (input, cached input, output).