Skip to content

fix(auxiliary): honor api_mode in auxiliary client#7630

Closed
kshitijk4poor wants to merge 1 commit into
NousResearch:mainfrom
kshitijk4poor:fix/aux-api-mode
Closed

fix(auxiliary): honor api_mode in auxiliary client#7630
kshitijk4poor wants to merge 1 commit into
NousResearch:mainfrom
kshitijk4poor:fix/aux-api-mode

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Problem

The auxiliary client (auxiliary_client.py) 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.

Setting api_mode: codex_responses in auxiliary task config was silently ignored, causing 404s with "This is not a chat model".

Changes

  • Expand _resolve_task_provider_model return to include 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_clientresolve_provider_client
  • Add _needs_codex_wrap/_wrap_if_needed helpers that wrap plain OpenAI clients in CodexAuxiliaryClient when:
    • api_mode=codex_responses is explicitly set, OR
    • Auto-detection finds api.openai.com URL + codex model name 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

Config example

auxiliary:
  compression:
    model: gpt-5.3-codex
    base_url: https://api.openai.com/v1
    api_mode: codex_responses

Closes #6800
Part of #7605

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
@teknium1

Copy link
Copy Markdown
Contributor

Merged via #7647. Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks @kshitijk4poor!

@teknium1 teknium1 closed this Apr 11, 2026
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.

[Feature]: auxiliary_client.py should honor api_mode flag (parallel to runtime_provider.py)

2 participants