Skip to content

[codex] Add relay OpenAI fallback for non-Claude models#17

Open
Ge-Shun wants to merge 1 commit into
SuperJJ007:mainfrom
Ge-Shun:codex/relay-openai-fallback
Open

[codex] Add relay OpenAI fallback for non-Claude models#17
Ge-Shun wants to merge 1 commit into
SuperJJ007:mainfrom
Ge-Shun:codex/relay-openai-fallback

Conversation

@Ge-Shun

@Ge-Shun Ge-Shun commented Jul 5, 2026

Copy link
Copy Markdown

Summary

  • Add a relay fallback path for non-Claude model ids selected via CSSWITCH_RELAY_MODEL.
  • Route those models to {base_url}/v1/chat/completions and reuse the existing Anthropic-to-OpenAI bridge.
  • Keep Claude/Anthropic-looking models on the existing {base_url}/v1/messages relay path.

Why

Relay providers can expose GPT/OpenAI-compatible models in /v1/models, but those models may reject Anthropic /v1/messages calls with 403. This lets CSSwitch use those models through the provider's OpenAI-compatible chat completions endpoint while preserving existing Claude relay behavior.

Validation

  • python3 -m py_compile proxy/csswitch_proxy.py proxy/dsml_shim.py proxy/qwen_proxy.py test/test_proxy_units.py
  • python3 test/test_proxy_units.py
  • sh test/run_all.sh with local port access: Python/Node/main script suites passed; existing doctor ops script has one unrelated key-present assertion mismatch (CSSWITCH_KEY_PRESENT vs DEEPSEEK_API_KEY test setup).

@Ge-Shun Ge-Shun marked this pull request as ready for review July 5, 2026 02:47
@Ge-Shun Ge-Shun force-pushed the codex/relay-openai-fallback branch from e9e37fb to 1a0fcb7 Compare July 5, 2026 03:00
@Ge-Shun

Ge-Shun commented Jul 5, 2026

Copy link
Copy Markdown
Author

Updated the PR after real-machine testing: relay/openai now preserves upstream streaming for non-Claude models and converts OpenAI SSE chunks to Anthropic SSE. This avoids the 524 timeout seen when Claude Science sends the full 26-tool request to gpt-5.5.

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.

2 participants