Dialogue and Reasoning
This page explains how to use Grok series dialogue calls and reasoning scenarios. For an integration overview, see Grok Overview.
Basic Conversation
resp = client.chat.completions.create( model="grok-4.5", messages=[ {"role": "system", "content": "You are a sharp but friendly tech commentator"}, {"role": "user", "content": "Give an assessment of the recent AI industry trends"}, ],)print(resp.choices[0].message.content)- Multi-turn conversations are the same as other series: include historical messages in
messages, see Multi-turn Conversations; - For streaming output, add
"stream": true, see Streaming Output.
Reasoning Scenarios
Grok high-tier models perform strongly on math, logic, and coding tasks:
- For reasoning tasks, it is recommended to set
max_tokensgenerously to leave room for the model to reason; - If the output includes a thinking process field (
reasoning_content), display it separately from the main text, handle it the same way as Reasoning Model Output; - For complex tasks, first get the workflow working on a free/low-cost model, then switch to Grok to compare results.
Selection Recommendations
- Social-media-style conversations, trending topic commentary: Grok primary tier;
- Serious long-form content and compliance-sensitive scenarios: recommend comparing with the Claude series before choosing;
- Use the model name configuration option for gradual rollout, comparing answer quality and cost for the same prompt.