Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)
Python
Make provider capabilities semantic and typed (#1047)
Ali Khokhar701a3946974b
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 38ef7c5c..c5031d86 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -376,7 +376,9 @@ otherwise they fall back to `MODEL`.The router also resolves thinking. Gateway model IDs can force thinking on oroff; otherwise `ModelRouter` applies tier-specific thinking overrides or the-global setting.+global setting. `ResolvedModel` carries the selected provider's immutable+`ProviderCapabilities`, so product policy reads explicit semantic capabilities+instead of inferring behavior from a provider ID or transport family.`GET /v1/models` advertises:@@ -386,7 +388,9 @@ global setting.- built-in Claude model IDs for compatibility with Claude clients.Provider model discovery and optional thinking metadata live in the-application-level catalog owned by `ProviderRuntimeManager`. The catalog is not+application-level catalog owned by `ProviderRuntimeManager`.+`ProviderModelInfo.supports_thinking` alone owns discovered per-model thinking+support; provider-wide capabilities do not model thinking. The catalog is notpart of an individual provider generation, so a hot replacement does not erasethe last useful model list. Discovery failures retain prior entries.@@ -400,15 +404,21 @@ passes it as `model_catalog_json`. Codex users open the native picker withProvider metadata is neutral and centralized in[config/provider_catalog.py](src/free_claude_code/config/provider_catalog.py). Each-`ProviderDescriptor` declares provider ID, transport type, capabilities,+`ProviderDescriptor` declares provider ID, immutable semantic capabilities,credential env var, default base URL, settings attribute names, and proxy support.+Capabilities describe product behavior such as locality and Anthropic server-tool+passthrough; they do not select a concrete adapter.[providers/runtime/](src/free_claude_code/providers/runtime/) owns construction details for oneclosable provider generation: factory wiring, provider configuration, lazy-provider instances, provider-owned rate limiters, and transport cleanup. Each-lazy provider receives a fresh `ProviderRateLimiter`; there is no process-singleton or second limiter registry. The provider cache already guarantees one-provider and limiter per provider ID within a generation. Retired generations+provider instances, provider-owned rate limiters, and transport cleanup. The+explicit factory table in+[providers/runtime/factory.py](src/free_claude_code/providers/runtime/factory.py)+owns provider-ID-to-constructor selection; concrete provider classes own their+transport inheritance or composition. Each lazy provider receives a fresh+`ProviderRateLimiter`; there is no process singleton or second limiter registry.+The provider cache already guarantees one provider and limiter per provider ID+within a generation. Retired generationsretain their own synchronization state until request leases drain, while newgenerations and separate server instances never reuse it. Hot replacementtherefore begins with fresh quota state; an old and new generation enforce@@ -673,14 +683,13 @@ Messages handler can stream local Anthropic server-tool responses without sendinrequest upstream. [api/web_tools/egress.py](src/free_claude_code/api/web_tools/egress.py) enforces URLscheme and private-network restrictions for `web_fetch`.-OpenAI-chat upstream providers are identified by-`ProviderDescriptor.transport_type == "openai_chat"` in-[config/provider_catalog.py](src/free_claude_code/config/provider_catalog.py). They cannot safely-represent Anthropic server-tool blocks, so the Messages handler rejects unsupported-server-tool requests before provider execution instead of performing a lossy-conversion. Forced `web_search` or `web_fetch` requests are handled locally when-`ENABLE_WEB_SERVER_TOOLS` is true; otherwise OpenAI-chat upstreams reject them-and the local native Anthropic Messages transports may receive them.+The Messages handler reads the routed model's+`ProviderCapabilities.server_tool_passthrough` value. Providers without this+capability reject unsupported server-tool requests before execution instead of+performing a lossy conversion. Forced `web_search` or `web_fetch` requests are+handled locally when `ENABLE_WEB_SERVER_TOOLS` is true; when local handling is+disabled, only providers declaring passthrough may receive those blocks. This+keeps product policy independent of provider IDs and transport implementation.## CLI Launchers And Managed Claudediff --git a/pyproject.toml b/pyproject.tomlindex 93879682..93f161a7 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "free-claude-code"-version = "3.4.21"+version = "3.4.22"description = "Middleware between Claude Code CLI (Anthropic API) and NVIDIA NIM"readme = "README.md"requires-python = ">=3.14.0"diff --git a/smoke/README.md b/smoke/README.mdindex 9ac7030a..17db8917 100644--- a/smoke/README.md+++ b/smoke/README.md@@ -63,7 +63,7 @@ Default targets do not send real bot messages or load voice backends:| `providers` | multi-turn text, adaptive thinking history, tools, disconnect, errors | configured providers, optional `FCC_SMOKE_MODEL_*` || `tools` | forced tool_use and tool_result continuation | tool-capable configured provider || `rate_limit` | disconnect cleanup and follow-up request | configured provider |-| `lmstudio` | local `/models` plus native `/messages` through proxy | running LM Studio server |+| `lmstudio` | local `/models` plus OpenAI-chat-backed Messages through proxy | running LM Studio server || `llamacpp` | local `/models` plus native `/messages` through proxy | running llama-server || `ollama` | local `/api/tags` plus native Anthropic messages through proxy | running Ollama server |diff --git a/smoke/capabilities.py b/smoke/capabilities.pyindex f78968bd..738069d2 100644--- a/smoke/capabilities.py+++ b/smoke/capabilities.py@@ -302,17 +302,14 @@ CAPABILITY_CONTRACTS: tuple[CapabilityContract, ...] = (),CapabilityContract("local_providers",- "lmstudio_native_messages",+ "lmstudio_messages","lmstudio_endpoint",- "free_claude_code.providers.transports.anthropic_messages.AnthropicMessagesTransport",- "Anthropic request body and local LM Studio URL",- "native /messages stream pass-through",- "SSE error event for local upstream failure",- (- "tests/providers/test_lmstudio.py",- "tests/providers/test_anthropic_messages.py",- ),- ("test_lmstudio_models_endpoint_when_available",),+ "free_claude_code.providers.lmstudio.LMStudioProvider",+ "Anthropic Messages request and local LM Studio URL",+ "Anthropic SSE converted from an OpenAI Chat upstream",+ "typed provider failure for local upstream errors",+ ("tests/providers/test_lmstudio.py",),+ ("test_lmstudio_messages_e2e",),),CapabilityContract("local_providers",diff --git a/smoke/features.py b/smoke/features.pyindex 85318aea..08c2828c 100644--- a/smoke/features.py+++ b/smoke/features.py@@ -363,14 +363,11 @@ FEATURE_INVENTORY: tuple[FeatureCoverage, ...] = (),FeatureCoverage("lmstudio_endpoint",- "LM Studio native messages and local no-key operation work when running",+ "LM Studio Messages and local no-key operation work when running","public_surface",- (- "tests/providers/test_lmstudio.py",- "tests/providers/test_anthropic_messages.py",- ),+ ("tests/providers/test_lmstudio.py",),("test_lmstudio_models_endpoint_when_available",),- ("test_lmstudio_native_messages_e2e",),+ ("test_lmstudio_messages_e2e",),("lmstudio",),("LM_STUDIO_BASE_URL with running LM Studio server",),"skip when local upstream is unavailable",diff --git a/smoke/lib/config.py b/smoke/lib/config.pyindex 17b764b9..2a4bc490 100644--- a/smoke/lib/config.py+++ b/smoke/lib/config.py@@ -239,7 +239,7 @@ class SmokeConfig:self, provider: str, mapped_providers: set[str]) -> bool:descriptor = PROVIDER_CATALOG[provider]- if "local" not in descriptor.capabilities:+ if not descriptor.capabilities.local:return Trueif provider in mapped_providers:return Truediff --git a/smoke/product/test_local_provider_product_live.py b/smoke/product/test_local_provider_product_live.pyindex 3b5b2147..a1e9e27b 100644--- a/smoke/product/test_local_provider_product_live.py+++ b/smoke/product/test_local_provider_product_live.py@@ -8,8 +8,8 @@ pytestmark = [pytest.mark.live]@pytest.mark.smoke_target("lmstudio")-def test_lmstudio_native_messages_e2e(smoke_config: SmokeConfig) -> None:- _local_native_messages_e2e(+def test_lmstudio_messages_e2e(smoke_config: SmokeConfig) -> None:+ _local_provider_messages_e2e(smoke_config,provider="lmstudio",base_url=smoke_config.settings.lm_studio_base_url,@@ -18,7 +18,7 @@ def test_lmstudio_native_messages_e2e(smoke_config: SmokeConfig) -> None:@pytest.mark.smoke_target("llamacpp")def test_llamacpp_native_messages_e2e(smoke_config: SmokeConfig) -> None:- _local_native_messages_e2e(+ _local_provider_messages_e2e(smoke_config,provider="llamacpp",base_url=smoke_config.settings.llamacpp_base_url,@@ -27,14 +27,14 @@ def test_llamacpp_native_messages_e2e(smoke_config: SmokeConfig) -> None:@pytest.mark.smoke_target("ollama")def test_ollama_native_messages_e2e(smoke_config: SmokeConfig) -> None:- _local_native_messages_e2e(+ _local_provider_messages_e2e(smoke_config,provider="ollama",base_url=smoke_config.settings.ollama_base_url,)-def _local_native_messages_e2e(+def _local_provider_messages_e2e(smoke_config: SmokeConfig,*,provider: str,@@ -48,7 +48,7 @@ def _local_native_messages_e2e(with SmokeServerDriver(smoke_config,- name=f"product-{provider}-native",+ name=f"product-{provider}-messages",env_overrides={"MODEL": f"{provider}/{model_id}", "MESSAGING_PLATFORM": "none"},).run() as server:turn = ConversationDriver(server, smoke_config).ask(diff --git a/smoke/product/test_provider_product_live.py b/smoke/product/test_provider_product_live.pyindex 00a6746c..3006e9d4 100644--- a/smoke/product/test_provider_product_live.py+++ b/smoke/product/test_provider_product_live.py@@ -4,7 +4,6 @@ import httpximport pytestfrom free_claude_code.application.routing import ModelRouter-from free_claude_code.config.provider_catalog import PROVIDER_CATALOGfrom free_claude_code.core.anthropic.stream_contracts import (SSEEvent,parse_sse_lines,@@ -96,8 +95,8 @@ def test_gemini_thought_signature_tool_continuation_e2e(def test_provider_reasoning_tool_continuation_e2e(smoke_config: SmokeConfig, provider_model: ProviderModel) -> None:- if not _provider_smoke_thinking_enabled(smoke_config, provider_model):- pytest.skip(f"{provider_model.provider} smoke model does not enable thinking")+ if not _provider_smoke_thinking_enabled(smoke_config):+ pytest.skip("the configured Claude route does not enable thinking")_run_provider_scenario(smoke_config, provider_model, _scenario_reasoning_tool_continuation)@@ -262,13 +261,9 @@ def _tool_use_blocks_or_skip(return blocks-def _provider_smoke_thinking_enabled(- smoke_config: SmokeConfig, provider_model: ProviderModel-) -> bool:- descriptor = PROVIDER_CATALOG[provider_model.provider]+def _provider_smoke_thinking_enabled(smoke_config: SmokeConfig) -> bool:return (- "thinking" in descriptor.capabilities- and ModelRouter(smoke_config.settings)+ ModelRouter(smoke_config.settings).resolve("claude-sonnet-4-5-20250929").thinking_enabled)diff --git a/src/free_claude_code/api/handlers/messages.py b/src/free_claude_code/api/handlers/messages.pyindex 210de22f..d6e9846a 100644--- a/src/free_claude_code/api/handlers/messages.py+++ b/src/free_claude_code/api/handlers/messages.py@@ -28,14 +28,13 @@ from free_claude_code.api.web_tools.egress import ()from free_claude_code.api.web_tools.request import (is_web_server_tool_request,- openai_chat_upstream_server_tool_error,+ unsupported_server_tool_error,)from free_claude_code.api.web_tools.streaming import stream_web_server_tool_responsefrom free_claude_code.application.errors import ApplicationError, InvalidRequestErrorfrom free_claude_code.application.execution import ProviderExecutor, TokenCounterfrom free_claude_code.application.ports import ProviderResolverfrom free_claude_code.application.routing import ModelRouter, RoutedMessagesRequest-from free_claude_code.config.provider_catalog import PROVIDER_CATALOGfrom free_claude_code.config.settings import Settingsfrom free_claude_code.core.anthropic import (MessagesRequest,@@ -50,12 +49,6 @@ from free_claude_code.core.diagnostics import safe_exception_messagefrom free_claude_code.core.failures import ExecutionFailure, find_execution_failurefrom free_claude_code.core.trace import trace_event-_OPENAI_CHAT_UPSTREAM_IDS = frozenset(- provider_id- for provider_id, descriptor in PROVIDER_CATALOG.items()- if descriptor.transport_type == "openai_chat"-)-@dataclass(frozen=True)class _MessagesStreamResult:@@ -266,9 +259,9 @@ class MessagesHandler:)def _reject_unsupported_server_tools(self, routed: RoutedMessagesRequest) -> None:- if routed.resolved.provider_id not in _OPENAI_CHAT_UPSTREAM_IDS:+ if routed.resolved.capabilities.server_tool_passthrough:return- tool_err = openai_chat_upstream_server_tool_error(+ tool_err = unsupported_server_tool_error(routed.request,web_tools_enabled=self._settings.enable_web_server_tools,)diff --git a/src/free_claude_code/api/web_tools/request.py b/src/free_claude_code/api/web_tools/request.pyindex 227f18f5..2d3ba484 100644--- a/src/free_claude_code/api/web_tools/request.py+++ b/src/free_claude_code/api/web_tools/request.py@@ -62,10 +62,10 @@ def has_listed_anthropic_server_tools(request: MessagesRequest) -> bool:return any(is_anthropic_server_tool_definition(t) for t in (request.tools or []))-def openai_chat_upstream_server_tool_error(+def unsupported_server_tool_error(request: MessagesRequest, *, web_tools_enabled: bool) -> str | None:- """Return a user-facing error when OpenAI Chat upstream cannot satisfy server-tool semantics."""+ """Return the user-facing error when the resolved provider cannot run server tools."""forced = forced_server_tool_name(request)if forced and not web_tools_enabled:return (diff --git a/src/free_claude_code/application/errors.py b/src/free_claude_code/application/errors.pyindex c004388c..f6f348f2 100644--- a/src/free_claude_code/application/errors.py+++ b/src/free_claude_code/application/errors.py@@ -1,5 +1,7 @@"""Deterministic application and readiness errors."""+from collections.abc import Iterable+from free_claude_code.core.failures import FailureKind@@ -24,6 +26,13 @@ class InvalidRequestError(ApplicationError):class UnknownProviderError(InvalidRequestError):"""The configured provider identifier is not registered."""+ @classmethod+ def for_provider(+ cls, provider_id: str, supported_provider_ids: Iterable[str]+ ) -> UnknownProviderError:+ supported = "', '".join(supported_provider_ids)+ return cls(f"Unknown provider_type: '{provider_id}'. Supported: '{supported}'")+class ApplicationUnavailableError(ApplicationError):"""The application cannot currently provide a request runtime."""diff --git a/src/free_claude_code/application/routing.py b/src/free_claude_code/application/routing.pyindex a026a45b..be59c984 100644--- a/src/free_claude_code/application/routing.py+++ b/src/free_claude_code/application/routing.py@@ -4,8 +4,13 @@ from dataclasses import dataclassfrom loguru import logger+from free_claude_code.application.errors import UnknownProviderErrorfrom free_claude_code.config.model_refs import parse_model_name, parse_provider_type-from free_claude_code.config.provider_ids import SUPPORTED_PROVIDER_IDS+from free_claude_code.config.provider_catalog import (+ PROVIDER_CATALOG,+ SUPPORTED_PROVIDER_IDS,+ ProviderCapabilities,+)from free_claude_code.config.settings import Settingsfrom free_claude_code.core.anthropic import MessagesRequest, TokenCountRequestfrom free_claude_code.core.gateway_model_ids import decode_gateway_model_id@@ -18,6 +23,7 @@ class ResolvedModel:provider_model: strprovider_model_ref: strthinking_enabled: bool+ capabilities: ProviderCapabilities@dataclass(frozen=True, slots=True)@@ -63,6 +69,7 @@ class ModelRouter:provider_model=direct_provider_model,provider_model_ref=claude_model_name,thinking_enabled=thinking_enabled,+ capabilities=self._provider_capabilities(direct_provider_id),)provider_model_ref = self._resolve_model_ref(claude_model_name)@@ -79,8 +86,16 @@ class ModelRouter:provider_model=provider_model,provider_model_ref=provider_model_ref,thinking_enabled=thinking_enabled,+ capabilities=self._provider_capabilities(provider_id),)+ @staticmethod+ def _provider_capabilities(provider_id: str) -> ProviderCapabilities:+ descriptor = PROVIDER_CATALOG.get(provider_id)+ if descriptor is None:+ raise UnknownProviderError.for_provider(provider_id, PROVIDER_CATALOG)+ return descriptor.capabilities+def _direct_provider_model(self, model_name: str) -> tuple[str | None, str | None, bool | None]:diff --git a/src/free_claude_code/config/admin/status.py b/src/free_claude_code/config/admin/status.pyindex adfa2a55..bb5bd616 100644--- a/src/free_claude_code/config/admin/status.py+++ b/src/free_claude_code/config/admin/status.py@@ -14,7 +14,7 @@ def provider_config_status("""Return provider configuration status without making network calls."""statuses: list[dict[str, Any]] = []for provider_id, descriptor in PROVIDER_CATALOG.items():- if descriptor.credential_env is None:+ if descriptor.capabilities.local:base_url = ""if descriptor.base_url_attr is not None:base_url = _value_for_settings_attr(state, descriptor.base_url_attr)diff --git a/src/free_claude_code/config/provider_catalog.py b/src/free_claude_code/config/provider_catalog.pyindex 114e8da5..9c662626 100644--- a/src/free_claude_code/config/provider_catalog.py+++ b/src/free_claude_code/config/provider_catalog.py@@ -5,9 +5,6 @@ provider implementation imports (see contract tests)."""from dataclasses import dataclass-from typing import Literal--TransportType = Literal["openai_chat", "anthropic_messages"]# Default upstream base URLs (also re-exported via :mod:`providers.defaults`)NVIDIA_NIM_DEFAULT_BASE = "https://integrate.api.nvidia.com/v1"@@ -42,14 +39,21 @@ CEREBRAS_DEFAULT_BASE = "https://api.cerebras.ai/v1"SAMBANOVA_DEFAULT_BASE = "https://api.sambanova.ai/v1"+@dataclass(frozen=True, slots=True)+class ProviderCapabilities:+ """Static provider semantics used by application policy."""++ local: bool = False+ server_tool_passthrough: bool = False++@dataclass(frozen=True, slots=True)class ProviderDescriptor:"""Metadata for building :class:`~providers.base.ProviderConfig` and factory wiring."""provider_id: strdisplay_name: str- transport_type: TransportType- capabilities: tuple[str, ...]+ capabilities: ProviderCapabilities = ProviderCapabilities()credential_env: str | None = Nonecredential_url: str | None = Nonecredential_attr: str | None = None@@ -63,295 +67,220 @@ PROVIDER_CATALOG: dict[str, ProviderDescriptor] = {"nvidia_nim": ProviderDescriptor(provider_id="nvidia_nim",display_name="NVIDIA NIM",- transport_type="openai_chat",credential_env="NVIDIA_NIM_API_KEY",credential_url="https://build.nvidia.com/settings/api-keys",credential_attr="nvidia_nim_api_key",default_base_url=NVIDIA_NIM_DEFAULT_BASE,proxy_attr="nvidia_nim_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"open_router": ProviderDescriptor(provider_id="open_router",display_name="OpenRouter",- transport_type="openai_chat",credential_env="OPENROUTER_API_KEY",credential_url="https://openrouter.ai/keys",credential_attr="open_router_api_key",default_base_url=OPENROUTER_DEFAULT_BASE,proxy_attr="open_router_proxy",- capabilities=("chat", "streaming", "tools", "thinking"),),"gemini": ProviderDescriptor(provider_id="gemini",display_name="Gemini",- transport_type="openai_chat",credential_env="GEMINI_API_KEY",credential_url="https://aistudio.google.com/apikey",credential_attr="gemini_api_key",default_base_url=GEMINI_DEFAULT_BASE,proxy_attr="gemini_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"deepseek": ProviderDescriptor(provider_id="deepseek",display_name="DeepSeek",- transport_type="openai_chat",credential_env="DEEPSEEK_API_KEY",credential_url="https://platform.deepseek.com/api_keys",credential_attr="deepseek_api_key",default_base_url=DEEPSEEK_DEFAULT_BASE,- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"mistral": ProviderDescriptor(provider_id="mistral",display_name="Mistral",- transport_type="openai_chat",credential_env="MISTRAL_API_KEY",credential_url="https://console.mistral.ai/",credential_attr="mistral_api_key",default_base_url=MISTRAL_DEFAULT_BASE,proxy_attr="mistral_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"mistral_codestral": ProviderDescriptor(provider_id="mistral_codestral",display_name="Mistral Codestral",- transport_type="openai_chat",credential_env="CODESTRAL_API_KEY",credential_url="https://console.mistral.ai/",credential_attr="codestral_api_key",default_base_url=CODESTRAL_DEFAULT_BASE,proxy_attr="codestral_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"opencode": ProviderDescriptor(provider_id="opencode",display_name="OpenCode Zen",- transport_type="openai_chat",credential_env="OPENCODE_API_KEY",credential_url="https://opencode.ai/auth",credential_attr="opencode_api_key",default_base_url=OPENCODE_DEFAULT_BASE,proxy_attr="opencode_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"opencode_go": ProviderDescriptor(provider_id="opencode_go",display_name="OpenCode Go",- transport_type="openai_chat",credential_env="OPENCODE_API_KEY",credential_url="https://opencode.ai/auth",credential_attr="opencode_api_key",default_base_url=OPENCODE_GO_DEFAULT_BASE,proxy_attr="opencode_go_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"vercel": ProviderDescriptor(provider_id="vercel",display_name="Vercel AI Gateway",- transport_type="openai_chat",credential_env="AI_GATEWAY_API_KEY",credential_url="https://vercel.com/docs/ai-gateway",credential_attr="vercel_ai_gateway_api_key",default_base_url=VERCEL_AI_GATEWAY_DEFAULT_BASE,proxy_attr="vercel_ai_gateway_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"huggingface": ProviderDescriptor(provider_id="huggingface",display_name="Hugging Face",- transport_type="openai_chat",credential_env="HUGGINGFACE_API_KEY",credential_url="https://huggingface.co/settings/tokens",credential_attr="huggingface_api_key",default_base_url=HUGGINGFACE_DEFAULT_BASE,proxy_attr="huggingface_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"cohere": ProviderDescriptor(provider_id="cohere",display_name="Cohere",- transport_type="openai_chat",credential_env="COHERE_API_KEY",credential_url="https://dashboard.cohere.com/api-keys",credential_attr="cohere_api_key",default_base_url=COHERE_DEFAULT_BASE,proxy_attr="cohere_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"github_models": ProviderDescriptor(provider_id="github_models",display_name="GitHub Models",- transport_type="openai_chat",credential_env="GITHUB_MODELS_TOKEN",credential_url="https://github.com/settings/tokens",credential_attr="github_models_token",default_base_url=GITHUB_MODELS_DEFAULT_BASE,proxy_attr="github_models_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"wafer": ProviderDescriptor(provider_id="wafer",display_name="Wafer",- transport_type="openai_chat",credential_env="WAFER_API_KEY",credential_url="https://www.wafer.ai/pass",credential_attr="wafer_api_key",default_base_url=WAFER_DEFAULT_BASE,proxy_attr="wafer_proxy",- capabilities=("chat", "streaming", "tools", "thinking"),),"kimi": ProviderDescriptor(provider_id="kimi",display_name="Kimi",- transport_type="openai_chat",credential_env="KIMI_API_KEY",credential_url="https://platform.moonshot.cn/console/api-keys",credential_attr="kimi_api_key",default_base_url=KIMI_DEFAULT_BASE,proxy_attr="kimi_proxy",- capabilities=(- "chat",- "streaming",- "tools",- "thinking",- ),),"minimax": ProviderDescriptor(provider_id="minimax",display_name="MiniMax",- transport_type="openai_chat",credential_env="MINIMAX_API_KEY",credential_url="https://platform.minimax.io/user-center/basic-information/interface-key",credential_attr="minimax_api_key",default_base_url=MINIMAX_DEFAULT_BASE,proxy_attr="minimax_proxy",- capabilities=(- "chat",- "streaming",- "tools",- "thinking",- "rate_limit",- ),),"cerebras": ProviderDescriptor(provider_id="cerebras",display_name="Cerebras",- transport_type="openai_chat",credential_env="CEREBRAS_API_KEY",credential_url="https://cloud.cerebras.ai",credential_attr="cerebras_api_key",default_base_url=CEREBRAS_DEFAULT_BASE,proxy_attr="cerebras_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"groq": ProviderDescriptor(provider_id="groq",display_name="Groq",- transport_type="openai_chat",credential_env="GROQ_API_KEY",credential_url="https://console.groq.com/keys",credential_attr="groq_api_key",default_base_url=GROQ_DEFAULT_BASE,proxy_attr="groq_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"sambanova": ProviderDescriptor(provider_id="sambanova",display_name="SambaNova",- transport_type="openai_chat",credential_env="SAMBANOVA_API_KEY",credential_url="https://cloud.sambanova.ai/apis",credential_attr="sambanova_api_key",default_base_url=SAMBANOVA_DEFAULT_BASE,proxy_attr="sambanova_proxy",- capabilities=("chat", "streaming", "tools", "thinking", "rate_limit"),),"fireworks": ProviderDescriptor(provider_id="fireworks",display_name="Fireworks",- transport_type="openai_chat",credential_env="FIREWORKS_API_KEY",credential_url="https://fireworks.ai/account/api-keys",credential_attr="fireworks_api_key",default_base_url=FIREWORKS_DEFAULT_BASE,proxy_attr="fireworks_proxy",- capabilities=(- "chat",- "streaming",- "tools",- "thinking",- "rate_limit",- ),),"cloudflare": ProviderDescriptor(provider_id="cloudflare",display_name="Cloudflare",- transport_type="openai_chat",credential_env="CLOUDFLARE_API_TOKEN",credential_url="https://dash.cloudflare.com/profile/api-tokens",credential_attr="cloudflare_api_token",default_base_url=CLOUDFLARE_AI_REST_ROOT,proxy_attr="cloudflare_proxy",- capabilities=(- "chat",- "streaming",- "tools",- "thinking",- "rate_limit",- ),),"zai": ProviderDescriptor(provider_id="zai",display_name="Z.ai",- transport_type="openai_chat",credential_env="ZAI_API_KEY",credential_attr="zai_api_key",default_base_url=ZAI_DEFAULT_BASE,proxy_attr="zai_proxy",- capabilities=(- "chat",- "streaming",- "tools",- "thinking",- "rate_limit",- ),),"lmstudio": ProviderDescriptor(provider_id="lmstudio",display_name="LM Studio",- transport_type="openai_chat",static_credential="lm-studio",default_base_url=LMSTUDIO_DEFAULT_BASE,base_url_attr="lm_studio_base_url",proxy_attr="lmstudio_proxy",- capabilities=("chat", "streaming", "tools", "local"),+ capabilities=ProviderCapabilities(local=True),),"llamacpp": ProviderDescriptor(provider_id="llamacpp",display_name="llama.cpp",- transport_type="anthropic_messages",static_credential="llamacpp",default_base_url=LLAMACPP_DEFAULT_BASE,base_url_attr="llamacpp_base_url",proxy_attr="llamacpp_proxy",- capabilities=("chat", "streaming", "tools", "native_anthropic", "local"),+ capabilities=ProviderCapabilities(+ local=True,+ server_tool_passthrough=True,+ ),),"ollama": ProviderDescriptor(provider_id="ollama",display_name="Ollama",- transport_type="anthropic_messages",static_credential="ollama",default_base_url=OLLAMA_DEFAULT_BASE,base_url_attr="ollama_base_url",- capabilities=(- "chat",- "streaming",- "tools",- "thinking",- "native_anthropic",- "local",+ capabilities=ProviderCapabilities(+ local=True,+ server_tool_passthrough=True,),),}diff --git a/src/free_claude_code/providers/runtime/discovery.py b/src/free_claude_code/providers/runtime/discovery.pyindex 67bff042..d9f6c95f 100644--- a/src/free_claude_code/providers/runtime/discovery.py+++ b/src/free_claude_code/providers/runtime/discovery.py@@ -28,7 +28,7 @@ def model_list_provider_ids_for_settings(settings: Settings) -> tuple[str, ...]:referenced_ids = referenced_provider_ids(settings)provider_ids: list[str] = []for provider_id, descriptor in PROVIDER_CATALOG.items():- if descriptor.static_credential is not None:+ if descriptor.capabilities.local:if provider_id in referenced_ids:provider_ids.append(provider_id)continuediff --git a/src/free_claude_code/providers/runtime/factory.py b/src/free_claude_code/providers/runtime/factory.pyindex d6396051..19a201a6 100644--- a/src/free_claude_code/providers/runtime/factory.py+++ b/src/free_claude_code/providers/runtime/factory.py@@ -311,10 +311,7 @@ def create_provider(provider_id: str, settings: Settings) -> BaseProvider:"""Create a provider instance for a supported provider id."""descriptor = PROVIDER_CATALOG.get(provider_id)if descriptor is None:- supported = "', '".join(PROVIDER_CATALOG)- raise UnknownProviderError(- f"Unknown provider_type: '{provider_id}'. Supported: '{supported}'"- )+ raise UnknownProviderError.for_provider(provider_id, PROVIDER_CATALOG)factory = PROVIDER_FACTORIES.get(provider_id)if factory is None:diff --git a/tests/api/test_web_server_tools.py b/tests/api/test_web_server_tools.pyindex d1463ed3..1fe48420 100644--- a/tests/api/test_web_server_tools.py+++ b/tests/api/test_web_server_tools.py@@ -27,7 +27,10 @@ from free_claude_code.application.routing import (ResolvedModel,RoutedMessagesRequest,)-from free_claude_code.config.provider_catalog import PROVIDER_CATALOG+from free_claude_code.config.provider_catalog import (+ PROVIDER_CATALOG,+ ProviderCapabilities,+)from free_claude_code.config.settings import Settingsfrom free_claude_code.core.anthropic.models import Message, MessagesRequest, Toolfrom free_claude_code.core.anthropic.stream_contracts import (@@ -41,24 +44,35 @@ _STRICT_EGRESS = WebFetchEgressPolicy(allow_private_network_targets=False,allowed_schemes=frozenset({"http", "https"}),)-_OPENAI_CHAT_PROVIDER_IDS = tuple(+_NO_SERVER_TOOL_PASSTHROUGH_PROVIDER_IDS = tuple(provider_idfor provider_id, descriptor in PROVIDER_CATALOG.items()- if descriptor.transport_type == "openai_chat"+ if not descriptor.capabilities.server_tool_passthrough)-_ANTHROPIC_MESSAGES_PROVIDER_IDS = tuple(+_SERVER_TOOL_PASSTHROUGH_PROVIDER_IDS = tuple(provider_idfor provider_id, descriptor in PROVIDER_CATALOG.items()- if descriptor.transport_type == "anthropic_messages"+ if descriptor.capabilities.server_tool_passthrough)class FixedProviderModelRouter(ModelRouter):- """Test double: pin ``provider_id`` for OpenAI vs native routing assertions."""-- def __init__(self, settings: Settings, provider_id: str) -> None:+ """Test double: pin provider identity and semantic capabilities."""++ def __init__(+ self,+ settings: Settings,+ provider_id: str,+ *,+ capabilities: ProviderCapabilities | None = None,+ ) -> None:super().__init__(settings)self._fixed_provider_id = provider_id+ self._fixed_capabilities = (+ PROVIDER_CATALOG[provider_id].capabilities+ if capabilities is None+ else capabilities+ )def resolve_messages_request(self, request: MessagesRequest@@ -69,6 +83,7 @@ class FixedProviderModelRouter(ModelRouter):provider_model=request.model,provider_model_ref=f"{self._fixed_provider_id}/{request.model}",thinking_enabled=False,+ capabilities=self._fixed_capabilities,)routed = request.model_copy(deep=True)routed.model = resolved.provider_model@@ -112,11 +127,11 @@ def test_web_server_tool_not_detected_when_forced_name_missing_from_tools():@pytest.mark.asyncio[email protected]("provider_id", _OPENAI_CHAT_PROVIDER_IDS)-async def test_service_rejects_forced_server_tool_on_openai_when_disabled([email protected]("provider_id", _NO_SERVER_TOOL_PASSTHROUGH_PROVIDER_IDS)+async def test_service_rejects_forced_server_tool_without_passthrough_when_disabled(provider_id: str,):- """OpenAI Chat upstreams cannot run forced server tools without the local handler."""+ """Non-passthrough providers need the local handler for forced server tools."""settings = Settings()assert settings.enable_web_server_tools is Falseservice = MessagesHandler(@@ -421,7 +436,9 @@ async def test_service_streams_forced_web_search_by_default(monkeypatch):service = MessagesHandler(settings,provider_resolver=provider_resolver,- model_router=FixedProviderModelRouter(settings, _OPENAI_CHAT_PROVIDER_IDS[0]),+ model_router=FixedProviderModelRouter(+ settings, _NO_SERVER_TOOL_PASSTHROUGH_PROVIDER_IDS[0]+ ),)request = MessagesRequest(model="claude-haiku-4-5-20251001",@@ -454,7 +471,9 @@ async def test_service_aggregates_forced_web_search_when_stream_false(monkeypatcservice = MessagesHandler(settings,provider_resolver=provider_resolver,- model_router=FixedProviderModelRouter(settings, _OPENAI_CHAT_PROVIDER_IDS[0]),+ model_router=FixedProviderModelRouter(+ settings, _NO_SERVER_TOOL_PASSTHROUGH_PROVIDER_IDS[0]+ ),)request = MessagesRequest(model="claude-haiku-4-5-20251001",@@ -545,7 +564,9 @@ async def test_service_aggregates_forced_web_fetch_when_stream_false(monkeypatchservice = MessagesHandler(settings,provider_resolver=provider_resolver,- model_router=FixedProviderModelRouter(settings, _OPENAI_CHAT_PROVIDER_IDS[0]),+ model_router=FixedProviderModelRouter(+ settings, _NO_SERVER_TOOL_PASSTHROUGH_PROVIDER_IDS[0]+ ),)request = MessagesRequest(model="claude-haiku-4-5-20251001",@@ -752,8 +773,8 @@ async def test_drain_response_body_capped_stops_after_first_chunk_when_oversized@pytest.mark.asyncio[email protected]("provider_id", _OPENAI_CHAT_PROVIDER_IDS)-async def test_service_rejects_listed_server_tools_on_openai_chat([email protected]("provider_id", _NO_SERVER_TOOL_PASSTHROUGH_PROVIDER_IDS)+async def test_service_rejects_listed_server_tools_without_passthrough(provider_id: str,) -> None:settings = Settings()@@ -773,11 +794,11 @@ async def test_service_rejects_listed_server_tools_on_openai_chat(@pytest.mark.asyncio[email protected]("provider_id", _ANTHROPIC_MESSAGES_PROVIDER_IDS)-async def test_listed_server_tools_routed_on_anthropic_messages_providers([email protected]("provider_id", _SERVER_TOOL_PASSTHROUGH_PROVIDER_IDS)+async def test_listed_server_tools_routed_on_passthrough_providers(provider_id: str,) -> None:- """Native Anthropic transports may receive listed server tool definitions."""+ """Passthrough providers may receive listed server tool definitions."""settings = Settings()async def fake_stream(*_a, **_k):@@ -802,11 +823,11 @@ async def test_listed_server_tools_routed_on_anthropic_messages_providers(@pytest.mark.asyncio[email protected]("provider_id", _ANTHROPIC_MESSAGES_PROVIDER_IDS)-async def test_forced_server_tools_routed_on_anthropic_messages_providers_when_local_disabled([email protected]("provider_id", _SERVER_TOOL_PASSTHROUGH_PROVIDER_IDS)+async def test_forced_server_tools_routed_on_passthrough_providers_when_local_disabled(provider_id: str,) -> None:- """Native Anthropic transports may receive forced server tools when local tools are off."""+ """Passthrough providers may receive forced server tools when local tools are off."""settings = Settings()async def fake_stream(*_a, **_k):@@ -829,3 +850,67 @@ async def test_forced_server_tools_routed_on_anthropic_messages_providers_when_l)await service.create(request)mock_provider.preflight_stream.assert_called()+++async def test_server_tool_policy_accepts_capability_not_identity() -> None:+ provider_id = "nvidia_nim"+ assert not PROVIDER_CATALOG[provider_id].capabilities.server_tool_passthrough++ async def fake_stream(*_a, **_k):+ yield 'event: message_start\ndata: {"type":"message_start"}\n\n'+ yield 'event: message_stop\ndata: {"type":"message_stop"}\n\n'++ mock_provider = MagicMock()+ mock_provider.stream_response = fake_stream+ provider_resolver = MagicMock(return_value=mock_provider)+ settings = Settings()+ service = MessagesHandler(+ settings,+ provider_resolver=provider_resolver,+ model_router=FixedProviderModelRouter(+ settings,+ provider_id,+ capabilities=ProviderCapabilities(server_tool_passthrough=True),+ ),+ )+ request = MessagesRequest(+ model="m",+ max_tokens=20,+ messages=[Message(role="user", content="q")],+ tools=[Tool(name="web_search", type="web_search_20250305")],+ )++ await service.create(request)++ provider_resolver.assert_called_once_with(provider_id)+ mock_provider.preflight_stream.assert_called_once()+++async def test_server_tool_policy_rejects_capability_not_identity() -> None:+ provider_id = "ollama"+ assert PROVIDER_CATALOG[provider_id].capabilities.server_tool_passthrough++ provider_resolver = MagicMock()+ settings = Settings()+ service = MessagesHandler(+ settings,+ provider_resolver=provider_resolver,+ model_router=FixedProviderModelRouter(+ settings,+ provider_id,+ capabilities=ProviderCapabilities(server_tool_passthrough=False),+ ),+ )+ request = MessagesRequest(+ model="m",+ max_tokens=20,+ messages=[Message(role="user", content="q")],+ tools=[Tool(name="web_search", type="web_search_20250305")],+ )++ with pytest.raises(InvalidRequestError, match="OpenAI Chat upstreams"):+ await service.create(request)++ provider_resolver.assert_not_called()diff --git a/tests/application/test_execution.py b/tests/application/test_execution.pyindex 844fbb01..7922a804 100644--- a/tests/application/test_execution.py+++ b/tests/application/test_execution.py@@ -7,6 +7,7 @@ import pytestfrom free_claude_code.application.execution import ProviderExecutorfrom free_claude_code.application.routing import ResolvedModel, RoutedMessagesRequest+from free_claude_code.config.provider_catalog import ProviderCapabilitiesfrom free_claude_code.core.anthropic.models import Message, MessagesRequest@@ -65,6 +66,7 @@ def _routed_request() -> RoutedMessagesRequest:provider_model="provider-model",provider_model_ref="provider/provider-model",thinking_enabled=True,+ capabilities=ProviderCapabilities(),),)diff --git a/tests/application/test_routing.py b/tests/application/test_routing.pyindex ac855542..b961e36b 100644--- a/tests/application/test_routing.py+++ b/tests/application/test_routing.py@@ -2,7 +2,9 @@ from unittest.mock import patchimport pytest-from free_claude_code.application.routing import ModelRouter+from free_claude_code.application.errors import UnknownProviderError+from free_claude_code.application.routing import ModelRouter, ResolvedModel+from free_claude_code.config.provider_catalog import PROVIDER_CATALOGfrom free_claude_code.config.settings import Settingsfrom free_claude_code.core.anthropic.models import (Message,@@ -25,6 +27,10 @@ def settings():return settings+def assert_exact_catalog_capabilities(resolved: ResolvedModel) -> None:+ assert resolved.capabilities is PROVIDER_CATALOG[resolved.provider_id].capabilities++def test_model_router_resolves_default_model(settings):resolved = ModelRouter(settings).resolve("claude-3-opus")@@ -33,6 +39,7 @@ def test_model_router_resolves_default_model(settings):assert resolved.provider_model == "fallback-model"assert resolved.provider_model_ref == "nvidia_nim/fallback-model"assert resolved.thinking_enabled is True+ assert_exact_catalog_capabilities(resolved)def test_model_router_applies_opus_override(settings):@@ -78,6 +85,7 @@ def test_model_router_applies_haiku_override(settings):assert routed.request.model == "qwen2.5-7b"assert routed.resolved.provider_model_ref == "lmstudio/qwen2.5-7b"+ assert_exact_catalog_capabilities(routed.resolved)def test_model_router_applies_sonnet_override(settings):@@ -111,6 +119,7 @@ def test_model_router_routes_prefixed_provider_model_directly(settings):assert routed.resolved.provider_id == "deepseek"assert routed.resolved.provider_model == "deepseek-chat"assert routed.resolved.provider_model_ref == "deepseek/deepseek-chat"+ assert_exact_catalog_capabilities(routed.resolved)def test_model_router_routes_wafer_provider_model_directly(settings):@@ -163,6 +172,7 @@ def test_model_router_routes_gateway_encoded_provider_model_directly(settings):routed.resolved.provider_model_ref== "anthropic/nvidia_nim/deepseek-ai/deepseek-v4-pro")+ assert_exact_catalog_capabilities(routed.resolved)def test_model_router_routes_no_thinking_gateway_model_directly(settings):@@ -184,6 +194,7 @@ def test_model_router_routes_no_thinking_gateway_model_directly(settings):assert routed.resolved.provider_id == "nvidia_nim"assert routed.resolved.provider_model == "deepseek-ai/deepseek-v4-pro"assert routed.resolved.thinking_enabled is False+ assert_exact_catalog_capabilities(routed.resolved)def test_model_router_direct_prefixed_model_uses_provider_model_for_thinking(settings):@@ -195,6 +206,7 @@ def test_model_router_direct_prefixed_model_uses_provider_model_for_thinking(setassert resolved.provider_id == "open_router"assert resolved.provider_model == "anthropic/claude-opus-4"assert resolved.thinking_enabled is True+ assert_exact_catalog_capabilities(resolved)def test_model_router_routes_token_count_request(settings):@@ -208,6 +220,7 @@ def test_model_router_routes_token_count_request(settings):assert routed.request.model == "qwen2.5-7b"assert request.model == "claude-3-haiku-20240307"+ assert_exact_catalog_capabilities(routed.resolved)def test_model_router_logs_mapping(settings):@@ -219,3 +232,15 @@ def test_model_router_logs_mapping(settings):assert "MODEL MAPPING" in args[0]assert args[1] == "claude-2.1"assert args[2] == "fallback-model"+++def test_model_router_preserves_typed_error_for_unknown_mapped_provider(settings):+ settings.model = "unknown/model"++ with pytest.raises(UnknownProviderError) as exc_info:+ ModelRouter(settings).resolve("claude-2.1")++ supported = "', '".join(PROVIDER_CATALOG)+ assert str(exc_info.value) == (+ f"Unknown provider_type: 'unknown'. Supported: '{supported}'"+ )diff --git a/tests/config/test_provider_catalog.py b/tests/config/test_provider_catalog.pynew file mode 100644index 00000000..024b5d89--- /dev/null+++ b/tests/config/test_provider_catalog.py@@ -0,0 +1,58 @@+from dataclasses import FrozenInstanceError, fields++import pytest++from free_claude_code.config.provider_catalog import (+ PROVIDER_CATALOG,+ ProviderCapabilities,+ ProviderDescriptor,+)+++def test_provider_capabilities_are_an_exact_immutable_value_shape() -> None:+ capabilities = ProviderCapabilities(local=True, server_tool_passthrough=True)++ assert tuple(field.name for field in fields(ProviderCapabilities)) == (+ "local",+ "server_tool_passthrough",+ )+ assert ProviderCapabilities.__slots__ == (+ "local",+ "server_tool_passthrough",+ )+ assert not hasattr(capabilities, "__dict__")+ assert capabilities == ProviderCapabilities(+ local=True,+ server_tool_passthrough=True,+ )+ assert ProviderCapabilities() == ProviderCapabilities(+ local=False,+ server_tool_passthrough=False,+ )+ with pytest.raises(FrozenInstanceError):+ capabilities.__setattr__("local", False)+++def test_catalog_has_no_transport_or_string_capability_metadata() -> None:+ assert "transport_type" not in ProviderDescriptor.__slots__+ assert all(+ not hasattr(descriptor, "transport_type")+ for descriptor in PROVIDER_CATALOG.values()+ )+ assert all(+ type(descriptor.capabilities) is ProviderCapabilities+ for descriptor in PROVIDER_CATALOG.values()+ )+++def test_catalog_capability_assignments_are_exact() -> None:+ assert {+ provider_id+ for provider_id, descriptor in PROVIDER_CATALOG.items()+ if descriptor.capabilities.local+ } == {"lmstudio", "llamacpp", "ollama"}+ assert {+ provider_id+ for provider_id, descriptor in PROVIDER_CATALOG.items()+ if descriptor.capabilities.server_tool_passthrough+ } == {"llamacpp", "ollama"}diff --git a/tests/contracts/test_admin_provider_manifest.py b/tests/contracts/test_admin_provider_manifest.pyindex 0212ba1a..fab0ddaf 100644--- a/tests/contracts/test_admin_provider_manifest.py+++ b/tests/contracts/test_admin_provider_manifest.py@@ -107,6 +107,8 @@ def test_provider_catalog_display_names_are_admin_status_source() -> None:assert set(status_by_provider) == set(PROVIDER_CATALOG)for provider_id, desc in PROVIDER_CATALOG.items():assert status_by_provider[provider_id]["display_name"] == desc.display_name+ expected_kind = "local" if desc.capabilities.local else "remote"+ assert status_by_provider[provider_id]["kind"] == expected_kinddef test_cloudflare_account_id_is_admin_provider_field() -> None:diff --git a/tests/contracts/test_import_boundaries.py b/tests/contracts/test_import_boundaries.pyindex d553bfd0..0c59ccd2 100644--- a/tests/contracts/test_import_boundaries.py+++ b/tests/contracts/test_import_boundaries.py@@ -526,20 +526,6 @@ def test_provider_transports_live_under_transport_family_packages() -> None:assert offenders == []-def test_native_anthropic_transport_is_local_provider_only() -> None:- from free_claude_code.config.provider_catalog import PROVIDER_CATALOG-- native_ids = {- provider_id- for provider_id, descriptor in PROVIDER_CATALOG.items()- if descriptor.transport_type == "anthropic_messages"- }-- assert native_ids == {"llamacpp", "ollama"}- for provider_id in native_ids:- assert "local" in PROVIDER_CATALOG[provider_id].capabilities--def test_cloud_providers_do_not_import_native_anthropic_transport() -> None:repo_root = Path(__file__).resolve().parents[2]diff --git a/tests/providers/test_provider_runtime.py b/tests/providers/test_provider_runtime.pyindex b0c9a89d..adbd4710 100644--- a/tests/providers/test_provider_runtime.py+++ b/tests/providers/test_provider_runtime.py@@ -137,25 +137,21 @@ def test_provider_catalog_covers_advertised_provider_ids():assert set(PROVIDER_CATALOG) == set(SUPPORTED_PROVIDER_IDS)for descriptor in PROVIDER_CATALOG.values():assert descriptor.provider_id- assert descriptor.transport_type in {"openai_chat", "anthropic_messages"}- assert descriptor.capabilities-def test_ollama_descriptor_uses_native_anthropic_transport():+def test_ollama_descriptor_uses_local_server_tool_semantics():descriptor = PROVIDER_CATALOG["ollama"]- assert descriptor.transport_type == "anthropic_messages"assert descriptor.default_base_url == "http://localhost:11434"- assert "native_anthropic" in descriptor.capabilities+ assert descriptor.capabilities.local is True+ assert descriptor.capabilities.server_tool_passthrough is Truedef test_zai_descriptor_uses_fixed_cloud_base_url():descriptor = PROVIDER_CATALOG["zai"]- assert descriptor.transport_type == "openai_chat"assert descriptor.default_base_url == ZAI_DEFAULT_BASEassert descriptor.base_url_attr is None- assert "native_anthropic" not in descriptor.capabilitiesdef test_zai_provider_config_ignores_stale_base_url_setting():@@ -169,23 +165,18 @@ def test_zai_provider_config_ignores_stale_base_url_setting():assert config.base_url == ZAI_DEFAULT_BASE-def test_minimax_descriptor_uses_openai_chat_transport():+def test_minimax_descriptor_uses_expected_endpoint_and_credential():descriptor = PROVIDER_CATALOG["minimax"]- assert descriptor.transport_type == "openai_chat"assert descriptor.default_base_url == MINIMAX_DEFAULT_BASEassert descriptor.credential_env == "MINIMAX_API_KEY"- assert "native_anthropic" not in descriptor.capabilitiesdef test_cloudflare_descriptor_uses_api_root_not_account_url():descriptor = PROVIDER_CATALOG["cloudflare"]- assert descriptor.transport_type == "openai_chat"assert descriptor.default_base_url == "https://api.cloudflare.com/client/v4"assert descriptor.base_url_attr is None- assert "native_anthropic" not in descriptor.capabilities- assert "thinking" in descriptor.capabilitiesdef test_create_cloudflare_provider_uses_account_scoped_base_url():@@ -234,41 +225,33 @@ def test_build_provider_config_opencode_go_uses_opencode_api_key() -> None:def test_vercel_descriptor_uses_openai_chat_gateway() -> None:descriptor = PROVIDER_CATALOG["vercel"]- assert descriptor.transport_type == "openai_chat"assert descriptor.default_base_url == VERCEL_AI_GATEWAY_DEFAULT_BASEassert descriptor.credential_env == "AI_GATEWAY_API_KEY"assert descriptor.proxy_attr == "vercel_ai_gateway_proxy"- assert "thinking" in descriptor.capabilitiesdef test_huggingface_descriptor_uses_openai_chat_router() -> None:descriptor = PROVIDER_CATALOG["huggingface"]- assert descriptor.transport_type == "openai_chat"assert descriptor.default_base_url == HUGGINGFACE_DEFAULT_BASEassert descriptor.credential_env == "HUGGINGFACE_API_KEY"assert descriptor.proxy_attr == "huggingface_proxy"- assert "thinking" in descriptor.capabilitiesdef test_cohere_descriptor_uses_openai_chat_compatibility_api() -> None:descriptor = PROVIDER_CATALOG["cohere"]- assert descriptor.transport_type == "openai_chat"assert descriptor.default_base_url == COHERE_DEFAULT_BASEassert descriptor.credential_env == "COHERE_API_KEY"assert descriptor.proxy_attr == "cohere_proxy"- assert "thinking" in descriptor.capabilitiesdef test_github_models_descriptor_uses_openai_chat_inference_api() -> None:descriptor = PROVIDER_CATALOG["github_models"]- assert descriptor.transport_type == "openai_chat"assert descriptor.default_base_url == GITHUB_MODELS_DEFAULT_BASEassert descriptor.credential_env == "GITHUB_MODELS_TOKEN"assert descriptor.proxy_attr == "github_models_proxy"- assert "thinking" in descriptor.capabilitiesdef test_build_provider_config_vercel_uses_gateway_key_and_proxy() -> None:diff --git a/uv.lock b/uv.lockindex 727a2e0b..8d7d1373 100644--- a/uv.lock+++ b/uv.lock@@ -561,7 +561,7 @@ wheels = [[[package]]name = "free-claude-code"-version = "3.4.21"+version = "3.4.22"source = { editable = "." }dependencies = [{ name = "aiohttp" },