[PR #10142] feat(provider): support responses api for @ai-sdk/openai-compatible providers #13355

Open
opened 2026-02-16 18:18:13 -05:00 by yindo · 0 comments
Owner

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

State: open
Merged: No


What does this PR do?

it supports the responses api for providers using @ai-sdk/openai-compatible. I used your wrapper for github copilot provider which exposes the .responses api. could not do it natively because @ai-sdk does not supports it, see https://github.com/vercel/ai/issues/11970

I plan to add documentation about the new parameters once the approach is approved

closes #9628

How did you verify your code works?

set breakpoint in the lines changed and verifying the override for languageModel was working

bun run --inspect=ws://localhost:6499/ --cwd packages/opencode ./src/index.ts serve --port 4096
opencode attach http://localhost:4096

then tried the model several times and worked ok

config used

{
  "provider": {
    "customprovider": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "<URL>/litellm",
        "headers": {
          "client": "opencode",
        },
        "litellmProxy": true,
      },
      "models": {
        "customprovider/gpt-5-codex": {
          "name": "OpenAI GPT 5 codex",
          "options": {
            "responsesApiSupported": true,
            "store": false,
          },
        },
      }
    }
  }
}

the store: false is needed to avoid sending item_reference messages, here
https://github.com/anomalyco/opencode/blob/2e53697da01d1417845567296774166350e786f1/packages/opencode/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts#L173

https://github.com/anomalyco/opencode/blob/2e53697da01d1417845567296774166350e786f1/packages/opencode/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts#L199

otherwise you will get the error Zero Data Retention Organizations are incompatible with the Responses API. see https://github.com/openai/openai-agents-python/issues/605 for context

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10142 **State:** open **Merged:** No --- ### What does this PR do? it supports the responses api for providers using `@ai-sdk/openai-compatible`. I used your wrapper for github copilot provider which exposes the `.responses` api. could not do it natively because `@ai-sdk` does not supports it, see https://github.com/vercel/ai/issues/11970 I plan to add documentation about the new parameters once the approach is approved closes #9628 ### How did you verify your code works? set breakpoint in the lines changed and verifying the override for `languageModel` was working ```sh bun run --inspect=ws://localhost:6499/ --cwd packages/opencode ./src/index.ts serve --port 4096 opencode attach http://localhost:4096 ``` then tried the model several times and worked ok config used ```jsonc { "provider": { "customprovider": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "<URL>/litellm", "headers": { "client": "opencode", }, "litellmProxy": true, }, "models": { "customprovider/gpt-5-codex": { "name": "OpenAI GPT 5 codex", "options": { "responsesApiSupported": true, "store": false, }, }, } } } } ``` the `store: false` is needed to avoid sending `item_reference` messages, here https://github.com/anomalyco/opencode/blob/2e53697da01d1417845567296774166350e786f1/packages/opencode/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts#L173 https://github.com/anomalyco/opencode/blob/2e53697da01d1417845567296774166350e786f1/packages/opencode/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts#L199 otherwise you will get the error _Zero Data Retention Organizations are incompatible with the Responses API_. see https://github.com/openai/openai-agents-python/issues/605 for context
yindo added the pull-request label 2026-02-16 18:18:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13355