Skip to main content
POST
Grok Responses (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 run on xAI’s infrastructure and are billed per successful call in addition to token usage: Web Search / X Search / Code Execution 0.005percall,AttachmentSearch0.005 per call, Attachment Search 0.01 per call, Collections Search $0.0025 per call. Tool fees are not affected by the long-context multiplier.
image_generation is currently not available on Grok 4.5: declaring it is accepted for compatibility but the tool is removed before the request reaches the model. Unrecognized tools[].type values are rejected with 400.

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"

input
required

Input for the model: a plain string, or an array of OpenAI Responses input items (e.g. {"role":"user","content":[...]}), passed through as-is.

Example:

"Search the web for the latest SpaceX launch and summarize it in one sentence."

stream
boolean
default:false

Whether to return a streaming response (SSE events, ending with response.completed). Default false.

Example:

false

max_output_tokens
integer

Maximum number of tokens to generate (reasoning tokens included).

Example:

2048

tools
object[]

Tool declarations. xAI server-side tools (billed per successful call, fees not affected by the long-context multiplier):

Regular function tools (client-side function calling) are also supported and carry no per-call fee.

⚠️ image_generation is currently not available: declaring it is accepted for compatibility but removed before the request reaches the model. Unrecognized tool types are rejected with 400.

Example:
tool_choice

Controls tool selection: "auto" (default) / "none" / "required", or an object pinning a specific tool, e.g. {"type": "web_search"}.

Available options:
auto,
none,
required
max_tool_calls
integer

Maximum number of server-side tool calls for this request. When omitted (or set to null), the platform automatically applies a cap of up to 10 calls based on your available balance. Declared paid tools reserve their worst-case budget upfront; the unused part is refunded at settlement.

Example:

5

Response

Response generated successfully (JSON object, or an SSE event stream ending with response.completed when stream=true)

id
string

Unique identifier for the response

Example:

"55d44212-8d5e-90cc-975f-36d341ce21f5"

object
enum<string>

Response type

Available options:
response
Example:

"response"

status
enum<string>

Response status

Available options:
completed,
incomplete,
failed
Example:

"completed"

model
string

Model name actually used

Example:

"grok-4.5"

created_at
integer

Creation timestamp

Example:

1786538000

output
object[]

Output items in generation order: reasoning items (summarized thinking), server-side tool call items such as web_search_call / code_interpreter_call (status completed marks a successful, billable call), and a final message item with output_text content.

usage
object

Token and tool usage statistics. Prompts of 200K tokens or more are billed at 2x for all token types; tool fees are unaffected by the multiplier.