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 apps/cli/src/lib/utils/__tests__/context-window.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe("getContextWindow", () => {
[providerIdentifiers.opencodeGo, "opencodeGoModelId"],
[providerIdentifiers.kenari, "kenariModelId"],
[providerIdentifiers.ioIntelligence, "ioIntelligenceModelId"],
[providerIdentifiers.standardCompute, "standardComputeModelId"],
[providerIdentifiers.nanogpt, "nanoGptModelId"],
[providerIdentifiers.zooGateway, "zooGatewayModelId"],
] as const)("uses the provider-specific model field for %s", (provider, modelField) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/__tests__/provider-identifiers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const expectedProviderIdentifiers = [
"kenari",
"nanogpt",
"io-intelligence",
"standard-compute",
"ollama",
"lmstudio",
"vscode-lm",
Expand Down Expand Up @@ -113,6 +114,7 @@ describe("provider identifiers", () => {
providerIdentifiers.kenari,
providerIdentifiers.nanogpt,
providerIdentifiers.ioIntelligence,
providerIdentifiers.standardCompute,
providerIdentifiers.kimiCode,
])
expect(localProviders).toEqual([providerIdentifiers.ollama, providerIdentifiers.lmstudio])
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/__tests__/provider-model-id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const expectedModelIdKeys = [
"kenariModelId",
"nanoGptModelId",
"ioIntelligenceModelId",
"standardComputeModelId",
"zooGatewayModelId",
] as const

Expand Down
26 changes: 26 additions & 0 deletions packages/types/src/__tests__/standard-compute.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {
dynamicProviders,
getModelId,
getProviderDefaultModelId,
standardComputeDefaultModelId,
isSecretStateKey,
providerIdentifiers,
providerSettingsSchema,
} from "../index.js"

describe("Standard Compute shared contract", () => {
it("registers the stable dynamic-provider identity and default model", () => {
expect(providerIdentifiers.standardCompute).toBe("standard-compute")
expect(dynamicProviders).toContain(providerIdentifiers.standardCompute)
expect(getProviderDefaultModelId(providerIdentifiers.standardCompute, {})).toBe(standardComputeDefaultModelId)
})

it("classifies the API key as secret and resolves the configured model", () => {
expect(isSecretStateKey("standardComputeApiKey")).toBe(true)
const settings = providerSettingsSchema.parse({
apiProvider: providerIdentifiers.standardCompute,
standardComputeModelId: "model",
})
expect(getModelId(settings)).toBe("model")
})
})
1 change: 1 addition & 0 deletions packages/types/src/global-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ export const SECRET_STATE_KEYS = [
"opencodeGoApiKey",
"kenariApiKey",
"ioIntelligenceApiKey",
"standardComputeApiKey",
"nanoGptApiKey",
"basetenApiKey",
] as const
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/provider-identifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const providerIdentifiers = {
kenari: "kenari",
nanogpt: "nanogpt",
ioIntelligence: "io-intelligence",
standardCompute: "standard-compute",
ollama: "ollama",
lmstudio: "lmstudio",
vscodeLm: "vscode-lm",
Expand Down
7 changes: 7 additions & 0 deletions packages/types/src/provider-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
providerIdentifiers.kenari,
providerIdentifiers.nanogpt,
providerIdentifiers.ioIntelligence,
providerIdentifiers.standardCompute,
providerIdentifiers.kimiCode,
] as const

Expand Down Expand Up @@ -316,6 +317,7 @@
"kenariModelId",
"nanoGptModelId",
"ioIntelligenceModelId",
"standardComputeModelId",
"zooGatewayModelId",
] as const satisfies readonly ModelIdKey[]

Expand Down Expand Up @@ -562,6 +564,11 @@
label: "IO Intelligence",
models: [],
},
[providerIdentifiers.standardCompute]: {
id: providerIdentifiers.standardCompute,
label: "Standard Compute",

Check warning on line 569 in packages/types/src/provider-settings.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/provider-settings.ts:569: Survived StringLiteral mutant (replacement: ""). See the job summary for the complete list and resolution guidance.
models: [],

Check warning on line 570 in packages/types/src/provider-settings.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/provider-settings.ts:570: Survived ArrayDeclaration mutant (replacement: ["Stryker was here"]). See the job summary for the complete list and resolution guidance.
},
[providerIdentifiers.nanogpt]: { id: providerIdentifiers.nanogpt, label: "NanoGPT", models: [] },
[providerIdentifiers.zooGateway]: { id: providerIdentifiers.zooGateway, label: "Zoo Gateway", models: [] },

Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export * from "./vercel-ai-gateway.js"
export * from "./opencode-go.js"
export * from "./kenari.js"
export * from "./io-intelligence.js"
export * from "./standard-compute.js"
export * from "./nanogpt.js"
export * from "./kimi-code.js"
export * from "./zai.js"
Expand Down Expand Up @@ -69,6 +70,7 @@ import { poeProviderDefinition } from "./poe.js"
import { qwenCodeProviderDefinition } from "./qwen-code.js"
import { requestyProviderDefinition } from "./requesty.js"
import { sambaNovaProviderDefinition } from "./sambanova.js"
import { standardComputeProviderDefinition } from "./standard-compute.js"
import { unboundProviderDefinition } from "./unbound.js"
import { vercelAiGatewayProviderDefinition } from "./vercel-ai-gateway.js"
import { vertexProviderDefinition } from "./vertex.js"
Expand Down Expand Up @@ -115,6 +117,7 @@ export const providerDefinitionList = [
kenariProviderDefinition,
nanoGptProviderDefinition,
ioIntelligenceProviderDefinition,
standardComputeProviderDefinition,
zooGatewayProviderDefinition,
basetenProviderDefinition,
] as const satisfies readonly ProviderDefinition[]
37 changes: 37 additions & 0 deletions packages/types/src/providers/standard-compute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { z } from "zod"

