Skip to content

Model in @ai-sdk/openai sdk fails on the 2nd request #5104

Closed

Description

@junmediatek

Description

When I use @ai-sdk/openai to access openai models which only support Response API(like gpt-5.1-codex), and I set the store to false & "include": ["reasoning.encrypted_content"], the second request fails with below error message

ERROR 2025-12-05T05:28:32 +3ms service=session.processor error=The encrypted content for item rs_0f26baa4a8bfec6b0169326d7c20a8819499e6d836076cc00b could not be verified. stack="AI_APICallError: The encrypted content for item rs_0f26baa4a8bfec6b0169326d7c20a8819499e6d836076cc00b could not be verified.\n at <anonymous> (../../node_modules/.bun/@[email protected]+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:889:18)\n at processTicksAndRejections (native:7:39)" process

The request body has reasoning information with id & encrypted_content item, when the store has been set to false, reasoning should not include id & encrypted_content, because the server does not store the reasoning information. The only content that needs to be included in reasoning should be the summary, provided that the summary exists.

Partial request body information is as follows:
{"role":"user","content":[{"type":"input_text","text":"hi"}]},{"type":"reasoning","id":"rs_0f26baa4a8bfec6b0169326d7c20a8819499e6d836076cc00b","encrypted_content":"gAAAAABpMm18nXrFLUlQWklcTxLxRKja9xTgzkc-EOx3-KI7h1DGIDFpIEjdUbaOCnnLjXdxT52UYCnz8C_VAOmdNO-cKgUqDKbYkZlnuGKAYrgZUoLsiYpp-uyWKrnpU5kZdusMxhARLjNdiVBW82Ll-ug_glO3jeqRUuiDDPXKMuL9MleLGzfXg2MtYq952meJDVqFA32gRo-T-nV2UZH2V9BtbBjltAkVo1yWbv5oC4neD4K3t1Tiyo72GmfVR2ZAkzOTpjobSVUTGrsCQzQytpbl6vAbHcIa9-z0Y0Y0lTQ7TZBBJE971-GzsVjhG2cDOrkEUGZlEcEZEbalVe_6tUSw1icClbMGhPCLMm8RDT_IjTvP2x6kdQRlzKYsZLj4KMl_FesRQJdsvqqSg7HJFPJvQbMpoLuMscEhjmIwIcQ0SGEfUsfNo57i02Pl8iPzASD-LYgHjdYG0CrHxRPeWWW3Jm-t9McmSTpC7iyGpK9cdz1nBkjH5HRXofL0RTIOR4pYffDjvjbreRnWakLvpjYEzIYPEUVjNJb9XScFMJJsAnIcNS4p2BmZNHr3JjAbx_1g1-mm7e-VkkoXyrFY3F5MUQokpXtHfMoBHBrYmgtBmBbC7oxxp4WN0WQgtg2C1Re4gyce7TZ92dMYeb9qJLD_hMfHcvKqS_xjiO5Glz5WuhiQ1VeDR9TGAWXf8vA9FXlhLUbW2fRiE4BH1cASRhy1CpBK3Jn0QZ84BDYvmw3MkjeWVLgIgqa80iUHKHQoOIKRtryPK3uYUds_wYn5KnOYwLZO_AiLExgj1cTtdqggdC2oNlcKDcJAm65kFYw2pFj3JpemUu9bld2zN9Lva-PF0zFtVRfd5Td-j7iwDEAJzObiWTBTs627AJWGrbUo4jreqooH","summary":[]},{"role":"assistant","content":[{"type":"output_text","text":"hello, what can I do for you?"}],"id":"msg_0f26baa4a8bfec6b0169326d7c76b881949ca449a294f5d379"},{"role":"user","content":[{"type":"input_text","text":"hello"}]}],"max_output_tokens":32000,"store":false,"include":["reasoning.encrypted_content"],

my opencode.json is below:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "gaisf-openai": {
      "npm": "@ai-sdk/openai",
      "name": "gaisf-openai",
      "options": {
        "baseURL": "https://mlop-gateway-rddmz.xxxx.inc/openai",
        "apiKey": "{env:MY_GAISF_KEY}",
        "timeout": 300000
      },
      "models": {
        "gpt-5.1-codex-medium": {
          "id": "gpt-5.1-codex",
          "name": "gpt-5.1-codex-medium",
          "attachment": true,
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          },
          "options": {
            "store": false,
            "include": ["reasoning.encrypted_content"],
            "reasoningEffort": "medium",
            "reasoningSummary": "auto"
          }
        }
      }
    }
  }
}

OpenCode version

1.0.133

Steps to reproduce

Using @ai-sdk/openai sdk to access GPT-5.1 Codex model

Send "Hi" -> Works
Send "Hello" next -> Fails

Screenshot and/or share link

NA

Operating System

ubuntu 24.04

Terminal

VSCode remoteSSH Terminal

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 5, 2025
  2. junmediatek commented on Dec 5, 2025

    @junmediatek
    ContributorAuthor

    @rekram1-node

    Could you help to check this issue?

  3. github-actions commented on Dec 5, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    All these issues appear to be related to improper handling of reasoning items (with id and encrypted_content) when store: false is set, particularly on subsequent requests in multi-turn conversations.

    Feel free to ignore if this is a regression or if your specific setup differs from the above issues.

  4. rekram1-node commented on Dec 5, 2025

    @rekram1-node
    Collaborator

    @junmediatek can you do:

    opencode export > session.json

    and then send me that?

    select the session that errored or make a new one and then gimme json output

  5. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 5, 2025
  6. self-assigned this
    on Dec 5, 2025
  7. junmediatek commented on Dec 5, 2025

    @junmediatek
    ContributorAuthor

    @rekram1-node

    I make a new conversation
    session.json

  8. rekram1-node commented on Dec 5, 2025

    @rekram1-node
    Collaborator

    Idk how ur gateway works but when u use the responses api you HAVE to go to the same server everytime, whatever happens w/ ur setup its going to different servers and failing to verify the reasoning hash.

  9. junmediatek commented on Dec 16, 2025

    @junmediatek
    ContributorAuthor

    Idk how ur gateway works but when u use the responses api you HAVE to go to the same server everytime, whatever happens w/ ur setup its going to different servers and failing to verify the reasoning hash.

    The root cause of this issue is exactly as you said. Thank you, I have resolve this issue

  10. ReStranger commented on Feb 21, 2026

    @ReStranger
    Contributor

    Idk how ur gateway works but when u use the responses api you HAVE to go to the same server everytime, whatever happens w/ ur setup its going to different servers and failing to verify the reasoning hash.

    The root cause of this issue is exactly as you said. Thank you, I have resolve this issue

    How did you do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions