[PR #2480] fix: Allows reasoning to be reused in responses API. #10322

Closed
opened 2026-02-16 18:14:57 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/2480

State: closed
Merged: No


Allows openAI reasoning chains to be passed back to the responses API. Uses the itemId if store:true and encrypted content if set to false and include: ["reasoning.encrypted_content"] is used.

Expect an error like:

AI_APICallError: Item with id 'rs_68be1138d72081a18f8e81b24c59fcba00cd1de26313e896' not found. Items are not persisted when `store` is
set to false. Try again with `store` set to true, or remove this item from your input.

if store is false and encrypted content is not passed.

Had to debug this issue in the process. Adding ItemIds solved this.
https://github.com/vercel/ai/issues/7099#issuecomment-3066153760

Motivated by:
https://x.com/prashantmital/status/1963801245115904232

[@prashantmital](https://x.com/prashantmital)

[Sep 4](https://x.com/prashantmital/status/1963801245115904232)
myth #3: model intelligence is the same regardless of whether you use completions or responses

wrong again.

responses was built for thinking models that call tools within their chain-of-thought (CoT). responses allows persisting the CoT between model invocations when calling tools agentically -- the result is a more intelligent model, and much higher cache utilization; we saw cache rates jump from 40-80% on some workloads.

this one is perhaps the most egregious. developers don't realize how much performance they are leaving on the table. i get it, its hard because you use LiteLLM or some custom harness you built around chat completions or whatever, but prioritizing the switch is crucial if you want GPT-5 to be maximally performant in your agents.

here's our cookbook on function calling with responses:
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2480 **State:** closed **Merged:** No --- Allows openAI reasoning chains to be passed back to the responses API. Uses the itemId if `store:true` and encrypted content if set to false and `include: ["reasoning.encrypted_content"]` is used. Expect an error like: ``` AI_APICallError: Item with id 'rs_68be1138d72081a18f8e81b24c59fcba00cd1de26313e896' not found. Items are not persisted when `store` is set to false. Try again with `store` set to true, or remove this item from your input. ``` if store is false and encrypted content is not passed. Had to debug this issue in the process. Adding ItemIds solved this. https://github.com/vercel/ai/issues/7099#issuecomment-3066153760 Motivated by: https://x.com/prashantmital/status/1963801245115904232 ``` [@prashantmital](https://x.com/prashantmital) [Sep 4](https://x.com/prashantmital/status/1963801245115904232) myth #3: model intelligence is the same regardless of whether you use completions or responses wrong again. responses was built for thinking models that call tools within their chain-of-thought (CoT). responses allows persisting the CoT between model invocations when calling tools agentically -- the result is a more intelligent model, and much higher cache utilization; we saw cache rates jump from 40-80% on some workloads. this one is perhaps the most egregious. developers don't realize how much performance they are leaving on the table. i get it, its hard because you use LiteLLM or some custom harness you built around chat completions or whatever, but prioritizing the switch is crucial if you want GPT-5 to be maximally performant in your agents. here's our cookbook on function calling with responses: ```
yindo added the pull-request label 2026-02-16 18:14:57 -05:00
yindo closed this issue 2026-02-16 18:14:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10322