grok_chat_completions
Send messages to a Grok model (grok-4/3) to get chat responses, vision understanding, and function calling via AceDataCloud API.
Instructions
Create a Grok (xAI) chat completion via the AceDataCloud Grok API.
Sends messages to a Grok chat model and returns the generated response in the
OpenAI-compatible chat completion format.
Use this when:
- You want to chat/reason with a Grok model (grok-4 / grok-3 family)
- You need vision/image understanding
- You need tool/function calling with Grok
For generating videos, use grok_text_to_video / grok_image_to_video instead.
Returns:
JSON response containing the chat completion result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | How many chat completion choices to generate. Default 1. | |
| seed | No | Random seed for (best-effort) deterministic sampling. | |
| stop | No | Stop sequences where the API will stop generating tokens. | |
| user | No | End-user identifier for abuse monitoring. | |
| audio | No | Audio output configuration when requesting audio modality. | |
| model | No | The Grok chat model: grok-4.5 (default, latest flagship), grok-4 or grok-3. | grok-4 |
| store | No | Whether to store the output of this chat completion. Default false. | |
| tools | No | List of tools (functions) the model may call. | |
| top_p | No | Nucleus sampling probability mass. Default 1. | |
| stream | No | Whether to stream partial message deltas. Default False. | |
| logprobs | No | Whether to return log probabilities of output tokens. | |
| messages | Yes | Conversation messages. Each message is a dict with 'role' ('system'/'user'/'assistant'/'tool') and 'content' keys. Content may be a list of text/image_url parts for image input. Required. | |
| metadata | No | Developer-defined metadata attached to the request. | |
| logit_bias | No | Token logit bias map. | |
| max_tokens | No | Maximum number of tokens to generate. | |
| modalities | No | Output modalities requested for this response. | |
| prediction | No | Static predicted output content to improve latency. | |
| temperature | No | Sampling temperature between 0 and 2. Higher = more random. | |
| tool_choice | No | Controls tool calling. 'none', 'auto', 'required', or a dict. | |
| service_tier | No | Specifies the processing tier. Options: 'auto' (default), 'default', 'flex' (asynchronous batch-eligible), 'scale', or 'priority'. | |
| top_logprobs | No | Number of most likely tokens to return at each token position. | |
| stream_options | No | Options for streaming responses. | |
| response_format | No | Response format specification (e.g. {"type": "json_object"}). | |
| presence_penalty | No | Presence penalty between -2.0 and 2.0. Positive increases topic variety. | |
| reasoning_effort | No | Reasoning effort. Only applies to reasoning-capable models; ignored by non-reasoning models. | |
| frequency_penalty | No | Frequency penalty between -2.0 and 2.0. Positive decreases repetition. | |
| web_search_options | No | Web search configuration for search-capable models. | |
| parallel_tool_calls | No | Whether to enable parallel tool calls. Default true. | |
| max_completion_tokens | No | Upper bound for tokens generated for a completion. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |