chat
Submit a text prompt to a Grok model and receive its reply. Persist conversation context with sessions, and activate the agentic loop for tool-augmented reasoning.
Instructions
Send a text prompt to a Grok model and return its reply.
Absorbs the old agentic_chat tool: the ReAct AgentLoop is now the
default route, so the model has its tool surface and self-directs.
Set enable_agentic=False to force a single toolless completion.
Args:
prompt: User message to send to the model.
session: Optional session name. Persists conversation history.
model: Grok model id (defaults to grok-build-0.1).
system_prompt: Optional system instruction prepended to the conversation.
agent_count: 4 or 16. Only valid with grok-4.20-multi-agent.
enable_agentic: If True (default), runs through the ReAct AgentLoop.
require_reasoning_level: Minimum required Grok reasoning level (low, medium, high).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | grok-build-0.1 | |
| prompt | Yes | ||
| session | No | ||
| agent_count | No | ||
| system_prompt | No | ||
| enable_agentic | No | ||
| require_reasoning_level | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Human-formatted output (includes footers, citations, cost summary). | |
| model | Yes | Actual executing model ID (e.g. 'grok-4.5'). | |
| plane | No | API | |
| route | Yes | High-level route (fast/agentic/research/etc.). | |
| tokens | No | Total tokens consumed. | |
| profile | No | Internal routing profile. | |
| session | No | Persistent session name. | |
| cost_usd | No | Exact USD cost from xAI billing metadata. | |
| response | Yes | Raw model output or primary content. | |
| citations | No | Native xAI/X citations with URL + snippet. | |
| latency_sec | No | ||
| response_id | No | Server-side stateful ID for continuation. | |
| finish_reason | No | unknown | |
| reasoning_effort | No | Grok 4.5+ native reasoning level. |