import { type ModelInfo } from "../model.js"
import { providerIdentifiers } from "../provider-identifiers.js"
import { baseProviderSettingsShape, createModelIdAccessor, createProviderDefinition } from "./common.js"

export const STANDARD_COMPUTE_BASE_URL = "https://api.stdcmpt.com/v1"

Check warning on line 7 in packages/types/src/providers/standard-compute.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/standard-compute.ts:7: Survived StringLiteral mutant (replacement: ""). See the job summary for the complete list and resolution guidance.

/**
* The routed model. The router picks a model from the models that the user
* enabled, by the user's quality preference. It uses cheaper models for simple
* steps and sends image requests to a vision model.
*/
export const standardComputeDefaultModelId = "StandardCompute"

Check warning on line 14 in packages/types/src/providers/standard-compute.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/standard-compute.ts:14: Survived StringLiteral mutant (replacement: ""). See the job summary for the complete list and resolution guidance.

export const standardComputeDefaultModelInfo: ModelInfo = {

Check warning on line 16 in packages/types/src/providers/standard-compute.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/standard-compute.ts:16: Survived ObjectLiteral mutant (replacement: {}). See the job summary for the complete list and resolution guidance.
maxTokens: 32_768,
contextWindow: 1_000_000,
supportsImages: true,

Check warning on line 19 in packages/types/src/providers/standard-compute.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/standard-compute.ts:19: Survived BooleanLiteral mutant (replacement: false). See the job summary for the complete list and resolution guidance.
supportsPromptCache: false,

Check warning on line 20 in packages/types/src/providers/standard-compute.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/standard-compute.ts:20: Survived BooleanLiteral mutant (replacement: true). See the job summary for the complete list and resolution guidance.
description:
"Standard Compute routed model. The router picks a model from your enabled models by your quality preference and uses cheaper models for simple steps. Image requests go to a vision model.",

Check warning on line 22 in packages/types/src/providers/standard-compute.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/standard-compute.ts:22: Survived StringLiteral mutant (replacement: ""). See the job summary for the complete list and resolution guidance.
}

const STANDARD_COMPUTE_MODEL_ID_FIELD = "standardComputeModelId"

Check warning on line 25 in packages/types/src/providers/standard-compute.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/standard-compute.ts:25: Survived StringLiteral mutant (replacement: ""). See the job summary for the complete list and resolution guidance.

