fix(proxy): strip unsupported reasoning params for GPT-5 via LiteLLM/SSO#176
Open
fix(proxy): strip unsupported reasoning params for GPT-5 via LiteLLM/SSO#176
Conversation
AI SDKs (@langchain/openai, @ai-sdk/openai-compatible) detect GPT-5 and o-series as "reasoning models" and inject `reasoningSummary` / `reasoning` params that LiteLLM/Azure proxies reject with: "Unknown parameter: 'reasoningSummary'" Changes: - Add RequestSanitizerPlugin proxy plugin that strips unsupported reasoning params before forwarding requests upstream - Scope plugin to codemie-code and codemie-opencode agents only - In codemie-code agent: add inline param stripping for direct (non-proxy) SSO requests and force Completions API via useResponsesApi: false for LiteLLM compatibility Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
…etch useResponsesApi: false already prevents LangChain from injecting reasoning params at the source. The proxy request-sanitizer plugin covers the SSO path. No need for duplicate stripping in the agent's fetch wrapper. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Cover two-layer sanitization for GPT-5 models through LiteLLM and ai-run-sso: - reasoning-sanitizer-source: plugin string validation (14 tests) - request-sanitizer.plugin: proxy-level param stripping (21 tests) - inject-sanitizer: temp file lifecycle management (8 tests) - codemie-code-reasoning: beforeRun integration — provider mapping, plugin injection, cleanup (14 tests) - Fix existing codemie-code-plugin.test.ts with reasoning-sanitizer mock Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Missing source files that tests depend on: - reasoning-sanitizer-source.ts: plugin source as string constant - inject-sanitizer.ts: temp file write/cleanup lifecycle - index.ts: barrel exports - codemie-code.plugin.ts: updated imports and plugin injection Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
TarasSpashchenko
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reasoningSummary,reasoning_summary,reasoning)RequestSanitizerPlugin): strips params for ai-run-sso path, scoped tocodemie-codeandcodemie-opencodeagents onlyReasoningSanitizerPlugin): strips params for direct LiteLLM path via temp file injectionuseResponsesApi: falseprevents injection at sourceTest plan
npm run test:unit)codemie-codewithCODEMIE_PROVIDER=litellmagainst GPT-5 modelcodemie-codewithCODEMIE_PROVIDER=ai-run-ssoagainst GPT-5 modelreasoningEffortis preserved (not stripped)