← Back to PRs

#15991: feat: add Novita AI provider support with dynamic model discovery

by Alex-wuhu open 2026-02-14 04:38 View on GitHub →
docs cli commands agents stale size: L
## Summary - Add Novita AI as a first-class provider (`novita`) with OpenAI-compatible API endpoint (`https://api.novita.ai/openai`) - Implement dynamic model discovery from Novita's `/v1/models` endpoint with in-process caching and static fallback catalog - Full onboarding integration: interactive wizard, non-interactive CLI flags (`--novita-api-key`), auth profile management, and environment variable support (`NOVITA_API_KEY`) ## Changes - **Core provider**: `novita-models.ts` — model discovery, caching, static fallback catalog - **Auth & onboarding**: credential storage (`novita:default` profile), onboarding config, preferred-provider mapping - **CLI**: `--auth-choice novita-api-key` and `--novita-api-key` flags - **Docs**: provider guide at `docs/providers/novita.md` with quick start, non-interactive example, and popular models - **Tests**: unit tests for model discovery and provider config, e2e smoke tests for onboarding ## Test plan - [ ] Run `openclaw onboard --auth-choice novita-api-key` with a valid API key - [ ] Verify `openclaw models list --all` shows `novita/*` models - [ ] Run non-interactive onboarding: `openclaw onboard --non-interactive --mode local --auth-choice novita-api-key --novita-api-key $NOVITA_API_KEY` - [ ] Verify unit tests pass: `novita-models.test.ts`, `models-config.providers.novita.test.ts` Co-authored-by: Joseph Pollack <joseph@legml.ai> Supersedes #13300 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Adds Novita AI as a first-class provider (`novita`) with OpenAI-compatible API endpoint, dynamic model discovery with in-memory caching, and full onboarding integration (interactive wizard, CLI flags, auth profiles, env var support). - **Core provider** (`novita-models.ts`): Implements dynamic model discovery from `/v1/models` with 5-minute in-memory cache, static fallback catalog (Kimi K2.5), and metadata inference (reasoning, vision support). Follows the Hugging Face/Venice discovery pattern. - **Auth & config**: Adds `NOVITA_API_KEY` env var support, `novita:default` auth profile, `--novita-api-key` CLI flag, and `--auth-choice novita-api-key`. All onboarding paths (interactive + non-interactive) are wired. - **Key resolution** in `models-config.providers.ts`: Uses a dual-resolution approach — `resolveEnvApiKeyVarName` for config storage and a new `resolveEnvApiKeyValue` helper for the actual key value needed by discovery. This is more complex than other providers (e.g., Together uses a simpler pattern, HuggingFace resolves inside the build function) but works correctly. - **Tests**: Unit tests cover discovery, caching, and fallback. E2E tests verify non-interactive onboarding and CLI smoke tests. - **Docs**: Provider guide at `docs/providers/novita.md` with quick start, non-interactive example, and model examples. Added to provider index and concepts pages. - Minor style note: the `inferImageSupport` function's `"vl"` substring check is overly broad and could false-positive on unrelated model names. Also, `NOVITA_DEFAULT_MODEL_REF` is exported from both `novita-models.ts` and `onboard-auth.credentials.ts` (only the latter is imported by consumers). <h3>Confidence Score: 4/5</h3> - This PR is safe to merge — it follows established provider patterns closely and the integration is well-tested. - The implementation closely mirrors existing providers (Together, Hugging Face, Venice) across all integration points: auth, onboarding, CLI flags, config, and model discovery. The code is well-structured with proper error handling and fallback paths. Two minor style concerns (overly broad "vl" substring match in vision inference, duplicate constant export) don't affect correctness. Tests cover the main scenarios. The dual key resolution approach in resolveImplicitProviders is slightly more complex than necessary but logically correct. - `src/agents/novita-models.ts` — the `inferImageSupport` function's `"vl"` substring match could produce false positives for model names containing "vl" in unrelated contexts (e.g., "evolve", "evaluation"). <sub>Last reviewed commit: e31c175</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs