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.
This page documents regular function calls. For server-side tools (web search, X search, code execution, attachment search, and collections search), use the Responses API, which includes tool configuration and billing details.

Using Grok 4.7

Set model to grok-4.7 and keep the existing messages request format. The context window is 500,000 tokens, and the knowledge cutoff is May 2026. Use the top-level reasoning_effort parameter. Reasoning depth: low / medium / high (default) / xhigh. Reasoning cannot be disabled. grok-4.7 and grok-4.6 support xhigh; grok-4.5 accepts it but treats it as high. Reasoning tokens are billed as output tokens. prompt_cache_key provides a stable cache routing hint for requests sharing a prompt prefix; it does not guarantee a cache hit. Check usage.prompt_tokens_details.cached_tokens for actual hits. To preserve encrypted reasoning across turns, use the Responses API.

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.7,
grok-4.6,
grok-4.5
Example:

"grok-4.7"

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.

Example:

1024

reasoning_effort
enum<string>
default:high

Reasoning depth: low / medium / high (default) / xhigh. Reasoning cannot be disabled. grok-4.7 and grok-4.6 support xhigh; grok-4.5 accepts it but treats it as high. Reasoning tokens are billed as output tokens.

Available options:
low,
medium,
high,
xhigh
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[]

This page documents regular OpenAI function tool definitions (client-side function calls with no server-side tool-call fee). See the Responses API for server-side tool configuration and usage, including web search and X search.

tool_choice

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

Available options:
auto,
none,
required
prompt_cache_key
string

Optional cache routing key. Use a stable value for requests in the same conversation or sharing the same prompt prefix to improve the chance of a cache hit. Hits are not guaranteed, and cache billing rules do not change. Check cached_tokens in usage for actual cache hits.

Example:

"grok-session-001"

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.7"

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).