mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-02 18:41:35 +08:00
feat: route Codex Chat providers through Stream Check
Codex Chat providers (apiFormat=openai_chat, e.g. DeepSeek, MiniMax, Kimi) were incorrectly probed via /v1/responses by Stream Check, which the upstream rejects. Detect chat routing via codex_provider_uses_chat_completions and issue the probe against /chat/completions with a Chat-shaped body. Also align URL fallback order with the production CodexAdapter::build_url: origin-only base URLs (https://api.deepseek.com) must hit /v1/<endpoint> first; bare /<endpoint> only as a fallback. The previous order made any non-404 error on the bare path (401/400/405) flag the provider as down even though /v1/<endpoint> would have succeeded. - Lift origin-only detection into proxy::providers::is_origin_only_url so both build_url and Stream Check share a single source of truth. - Collapse resolve_codex_stream_urls and resolve_codex_chat_stream_urls into a generic resolve_codex_endpoint_urls(base_url, is_full_url, endpoint), which also gives the Responses path a symmetric "full endpoint without is_full_url flag" fallback for free. - Restrict reasoning_effort propagation in the Chat branch to OpenAI o-series models, mirroring transform_codex_chat's runtime check.
This commit is contained in:
@@ -47,6 +47,7 @@ pub use claude::{
|
||||
pub use codex::CodexAdapter;
|
||||
pub use codex::{
|
||||
apply_codex_chat_upstream_model, codex_provider_upstream_model,
|
||||
codex_provider_uses_chat_completions, is_origin_only_url,
|
||||
should_convert_codex_responses_to_chat,
|
||||
};
|
||||
pub use gemini::GeminiAdapter;
|
||||
|
||||
Reference in New Issue
Block a user