Skip to content

fix(chat-completions): normalize provider thinking aliases#424

Open
stemirkhan wants to merge 1 commit intoSoju06:mainfrom
stemirkhan:feat/qwen-thinking-compat
Open

fix(chat-completions): normalize provider thinking aliases#424
stemirkhan wants to merge 1 commit intoSoju06:mainfrom
stemirkhan:feat/qwen-thinking-compat

Conversation

@stemirkhan
Copy link
Copy Markdown

Summary

  • normalize provider-specific thinking / enable_thinking aliases into the canonical reasoning payload
  • apply the normalization in Chat Completions request mapping and in the shared OpenAI-compatible Responses sanitation path
  • add unit + integration coverage and an OpenSpec change for the compatibility behavior

Why

Fixes #205.

Some OpenAI-compatible clients reuse provider-specific reasoning controls when switching their base_url to codex-lb. Those aliases were leaking through to the upstream ChatGPT backend unchanged, which caused avoidable upstream validation failures instead of a smooth compatibility path.

This keeps the fix intentionally small:

  • enable_thinking: true maps to reasoning.effort = "medium"
  • Anthropic-style thinking payloads are normalized to the same canonical shape
  • explicit reasoning still wins over provider aliases

Testing

  • /home/temirkhan/codex-lb-my/codex-lb-upstream/.venv/bin/python -m pytest tests/unit/test_chat_request_mapping.py tests/unit/test_openai_requests.py tests/integration/test_openai_compat_features.py -q
  • openspec validate --specs

Notes

  • scoped to OpenAI-compatible request compatibility only
  • no API surface expansion and no dashboard changes

@stemirkhan stemirkhan changed the title [codex] normalize provider thinking aliases in chat completions normalize provider thinking aliases in chat completions Apr 16, 2026
@stemirkhan stemirkhan changed the title normalize provider thinking aliases in chat completions fix(chat-completions): normalize provider thinking aliases Apr 16, 2026
@stemirkhan stemirkhan marked this pull request as ready for review April 16, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support thinking / enable_thinking params in Chat Completions API for multi-provider compatibility

1 participant