feat(llm): add NVIDIA NIM, Kimi, Groq, and Mistral providers

Each is a one-row entry in the OpenAI-compatible provider registry (base_url,
key env, CLI option); the model is user-specified since they serve many models.
This commit is contained in:
Yijia-Xiao
2026-06-14 04:13:39 +00:00
parent 20d3b0782f
commit 295e84cd54
8 changed files with 51 additions and 8 deletions

View File

@@ -30,6 +30,12 @@ PROVIDER_API_KEY_ENV: dict[str, Optional[str]] = {
"minimax": "MINIMAX_API_KEY",
"minimax-cn": "MINIMAX_CN_API_KEY",
"openrouter": "OPENROUTER_API_KEY",
# Additional hosted OpenAI-compatible providers (model is user-specified).
# kimi -> Moonshot AI; nvidia -> NVIDIA NIM.
"mistral": "MISTRAL_API_KEY",
"kimi": "MOONSHOT_API_KEY",
"groq": "GROQ_API_KEY",
"nvidia": "NVIDIA_API_KEY",
# Local runtimes do not authenticate.
"ollama": None,
# Generic OpenAI-compatible endpoint: the client reads this when set (keyed

View File

@@ -7,6 +7,13 @@ from typing import Dict, List, Tuple
ModelOption = Tuple[str, str]
ProviderModeOptions = Dict[str, Dict[str, List[ModelOption]]]
# Providers that serve many / frequently-changing models: offer only "Custom
# model ID" rather than a list that goes stale.
_CUSTOM_ONLY: Dict[str, List[ModelOption]] = {
"quick": [("Custom model ID", "custom")],
"deep": [("Custom model ID", "custom")],
}
# Shared model list for GLM via Z.AI (international) and BigModel (China).
# Source: docs.z.ai (GLM Coding Plan supported models + LLM guides).
@@ -177,10 +184,15 @@ MODEL_OPTIONS: ProviderModeOptions = {
},
# Generic OpenAI-compatible endpoint: the model is whatever the user's
# server serves, so only "Custom model ID" is offered.
"openai_compatible": {
"quick": [("Custom model ID", "custom")],
"deep": [("Custom model ID", "custom")],
},
"openai_compatible": _CUSTOM_ONLY,
# Hosted OpenAI-compatible providers that serve many (and frequently
# changing) models — offer "Custom model ID" rather than a list that goes
# stale. The endpoint + key are wired by the provider; the user picks the
# model their account has access to.
"mistral": _CUSTOM_ONLY,
"kimi": _CUSTOM_ONLY,
"groq": _CUSTOM_ONLY,
"nvidia": _CUSTOM_ONLY,
}

View File

@@ -189,6 +189,10 @@ OPENAI_COMPATIBLE_PROVIDERS: dict[str, ProviderSpec] = {
"minimax": ProviderSpec(base_url="https://api.minimax.io/v1", chat_class=MinimaxChatOpenAI),
"minimax-cn": ProviderSpec(base_url="https://api.minimaxi.com/v1", chat_class=MinimaxChatOpenAI),
"openrouter": ProviderSpec(base_url="https://openrouter.ai/api/v1"),
"mistral": ProviderSpec(base_url="https://api.mistral.ai/v1"),
"kimi": ProviderSpec(base_url="https://api.moonshot.ai/v1"),
"groq": ProviderSpec(base_url="https://api.groq.com/openai/v1"),
"nvidia": ProviderSpec(base_url="https://integrate.api.nvidia.com/v1"),
"ollama": ProviderSpec(base_url="http://localhost:11434/v1", base_url_env="OLLAMA_BASE_URL",
key_optional=True, placeholder_key="ollama"),
# Generic endpoint: user supplies base_url; key optional (keyless local).

View File

@@ -3,9 +3,13 @@
from .model_catalog import get_known_models
# Providers whose model names are user-defined (local servers, relays, any
# OpenAI-compatible endpoint), so any model string is accepted without warning.
_ANY_MODEL_PROVIDERS = ("ollama", "openrouter", "openai_compatible")
# Providers whose model names are user-defined (local servers, relays, hosted
# OpenAI-compatible endpoints serving many models), so any model string is
# accepted without warning.
_ANY_MODEL_PROVIDERS = (
"ollama", "openrouter", "openai_compatible",
"mistral", "kimi", "groq", "nvidia",
)
VALID_MODELS = {
provider: models