export const standardComputeProviderDefinition = createProviderDefinition({
apiProvider: providerIdentifiers.standardCompute,
modelIdKey: STANDARD_COMPUTE_MODEL_ID_FIELD,
getModelId: createModelIdAccessor(STANDARD_COMPUTE_MODEL_ID_FIELD),
getDefaultModelId: () => standardComputeDefaultModelId,
schema: {
...baseProviderSettingsShape,
standardComputeApiKey: z.string().optional(),
[STANDARD_COMPUTE_MODEL_ID_FIELD]: z.string().optional(),
},
})
2 changes: 2 additions & 0 deletions src/api/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {
QwenCodeHandler,
RequestyHandler,
SambaNovaHandler,
StandardComputeHandler,
UnboundHandler,
VercelAiGatewayHandler,
VertexHandler,
Expand Down Expand Up @@ -121,6 +122,7 @@ const expectedHandlers = {
[providerIdentifiers.opencodeGo]: OpencodeGoHandler,
[providerIdentifiers.kenari]: KenariHandler,
[providerIdentifiers.ioIntelligence]: IOIntelligenceHandler,
[providerIdentifiers.standardCompute]: StandardComputeHandler,
[providerIdentifiers.nanogpt]: NanoGptHandler,
[providerIdentifiers.zooGateway]: ZooGatewayHandler,
[providerIdentifiers.minimax]: MiniMaxHandler,
Expand Down
3 changes: 3 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
OpencodeGoHandler,
KenariHandler,
IOIntelligenceHandler,
StandardComputeHandler,
NanoGptHandler,
ZooGatewayHandler,
MiniMaxHandler,
Expand Down Expand Up @@ -274,6 +275,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
return new KenariHandler(options)
case providerIdentifiers.ioIntelligence:
return new IOIntelligenceHandler(options)
case providerIdentifiers.standardCompute:
return new StandardComputeHandler(options)
case providerIdentifiers.nanogpt:
return new NanoGptHandler(options)
case providerIdentifiers.zooGateway:
Expand Down
15 changes: 15 additions & 0 deletions src/api/providers/__tests__/model-catalog-adapters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { ApiHandler, ModelCacheScope } from "../../index"
const fetchers = vi.hoisted(() => ({
getDeepSeekModels: vi.fn(),
getIOIntelligenceModels: vi.fn(),
getStandardComputeModels: vi.fn(),
getKenariModels: vi.fn(),
getKimiCodeModels: vi.fn(),
getLiteLLMModels: vi.fn(),
Expand Down Expand Up @@ -50,6 +51,10 @@ vi.mock("../fetchers/io-intelligence", async (importOriginal) => ({
...(await importOriginal<typeof import("../fetchers/io-intelligence")>()),
getIOIntelligenceModels: fetchers.getIOIntelligenceModels,
}))
vi.mock("../fetchers/standard-compute", async (importOriginal) => ({
...(await importOriginal<typeof import("../fetchers/standard-compute")>()),
getStandardComputeModels: fetchers.getStandardComputeModels,
}))
vi.mock("../fetchers/kenari", async (importOriginal) => ({
...(await importOriginal<typeof import("../fetchers/kenari")>()),
getKenariModels: fetchers.getKenariModels,
Expand Down Expand Up @@ -121,6 +126,7 @@ import { OpencodeGoHandler } from "../opencode-go"
import { OpenRouterHandler } from "../openrouter"
import { PoeHandler } from "../poe"
import { RequestyHandler } from "../requesty"
import { StandardComputeHandler } from "../standard-compute"
import { UnboundHandler } from "../unbound"
import { VercelAiGatewayHandler } from "../vercel-ai-gateway"
import { ZooGatewayHandler } from "../zoo-gateway"
Expand Down Expand Up @@ -164,6 +170,15 @@ const cases: AdapterCase[] = [
forwardsSignal: true,
prewarms: false,
},
{
name: "Standard Compute",
create: () => new StandardComputeHandler({ standardComputeApiKey: API_KEY }),
fetcher: "getStandardComputeModels",
scope: { urlScoped: false, keyScoped: true, authScoped: false },
expectedArgs: [API_KEY],
forwardsSignal: true,
prewarms: false,
},
{
name: "Kenari",
create: () => new KenariHandler({ kenariApiKey: API_KEY }),
Expand Down
Loading
Loading