mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-24 23:10:39 +08:00
5056978d80
Writing to the v12+ `providers:` dict broke every anthropic_messages provider. Hermes `runtime_provider.py::_get_named_custom_provider` has a bug in its `providers:` branch: the returned entry drops `api_mode`, `transport`, `models`, and singular `model:`, and `_resolve_named_custom_runtime` then falls back to `chat_completions` — so an Anthropic-format endpoint receives OpenAI-format requests and returns 404. Keep using the legacy `custom_providers:` list; its normalization path (`_normalize_custom_provider_entry`) preserves every field. In addition, write a singular `model:` alongside the plural `models:` dict so the Hermes runtime and `/model` picker see the default model id. Also keep the `apply_switch_defaults` fix from the prior attempt: `model.provider` is always updated, and `model.default` is only overwritten when the new provider declares at least one model — so switching to an incomplete provider no longer silently no-ops.