From 6783d1f595c84927f666d5c0adee7b97c263897f Mon Sep 17 00:00:00 2001 From: Molly Gibson Date: Fri, 17 Apr 2026 15:43:06 -0700 Subject: [PATCH] (fix: ai-openai) Remove strict param from the OpenAI request body --- .changeset/sour-parks-trade.md | 5 +++++ packages/ai/openai/src/OpenAiLanguageModel.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/sour-parks-trade.md diff --git a/.changeset/sour-parks-trade.md b/.changeset/sour-parks-trade.md new file mode 100644 index 00000000000..5d58470ce54 --- /dev/null +++ b/.changeset/sour-parks-trade.md @@ -0,0 +1,5 @@ +--- +"@effect/ai-openai": patch +--- + +Previously, setting `strict: false` on `OpenAiLanguageModel` config caused a 400 "Unknown parameter: 'strict'" response from the OpenAI Responses API, because the flag was spread into the top-level request body instead of being consumed only by the tool and response_format schema builders. The `strict` flag is now stripped from the request body while still controlling `strict` on tool schemas (`prepareTools`) and json_schema response formats (`prepareResponseFormat`). diff --git a/packages/ai/openai/src/OpenAiLanguageModel.ts b/packages/ai/openai/src/OpenAiLanguageModel.ts index c4fef761467..287afa629fd 100644 --- a/packages/ai/openai/src/OpenAiLanguageModel.ts +++ b/packages/ai/openai/src/OpenAiLanguageModel.ts @@ -287,8 +287,9 @@ export const make = Effect.fnUntraced(function*(options: { const include = prepareInclude(providerOptions, config) const responseFormat = prepareResponseFormat(providerOptions) const verbosity = config.text?.verbosity + const { strict: _strict, ...requestConfig } = config const request: typeof Generated.CreateResponse.Encoded = { - ...config, + ...requestConfig, input: messages, include, text: { format: responseFormat, verbosity },