Skip to content

fix(ai): only send store on chat completions for OpenAI and Azure - #57239

Merged
rekram1-node merged 2 commits into
devfrom
chat-store-default
Oct 20, 2026
Merged

rekram1-node merged 2 commits into
devfrom
chat-store-default

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Partially addresses #57230 (the store half; stream_options is left for a follow-up).

The Chat Completions protocol sent store: false to every provider unless it was on a hardcoded non-standard list. Strict OpenAI-style APIs reject unknown body fields with a 400, so any provider missing from the list broke (Sarashina in #57230; also Cerebras, Upstage, the Gemini compat endpoint, and LiteLLM proxies in front of non-OpenAI backends, which raise UnsupportedParamsError unless drop_params is set).

No mainstream Chat Completions API stores by default: OpenAI's documented default is false, and Azure stored completions were opt-in. OpenAI does have an org-level API call logging setting that can store requests that omit store, so OpenAI and Azure keep getting an explicit store: false.

Changes:

  • detectSupportsStore is now an allowlist: provider openai/azure, or an api.openai.com / Azure OpenAI host (*.openai.azure.com, *.cognitiveservices.azure.com, *.services.ai.azure.com). Everything else omits store. compatibility.supportsStore still overrides detection either way.
  • Redundant supportsStore: false entries are dropped from providers, since false is now the detected default.
  • Cassettes for DigitalOcean and OpenRouter chat had "store":false removed from their recorded request bodies; responses are unchanged.

Testing:

  • bun test in packages/ai: all pass except the two Bedrock PDF cassettes, which fail only because of the host's AWS_REGION; they pass with it unset.
  • bun run typecheck in packages/ai.
  • New test covers: generic provider omits store (even with providerOptions.store), supportsStore: true opts in, generic provider on api.openai.com sends it, Azure sends it.

Requested by: @rekram1-node (Aiden Cline via Slack)

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found nothing blocking. I built request bodies on the base and with this change. A generic OpenAI-compatible model (Sarashina-style) sent store: false on the base and now leaves store out. Native OpenAI and Azure chat still send store: false. In packages/ai, the tests pass with AWS_REGION unset and the type check passes. test/session-runner-recorded.test.ts in packages/core also passes.

Public API: unchanged. No config, SDK, HTTP or plugin surface changes. The only behaviour change is that Chat Completions requests leave out store unless compatibility.supportsStore is true.

Side effect, not blocking: on generic OpenAI-compatible providers, providerOptions.store is now silently ignored. Users can't opt back in from config either, because supportsStore isn't in the config compatibility schema (#52617). The provider body setting still works as an escape hatch.

Related: #52617

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant