How to set up Grok API requests the way xAI recommends for production
Based on a guide by SpaceXSI on the SpaceXSI Docs · Nov 23, 2026
You'll end with: Grok API requests on the Responses API that carry reasoning across turns, reuse the prompt cache, and hold up on long runs.
Why it's worth having: Carrying the encrypted reasoning forward keeps the model's earlier thinking in multi-turn and tool-calling work, which Chat Completions drops.
At a glance
The method, in short
- 1Move to the Responses API, since Chat Completions is deprecated and has no field for the encrypted reasoning.
- 2Send the encrypted reasoning content back with every turn, and give each conversation its own prompt_cache_key.
- 3Set reasoning effort on every request, prefer streaming, and allow at least 900 seconds per request.
- 4Start sampling at temperature 0.7 and top_p 0.95, and stay close to those values.
Read the full guide from SpaceXSI on the SpaceXSI Docs
The guide has Python and JavaScript loops, output length settings, and a checklist for running evaluations.