chat_with_files
Ask questions or give instructions about previously uploaded files to get context-aware responses from Grok.
Instructions
Chat with Grok using one or more previously uploaded files as context.
Args:
prompt: Question or instruction about the attached files.
file_ids: IDs returned by xai_upload_file.
session: Optional session name for persistent local history.
model: Grok model id (default grok-4.3).
system_prompt: Optional system instruction prepended to the conversation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | grok-4.3 | |
| prompt | Yes | ||
| session | No | ||
| file_ids | Yes | ||
| system_prompt | 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. |