Grok All-Model API - Responses Reference
- OpenAI-compatible Responses endpoint for xAI Grok text models; pick the model via the
modelparameter (see the table on themodelparameter for all values) grok-4.5: 500K-token context window; prompts of 200K tokens or more are billed at 2x for all token types- Prompt caching is automatic: cached prompt tokens are billed at the lower cached-input rate
- Synchronous and streaming (SSE) modes
- xAI server-side tools run on xAI infrastructure and are billed per successful call:
web_search,x_search,code_execution,attachment_search,collections_search - Regular
functiontools (client-side function calling) are also supported and carry no per-call fee
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.Authorizations
##All APIs require Bearer Token authentication##
Get API Key:
Visit API Key Management Page to get your API Key
Add to request header:
Body
Model to call:
grok-4.5 "grok-4.5"
Input for the model: a plain string, or an array of OpenAI Responses input items (e.g. {"role":"user","content":[...]}), passed through as-is.
"Search the web for the latest SpaceX launch and summarize it in one sentence."
Whether to return a streaming response (SSE events, ending with response.completed). Default false.
false
Maximum number of tokens to generate (reasoning tokens included).
2048
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.
Controls tool selection: "auto" (default) / "none" / "required", or an object pinning a specific tool, e.g. {"type": "web_search"}.
auto, none, required 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.
5
Response
Response generated successfully (JSON object, or an SSE event stream ending with response.completed when stream=true)
Unique identifier for the response
"55d44212-8d5e-90cc-975f-36d341ce21f5"
Response type
response "response"
Response status
completed, incomplete, failed "completed"
Model name actually used
"grok-4.5"
Creation timestamp
1786538000
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.
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.