Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ export const providerEnvVarMap: Partial<
azure: "AZURE_API_KEY",
xai: "XAI_API_KEY",
google_legacy: "GOOGLE_API_KEY",
novita: "NOVITA_API_KEY",
};

const providersWithoutApiKey = new Set(["bedrock", "ollama"]);
Expand Down
7 changes: 7 additions & 0 deletions packages/core/lib/v3/llm/LLMProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ import { ollama, createOllama } from "ollama-ai-provider-v2";
import { gateway, createGateway } from "ai";
import { AISDKProvider, AISDKCustomProvider } from "../types/public/model.js";

const NOVITA_BASE_URL = "https://api.novita.ai/openai";
const novita = createOpenAI({ baseURL: NOVITA_BASE_URL });
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Novita’s no-options/static provider path is reachable and does not bind a Novita-specific API key, risking wrong/default credential source or auth failure.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/lib/v3/llm/LLMProvider.ts, line 38:

<comment>Novita’s no-options/static provider path is reachable and does not bind a Novita-specific API key, risking wrong/default credential source or auth failure.</comment>

<file context>
@@ -34,6 +34,11 @@ import { ollama, createOllama } from "ollama-ai-provider-v2";
 import { AISDKProvider, AISDKCustomProvider } from "../types/public/model.js";
 
+const NOVITA_BASE_URL = "https://api.novita.ai/openai";
+const novita = createOpenAI({ baseURL: NOVITA_BASE_URL });
+const createNovita: AISDKCustomProvider = (options) =>
+  createOpenAI({ baseURL: NOVITA_BASE_URL, ...options });
</file context>
Suggested change
const novita = createOpenAI({ baseURL: NOVITA_BASE_URL });
const novita = createOpenAI({
baseURL: NOVITA_BASE_URL,
apiKey: process.env.NOVITA_API_KEY,
});
Fix with Cubic

const createNovita: AISDKCustomProvider = (options) =>
createOpenAI({ baseURL: NOVITA_BASE_URL, ...options });

const AISDKProviders: Record<string, AISDKProvider> = {
openai,
bedrock,
Expand All @@ -50,6 +55,7 @@ const AISDKProviders: Record<string, AISDKProvider> = {
ollama,
vertex,
gateway,
novita,
};
const AISDKProvidersWithAPIKey: Record<string, AISDKCustomProvider> = {
openai: createOpenAI,
Expand All @@ -67,6 +73,7 @@ const AISDKProvidersWithAPIKey: Record<string, AISDKCustomProvider> = {
perplexity: createPerplexity,
ollama: createOllama,
gateway: createGateway,
novita: createNovita,
};

const modelToProviderMap: { [key in AvailableModel]: ModelProvider } = {
Expand Down
24 changes: 24 additions & 0 deletions packages/core/tests/unit/llm-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ describe("getAISDKLanguageModel", () => {
});
});

describe("novita provider", () => {
it("works with apiKey", () => {
const model = getAISDKLanguageModel(
"novita",
"moonshotai/kimi-k2.5",
{ apiKey: "test-novita-key" },
);
expect(model).toBeDefined();
});

it("works without clientOptions (uses static provider)", () => {
const model = getAISDKLanguageModel("novita", "moonshotai/kimi-k2.5");
expect(model).toBeDefined();
});

it("works with custom baseURL override", () => {
const model = getAISDKLanguageModel("novita", "minimax/minimax-m2.5", {
apiKey: "test-novita-key",
baseURL: "https://api.novita.ai/openai",
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The "custom baseURL override" test is ineffective because it uses Novita’s default URL and only asserts definition, so regressions in override handling would go undetected.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/tests/unit/llm-provider.test.ts, line 78:

<comment>The "custom baseURL override" test is ineffective because it uses Novita’s default URL and only asserts definition, so regressions in override handling would go undetected.</comment>

<file context>
@@ -57,6 +57,30 @@ describe("getAISDKLanguageModel", () => {
+    it("works with custom baseURL override", () => {
+      const model = getAISDKLanguageModel("novita", "minimax/minimax-m2.5", {
+        apiKey: "test-novita-key",
+        baseURL: "https://api.novita.ai/openai",
+      });
+      expect(model).toBeDefined();
</file context>
Fix with Cubic

});
expect(model).toBeDefined();
});
});

describe("hasValidOptions logic", () => {
it("treats undefined apiKey as no options", () => {
// This should use the default provider path (AISDKProviders)
Expand Down
Loading