fix(auxiliary): honor api_mode in auxiliary client#7630
Closed
kshitijk4poor wants to merge 1 commit into
Closed
Conversation
The auxiliary client always calls client.chat.completions.create(),
ignoring the api_mode config flag. This breaks codex-family models
(e.g. gpt-5.3-codex) on direct OpenAI API keys, which need the
/v1/responses endpoint.
Changes:
- Expand _resolve_task_provider_model to return api_mode (5-tuple)
- Read api_mode from auxiliary.{task}.api_mode config and env vars
(AUXILIARY_{TASK}_API_MODE)
- Pass api_mode through _get_cached_client to resolve_provider_client
- Add _needs_codex_wrap/_wrap_if_needed helpers that wrap plain OpenAI
clients in CodexAuxiliaryClient when api_mode=codex_responses or
when auto-detection finds api.openai.com + codex model pattern
- Apply wrapping at all custom endpoint, named custom provider, and
API-key provider return paths
- Update test mocks for the new 5-tuple return format
Users can now set:
auxiliary:
compression:
model: gpt-5.3-codex
base_url: https://api.openai.com/v1
api_mode: codex_responses
Closes NousResearch#6800
9 tasks
Contributor
|
Merged via #7647. Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks @kshitijk4poor! |
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.
Problem
The auxiliary client (
auxiliary_client.py) always callsclient.chat.completions.create(), ignoring theapi_modeconfig flag. This breaks codex-family models (e.g.gpt-5.3-codex) on direct OpenAI API keys, which need the/v1/responsesendpoint.Setting
api_mode: codex_responsesin auxiliary task config was silently ignored, causing 404s with "This is not a chat model".Changes
_resolve_task_provider_modelreturn to includeapi_mode(5-tuple)api_modefromauxiliary.{task}.api_modeconfig and env vars (AUXILIARY_{TASK}_API_MODE)api_modethrough_get_cached_client→resolve_provider_client_needs_codex_wrap/_wrap_if_neededhelpers that wrap plain OpenAI clients inCodexAuxiliaryClientwhen:api_mode=codex_responsesis explicitly set, ORapi.openai.comURL + codex model name patternConfig example
Closes #6800
Part of #7605