GrokAPI & Developersadvanced

Grok API: send the encrypted reasoning back every turn

On xAI's Responses API, append every output item (including encrypted reasoning) to the next request. Dropping it hurts quality and cache hits.

xAI’s best-practices guide says to use the Responses API (Chat Completions is deprecated) and keep the model’s reasoning in the conversation.

Two ways

  • Chain requests with previous_response_id (with store on, the default).
  • Or store: false and append every output item, including reasoning items with encrypted_content, to the next request’s input.

Common ways code drops it

  • Extracting only output_text and re-adding it as a plain message.
  • Editing, filtering or reordering output items.
  • Rebuilding history in Chat Completions format between turns.

Cheaper too

Give each conversation its own prompt_cache_key and only append. Missing reasoning items are the most common cause of cache misses.

Sources

Related tips