diff --git a/docs/configuration.md b/docs/configuration.md index 3a73325ba..dbd5e2626 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -154,7 +154,6 @@ ANTHROPIC_API_KEY="$(bw get password api/anthropic)" nanobot agent | `mimo` | LLM (MiMo) | [platform.xiaomimimo.com](https://platform.xiaomimimo.com) | | `longcat` | LLM (LongCat) | [longcat.chat](https://longcat.chat/platform/docs/zh/) | | `ant_ling` | LLM (Ant Ling / 蚂蚁百灵) | [developer.ant-ling.com](https://developer.ant-ling.com/en/docs/api-reference/openai/) | -| `apifree` | LLM (APIFree) | [apifree.ai](https://www.apifree.ai) | | `ollama` | LLM (local, Ollama) | — | | `lm_studio` | LLM (local, LM Studio) | — | | `atomic_chat` | LLM (local, [Atomic Chat](https://atomic.chat/)) | — | @@ -169,7 +168,7 @@ ANTHROPIC_API_KEY="$(bw get password api/anthropic)" nanobot agent
Skywork / APIFree -Skywork uses the OpenAI-compatible APIFree API endpoint. Configure the provider +Skywork uses APIFree's OpenAI-compatible Agent API endpoint. Configure the provider once, then use Skywork model IDs such as `skywork-ai/skyclaw-v1`. ```json @@ -177,7 +176,7 @@ once, then use Skywork model IDs such as `skywork-ai/skyclaw-v1`. "providers": { "skywork": { "apiKey": "${SKYWORK_API_KEY}", - "apiBase": "https://api.apifree.ai/v1" + "apiBase": "https://api.apifree.ai/agent/v1" } }, "agents": { @@ -505,31 +504,6 @@ Official OpenAI-compatible model names include `Ling-2.6-1T`,
-
-APIFree (OpenAI-compatible) - -APIFree is available through nanobot's built-in OpenAI-compatible provider flow. The default API base points to `https://api.apifree.ai/agent/v1`, so you usually only need to set `apiKey`. - -```json -{ - "providers": { - "apifree": { - "apiKey": "${APIFREE_API_KEY}" - } - }, - "agents": { - "defaults": { - "provider": "apifree", - "model": "skywork-ai/skyclaw-v1" - } - } -} -``` - -Available models include `skywork-ai/skyclaw-v1`. - -
-
Custom Provider (Any OpenAI-compatible API) diff --git a/nanobot/config/schema.py b/nanobot/config/schema.py index 20638f45a..c0ad7e758 100644 --- a/nanobot/config/schema.py +++ b/nanobot/config/schema.py @@ -209,7 +209,6 @@ class ProvidersConfig(Base): xiaomi_mimo: ProviderConfig = Field(default_factory=ProviderConfig) # Xiaomi MIMO (小米) longcat: ProviderConfig = Field(default_factory=ProviderConfig) # LongCat ant_ling: ProviderConfig = Field(default_factory=ProviderConfig) # Ant Ling - apifree: ProviderConfig = Field(default_factory=ProviderConfig) # APIFree aihubmix: ProviderConfig = Field(default_factory=ProviderConfig) # AiHubMix API gateway siliconflow: ProviderConfig = Field(default_factory=ProviderConfig) # SiliconFlow (硅基流动) volcengine: ProviderConfig = Field(default_factory=ProviderConfig) # VolcEngine (火山引擎) diff --git a/nanobot/providers/registry.py b/nanobot/providers/registry.py index ed5a26231..7c8edd271 100644 --- a/nanobot/providers/registry.py +++ b/nanobot/providers/registry.py @@ -165,7 +165,7 @@ PROVIDERS: tuple[ProviderSpec, ...] = ( env_extras=(("APIFREE_API_KEY", "{api_key}"),), is_gateway=True, detect_by_base_keyword="apifree.ai", - default_api_base="https://api.apifree.ai/v1", + default_api_base="https://api.apifree.ai/agent/v1", ), # AiHubMix: global gateway, OpenAI-compatible interface. # strip_model_prefix=True: doesn't understand "anthropic/claude-3", @@ -412,16 +412,6 @@ PROVIDERS: tuple[ProviderSpec, ...] = ( detect_by_base_keyword="ant-ling.com", default_api_base="https://api.ant-ling.com/v1", ), - # APIFree: OpenAI-compatible API gateway with agent-optimised models. - ProviderSpec( - name="apifree", - keywords=("apifree", "api-free", "skyclaw"), - env_key="APIFREE_API_KEY", - display_name="APIFree", - backend="openai_compat", - detect_by_base_keyword="apifree.ai", - default_api_base="https://api.apifree.ai/agent/v1", - ), # === Local deployment (matched by config key, NOT by api_base) ========= # vLLM / any OpenAI-compatible local server ProviderSpec( diff --git a/tests/channels/test_websocket_channel.py b/tests/channels/test_websocket_channel.py index 8769be30d..cc011a244 100644 --- a/tests/channels/test_websocket_channel.py +++ b/tests/channels/test_websocket_channel.py @@ -1031,11 +1031,9 @@ async def test_settings_api_returns_safe_subset_and_updates_whitelist( assert providers["openrouter"]["configured"] is False assert providers["openrouter"]["api_key_required"] is True assert providers["skywork"]["label"] == "Skywork" - assert providers["skywork"]["default_api_base"] == "https://api.apifree.ai/v1" + assert providers["skywork"]["default_api_base"] == "https://api.apifree.ai/agent/v1" assert providers["ant_ling"]["label"] == "Ant Ling" assert providers["ant_ling"]["default_api_base"] == "https://api.ant-ling.com/v1" - assert providers["apifree"]["label"] == "APIFree" - assert providers["apifree"]["default_api_base"] == "https://api.apifree.ai/agent/v1" assert providers["atomic_chat"]["configured"] is False assert providers["atomic_chat"]["api_key_required"] is False assert providers["atomic_chat"]["default_api_base"] == "http://localhost:1337/v1" diff --git a/tests/providers/test_apifree_provider.py b/tests/providers/test_apifree_provider.py deleted file mode 100644 index 6022d4881..000000000 --- a/tests/providers/test_apifree_provider.py +++ /dev/null @@ -1,71 +0,0 @@ -"""Tests for the APIFree provider registration.""" - -from unittest.mock import patch - -from nanobot.config.schema import Config, ProvidersConfig -from nanobot.providers.openai_compat_provider import OpenAICompatProvider -from nanobot.providers.registry import PROVIDERS, find_by_name - - -def test_apifree_config_field_exists() -> None: - config = ProvidersConfig() - assert hasattr(config, "apifree") - - -def test_apifree_provider_in_registry() -> None: - specs = {spec.name: spec for spec in PROVIDERS} - assert "apifree" in specs - - apifree = specs["apifree"] - assert apifree.backend == "openai_compat" - assert apifree.env_key == "APIFREE_API_KEY" - assert apifree.display_name == "APIFree" - assert apifree.default_api_base == "https://api.apifree.ai/agent/v1" - - -def test_find_by_name_accepts_apifree_spellings() -> None: - spec = find_by_name("apifree") - assert spec is not None - - -def test_apifree_model_auto_matches_with_default_api_base() -> None: - config = Config.model_validate( - { - "providers": { - "apifree": { - "apiKey": "apifree-key", - }, - }, - "agents": { - "defaults": { - "model": "skywork-ai/skyclaw-v1", - }, - }, - } - ) - - assert config.get_provider_name("skywork-ai/skyclaw-v1") == "apifree" - assert config.get_api_key("skywork-ai/skyclaw-v1") == "apifree-key" - assert config.get_api_base("skywork-ai/skyclaw-v1") == "https://api.apifree.ai/agent/v1" - - -def test_apifree_preserves_official_model_name() -> None: - spec = find_by_name("apifree") - with patch("nanobot.providers.openai_compat_provider.AsyncOpenAI"): - provider = OpenAICompatProvider( - api_key="apifree-key", - default_model="skywork-ai/skyclaw-v1", - spec=spec, - ) - - kwargs = provider._build_kwargs( - messages=[{"role": "user", "content": "hi"}], - tools=None, - model="skywork-ai/skyclaw-v1", - max_tokens=1024, - temperature=0.7, - reasoning_effort=None, - tool_choice=None, - ) - - assert kwargs["model"] == "skywork-ai/skyclaw-v1" diff --git a/tests/providers/test_skywork_provider.py b/tests/providers/test_skywork_provider.py index 52de462f4..60370d9ce 100644 --- a/tests/providers/test_skywork_provider.py +++ b/tests/providers/test_skywork_provider.py @@ -24,7 +24,7 @@ def test_skywork_provider_in_registry() -> None: assert skywork.display_name == "Skywork" assert skywork.is_gateway is True assert skywork.detect_by_base_keyword == "apifree.ai" - assert skywork.default_api_base == "https://api.apifree.ai/v1" + assert skywork.default_api_base == "https://api.apifree.ai/agent/v1" assert skywork.supports_max_completion_tokens is False @@ -53,7 +53,7 @@ def test_skywork_model_auto_matches_with_default_api_base() -> None: assert config.get_provider_name("skywork-ai/skyclaw-v1") == "skywork" assert config.get_api_key("skywork-ai/skyclaw-v1") == "sky-key" - assert config.get_api_base("skywork-ai/skyclaw-v1") == "https://api.apifree.ai/v1" + assert config.get_api_base("skywork-ai/skyclaw-v1") == "https://api.apifree.ai/agent/v1" def test_skywork_preserves_model_id_and_uses_chat_completion_max_tokens() -> None: diff --git a/webui/src/components/settings/SettingsView.tsx b/webui/src/components/settings/SettingsView.tsx index 7a758f90a..249d400c8 100644 --- a/webui/src/components/settings/SettingsView.tsx +++ b/webui/src/components/settings/SettingsView.tsx @@ -2150,7 +2150,6 @@ const PROVIDER_ICONS: Record = { byteplus_coding_plan: Cloud, qianfan: Database, ant_ling: Sparkles, - apifree: Sparkles, azure_openai: Cloud, bedrock: Database, vllm: Cpu, diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsx index 4778dd315..26a5b4291 100644 --- a/webui/src/tests/app-layout.test.tsx +++ b/webui/src/tests/app-layout.test.tsx @@ -580,13 +580,6 @@ describe("App layout", () => { api_key_required: true, default_api_base: "https://api.ant-ling.com/v1", }, - { - name: "apifree", - label: "APIFree", - configured: false, - api_key_required: true, - default_api_base: "https://api.apifree.ai/agent/v1", - }, { name: "azure_openai", label: "Azure OpenAI", @@ -746,7 +739,6 @@ describe("App layout", () => { fireEvent.click(within(settingsNav).getByRole("button", { name: "Providers" })); expect(screen.getByText("OpenRouter")).toBeInTheDocument(); expect(screen.getByText("Ant Ling")).toBeInTheDocument(); - expect(screen.getByText("APIFree")).toBeInTheDocument(); expect(screen.getAllByText("Not configured").length).toBeGreaterThan(0); fireEvent.click(screen.getByText("OpenAI")); fireEvent.click(screen.getByRole("button", { name: "Edit" })); @@ -759,8 +751,6 @@ describe("App layout", () => { expect(screen.queryByDisplayValue("unsaved-openai-key")).not.toBeInTheDocument(); fireEvent.click(screen.getByText("Ant Ling")); expect(screen.getByDisplayValue("https://api.ant-ling.com/v1")).toBeInTheDocument(); - fireEvent.click(screen.getByText("APIFree")); - expect(screen.getByDisplayValue("https://api.apifree.ai/agent/v1")).toBeInTheDocument(); fireEvent.click(screen.getByText("Atomic Chat")); expect(screen.getByDisplayValue("http://localhost:1337/v1")).toBeInTheDocument(); expect(screen.getByRole("button", { name: "Save" })).toBeEnabled();