From 861fbb0dde20db6875b3913e8a5faf5950fc0291 Mon Sep 17 00:00:00 2001 From: Xubin Ren Date: Fri, 1 May 2026 17:26:23 +0000 Subject: [PATCH] fix(provider): correct LongCat OpenAI base URL Use the SDK-ready /v1 base so LongCat chat completions hit the documented endpoint. Co-authored-by: Cursor --- docs/configuration.md | 2 +- nanobot/providers/registry.py | 2 +- tests/cli/test_commands.py | 1 + tests/providers/test_longcat_provider.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 51e9f32d8..ec889c758 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -344,7 +344,7 @@ nanobot agent -c ~/.nanobot-telegram/config.json -w /tmp/nanobot-telegram-test - LongCat (OpenAI-compatible) LongCat is available through nanobot's built-in OpenAI-compatible provider flow. -The default API base already points to `https://api.longcat.chat/openai`, so you +The default API base already points to `https://api.longcat.chat/openai/v1`, so you usually only need to set `apiKey`. ```json diff --git a/nanobot/providers/registry.py b/nanobot/providers/registry.py index 44fcd1ee3..2e2bdbc50 100644 --- a/nanobot/providers/registry.py +++ b/nanobot/providers/registry.py @@ -383,7 +383,7 @@ PROVIDERS: tuple[ProviderSpec, ...] = ( env_key="LONGCAT_API_KEY", display_name="LongCat", backend="openai_compat", - default_api_base="https://api.longcat.chat/openai", + default_api_base="https://api.longcat.chat/openai/v1", ), # === Local deployment (matched by config key, NOT by api_base) ========= # vLLM / any OpenAI-compatible local server diff --git a/tests/cli/test_commands.py b/tests/cli/test_commands.py index 2360ac288..50ede9095 100644 --- a/tests/cli/test_commands.py +++ b/tests/cli/test_commands.py @@ -307,6 +307,7 @@ def test_config_explicit_longcat_provider_resolves_provider_name(): ) assert config.get_provider_name() == "longcat" + assert config.get_api_base() == "https://api.longcat.chat/openai/v1" def test_config_auto_detects_longcat_from_model_keyword(): diff --git a/tests/providers/test_longcat_provider.py b/tests/providers/test_longcat_provider.py index 20190098d..0e25b6aee 100644 --- a/tests/providers/test_longcat_provider.py +++ b/tests/providers/test_longcat_provider.py @@ -18,7 +18,7 @@ def test_longcat_provider_in_registry(): longcat = specs["longcat"] assert longcat.backend == "openai_compat" assert longcat.env_key == "LONGCAT_API_KEY" - assert longcat.default_api_base == "https://api.longcat.chat/openai" + assert longcat.default_api_base == "https://api.longcat.chat/openai/v1" def test_find_by_name_longcat():