chat
Send a text prompt to a Grok model and receive the assistant's reply. Supports conversation history, multiple models, and system instructions.
Instructions
Send a text prompt to a Grok model and return its reply.
Replays prior turns from `chats/{session}.json` when a session is given,
then appends the new user message and saves the round trip.
Args:
prompt: User message to send to the model.
session: Optional session name. Loads and appends history to `chats/{session}.json`.
model: Grok model id (default `grok-4.3`).
system_prompt: Optional system instruction prepended to the conversation.
agent_count: 4 or 16. Only valid with `grok-4.20-multi-agent` for multi-agent research.
show_usage: Append a token usage and cost footer to the reply (default False).
Returns:
The assistant's reply text, plus a token usage and cost footer when `show_usage` is true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | grok-4.3 | |
| prompt | Yes | ||
| session | No | ||
| show_usage | No | ||
| agent_count | No | ||
| system_prompt | No |