Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/api/src/endpoints/openai/llm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ describe('getOpenAILLMConfig', () => {
},
);

it('should NOT default to Responses API without reasoning params', () => {
it('should default to Responses API for gpt-5.6 even without explicit reasoning params', () => {
const result = getOpenAILLMConfig({
apiKey: 'test-api-key',
streaming: true,
Expand All @@ -739,8 +739,7 @@ describe('getOpenAILLMConfig', () => {
},
});

expect(result.llmConfig).not.toHaveProperty('useResponsesApi');
expect(result.llmConfig).not.toHaveProperty('reasoning');
expect(result.llmConfig).toHaveProperty('useResponsesApi', true);
});

it('should NOT default to Responses API when reasoning_effort is none', () => {
Expand Down
18 changes: 8 additions & 10 deletions packages/api/src/endpoints/openai/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ function isOpenAIEndpoint(endpoint?: EModelEndpoint | string | null): boolean {
}

/**
* GPT-5.6 models reject function tools combined with `reasoning_effort` in
* `/v1/chat/completions` (400: "To use function tools, use /v1/responses or
* set reasoning_effort to 'none'"). Reasoning without tools still works on
* Chat Completions, but tools are bound after config time, so GPT-5.6
* reasoning requests default to the Responses API to avoid tool failures.
* GPT-5.6 models reject function tools on `/v1/chat/completions` while the
* model is reasoning (400: "To use function tools, use /v1/responses or set
* reasoning_effort to 'none'"). GPT-5.6 reasons by default even when no
* explicit `reasoning_effort` is set, and tools are bound after config time,
* so first-party OpenAI GPT-5.6 requests default to the Responses API unless
* the user explicitly sets effort to `none` (or opts out of Responses).
*/
const responsesApiRequiredPattern = /\bgpt-5\.6\b/;

Expand All @@ -139,11 +140,8 @@ function requiresResponsesApiForReasoning({
if (typeof model !== 'string' || !responsesApiRequiredPattern.test(model)) {
return false;
}
return (
reasoningEffort != null &&
reasoningEffort !== ReasoningEffort.unset &&
reasoningEffort !== ReasoningEffort.none
);
// Only skip when the user explicitly disables reasoning.
return reasoningEffort !== ReasoningEffort.none;
}

/**
Expand Down