(
*,
selected_model: str,
provider_entry: Any,
upstream_provider: str,
upstream_base: str,
)
| 2138 | |
| 2139 | |
| 2140 | def _supports_native_anthropic_transport( |
| 2141 | *, |
| 2142 | selected_model: str, |
| 2143 | provider_entry: Any, |
| 2144 | upstream_provider: str, |
| 2145 | upstream_base: str, |
| 2146 | ) -> bool: |
| 2147 | family = provider_family_for_model( |
| 2148 | selected_model, |
| 2149 | provider_name=getattr(provider_entry, "name", None), |
| 2150 | upstream_provider=upstream_provider, |
| 2151 | ) |
| 2152 | if family not in {"anthropic", "minimax"}: |
| 2153 | return False |
| 2154 | target_base = getattr(provider_entry, "base_url", "") if provider_entry else upstream_base |
| 2155 | target_base = _anthropic_transport_base(target_base, family) |
| 2156 | target_lower = str(target_base or "").lower() |
| 2157 | if "commonstack.ai" in target_lower: |
| 2158 | return True |
| 2159 | if family == "anthropic": |
| 2160 | if "api.anthropic.com" in target_lower: |
| 2161 | return True |
| 2162 | return upstream_provider in {"anthropic", "commonstack"} |
| 2163 | if "/anthropic" in target_lower: |
| 2164 | return True |
| 2165 | if "api.minimax.io" in target_lower or "api.minimaxi.com" in target_lower: |
| 2166 | return True |
| 2167 | return upstream_provider in {"minimax", "commonstack", "openrouter"} |
| 2168 | |
| 2169 | |
| 2170 | def _choose_transport( |
no test coverage detected