From a9449db5d3de2d2ebbeedb73bae87fa1504f2225 Mon Sep 17 00:00:00 2001 From: Tao Xin Date: Tue, 11 Aug 2026 20:15:52 +0800 Subject: [PATCH] feat(llm): add novita api as a default provider (#829) * feat(llm): add Novita AI as a built-in provider Novita's endpoint (https://api.novita.ai/v3/openai) is OpenAI-compatible, so it registers like the other OpenAI-protocol providers (deepseek, kimi, z-ai, ...). Adds the registry entry, the matching name in the provider-order test, and the provider table in the en/zh/ja configuration docs. Model ids are taken from the live /v3/openai/models endpoint. * fix(llm): correct Novita base URL to current documented endpoint The registry entry, tests-adjacent docs tables (en/ja/zh configuration.md) used https://api.novita.ai/v3/openai. That path still resolves today, but Novita's current documentation (novita.ai/docs/guides/llm-api) no longer shows it; the current documented OpenAI-compatible endpoint is https://api.novita.ai/openai. Verified live 2026-08-01: both paths return identical /models and /chat/completions results, so this is a stale-citation fix, not a functional break. * Recommend Novita's current flagship models The models listed for Novita were older ids that no longer reflect what the platform leads with. Point the recommendations at the three current flagships instead, each verified against api.novita.ai: moonshotai/kimi-k3 1M context, native vision zai-org/glm-5.2 1M context, long-horizon agentic work deepseek/deepseek-v4-flash-0731 1M context, cheapest of the three Context windows, output limits, input modalities and pricing were taken from the live /openai/v1/models response rather than carried over. * Apply suggestion from @wu21-web Co-authored-by: Tao Xin * Sync provider registry with upstream to resolve merge conflict Rebase-equivalent update of internal/llm/providers.go, internal/llm/providers_test.go, and the en/ja/zh/ru configuration docs to match upstream/main's current content (minimax-cn, mistral, model list refreshes) while keeping the novita entry this branch adds. This is a targeted content sync of the six files that conflicted, not a full merge, so unrelated upstream changes (workflows, CI, etc.) are left untouched. Also adds the novita row to the ru docs table, which was missing. --------- Co-authored-by: kite <254839944+lizhengfeng101@users.noreply.github.com> --- internal/llm/providers.go | 12 ++++++++++++ internal/llm/providers_test.go | 2 +- pages/src/content/docs/en/configuration.md | 1 + pages/src/content/docs/ja/configuration.md | 1 + pages/src/content/docs/ru/configuration.md | 1 + pages/src/content/docs/zh/configuration.md | 1 + 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/llm/providers.go b/internal/llm/providers.go index f821843..0f2e374 100644 --- a/internal/llm/providers.go +++ b/internal/llm/providers.go @@ -317,6 +317,18 @@ var registry = []Provider{ "qwen3.5:397b", }, }, + { + Name: "novita", + DisplayName: "Novita API", + Protocol: ProtocolOpenAIChatCompletions, + BaseURL: "https://api.novita.ai/openai", + EnvVar: "NOVITA_API_KEY", + Models: []string{ + "moonshotai/kimi-k3", + "zai-org/glm-5.2", + "deepseek/deepseek-v4-flash-0731", + }, + }, { Name: "litellm", DisplayName: "LiteLLM AI Gateway", diff --git a/internal/llm/providers_test.go b/internal/llm/providers_test.go index 4a90cea..5491aac 100644 --- a/internal/llm/providers_test.go +++ b/internal/llm/providers_test.go @@ -75,7 +75,7 @@ func TestListProviders_Order(t *testing.T) { if len(providers) < 3 { t.Fatalf("expected at least 3 providers, got %d", len(providers)) } - expected := []string{"anthropic", "baidu-qianfan", "dashscope", "dashscope-tokenplan", "deepseek", "edenai", "hy-tokenplan", "iflytek", "kimi", "litellm", "mimo", "minimax", "minimax-cn", "mistral", "ollama-cloud", "openai", "tencent-tokenhub", "volcengine", "z-ai", "z-ai-coding"} + expected := []string{"anthropic", "baidu-qianfan", "dashscope", "dashscope-tokenplan", "deepseek", "edenai", "hy-tokenplan", "iflytek", "kimi", "litellm", "mimo", "minimax", "minimax-cn", "mistral", "novita", "ollama-cloud", "openai", "tencent-tokenhub", "volcengine", "z-ai", "z-ai-coding"} if len(providers) != len(expected) { t.Fatalf("expected %d providers, got %d", len(expected), len(providers)) } diff --git a/pages/src/content/docs/en/configuration.md b/pages/src/content/docs/en/configuration.md index 961e1cb..364acaa 100644 --- a/pages/src/content/docs/en/configuration.md +++ b/pages/src/content/docs/en/configuration.md @@ -59,6 +59,7 @@ environment variable. | `minimax` | openai | `https://api.minimax.io/v1` | `MINIMAX_GLOBAL_API_KEY` | | `minimax-cn` | openai | `https://api.minimaxi.com/v1` | `MINIMAX_API_KEY` | | `baidu-qianfan` | openai | `https://qianfan.baidubce.com/v2` | `QIANFAN_API_KEY` | +| `novita` | openai | `https://api.novita.ai/openai` | `NOVITA_API_KEY` | ### Custom providers diff --git a/pages/src/content/docs/ja/configuration.md b/pages/src/content/docs/ja/configuration.md index 5abbd91..7559552 100644 --- a/pages/src/content/docs/ja/configuration.md +++ b/pages/src/content/docs/ja/configuration.md @@ -57,6 +57,7 @@ ocr config set providers.anthropic.api_key sk-ant-xxxxxxxxxx | `minimax` | openai | `https://api.minimax.io/v1` | `MINIMAX_GLOBAL_API_KEY` | | `minimax-cn` | openai | `https://api.minimaxi.com/v1` | `MINIMAX_API_KEY` | | `baidu-qianfan` | openai | `https://qianfan.baidubce.com/v2` | `QIANFAN_API_KEY` | +| `novita` | openai | `https://api.novita.ai/openai` | `NOVITA_API_KEY` | ### カスタム provider diff --git a/pages/src/content/docs/ru/configuration.md b/pages/src/content/docs/ru/configuration.md index 79d8e89..2dae3e0 100644 --- a/pages/src/content/docs/ru/configuration.md +++ b/pages/src/content/docs/ru/configuration.md @@ -62,6 +62,7 @@ API-ключ. Если `providers..api_key` не задан, OCR испо | `minimax` | openai | `https://api.minimax.io/v1` | `MINIMAX_GLOBAL_API_KEY` | | `minimax-cn` | openai | `https://api.minimaxi.com/v1` | `MINIMAX_API_KEY` | | `baidu-qianfan` | openai | `https://qianfan.baidubce.com/v2` | `QIANFAN_API_KEY` | +| `novita` | openai | `https://api.novita.ai/openai` | `NOVITA_API_KEY` | ### Пользовательские провайдеры diff --git a/pages/src/content/docs/zh/configuration.md b/pages/src/content/docs/zh/configuration.md index 0b75645..f65d28d 100644 --- a/pages/src/content/docs/zh/configuration.md +++ b/pages/src/content/docs/zh/configuration.md @@ -56,6 +56,7 @@ ocr config set providers.anthropic.api_key sk-ant-xxxxxxxxxx | `minimax` | openai | `https://api.minimax.io/v1` | `MINIMAX_GLOBAL_API_KEY` | | `minimax-cn` | openai | `https://api.minimaxi.com/v1` | `MINIMAX_API_KEY` | | `baidu-qianfan` | openai | `https://qianfan.baidubce.com/v2` | `QIANFAN_API_KEY` | +| `novita` | openai | `https://api.novita.ai/openai` | `NOVITA_API_KEY` | ### 自定义 provider