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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions packages/types/src/__tests__/infer.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/types/src/__tests__/provider-identifiers.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/types/src/__tests__/provider-model-id.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/types/src/global-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ export const SECRET_STATE_KEYS = [
"vercelAiGatewayApiKey",
"opencodeGoApiKey",
"kenariApiKey",
"inferApiKey",
"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 @@ -15,6 +15,7 @@ export const providerIdentifiers = {
opencodeGo: "opencode-go",
kenari: "kenari",
nanogpt: "nanogpt",
infer: "infer",
ollama: "ollama",
lmstudio: "lmstudio",
vscodeLm: "vscode-lm",
Expand Down
3 changes: 3 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.opencodeGo,
providerIdentifiers.kenari,
providerIdentifiers.nanogpt,
providerIdentifiers.infer,
providerIdentifiers.kimiCode,
providerIdentifiers.friendli,
] as const
Expand Down Expand Up @@ -316,6 +317,7 @@
"opencodeGoModelId",
"kenariModelId",
"nanoGptModelId",
"inferModelId",
"zooGatewayModelId",
] as const satisfies readonly ModelIdKey[]

Expand Down Expand Up @@ -557,6 +559,7 @@
},
[providerIdentifiers.opencodeGo]: { id: providerIdentifiers.opencodeGo, label: "Opencode Go", models: [] },
[providerIdentifiers.kenari]: { id: providerIdentifiers.kenari, label: "Kenari", models: [] },
[providerIdentifiers.infer]: { id: providerIdentifiers.infer, label: "Infer", models: [] },

Check warning on line 562 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:562: 2 mutation test gaps; example: Survived StringLiteral mutant (replacement: ""). 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 @@ -29,6 +29,7 @@ export * from "./xai.js"
export * from "./vercel-ai-gateway.js"
export * from "./opencode-go.js"
export * from "./kenari.js"
export * from "./infer.js"
export * from "./nanogpt.js"
export * from "./kimi-code.js"
export * from "./zai.js"
Expand All @@ -46,6 +47,7 @@ import { fakeAiProviderDefinition } from "./fake-ai.js"
import { fireworksProviderDefinition } from "./fireworks.js"
import { friendliProviderDefinition } from "./friendli.js"
import { geminiProviderDefinition } from "./gemini.js"
import { inferProviderDefinition } from "./infer.js"
import { kenariProviderDefinition } from "./kenari.js"
import { kimiCodeProviderDefinition } from "./kimi-code.js"
import { litellmProviderDefinition } from "./litellm.js"
Expand Down Expand Up @@ -109,6 +111,7 @@ export const providerDefinitionList = [
opencodeGoProviderDefinition,
kenariProviderDefinition,
nanoGptProviderDefinition,
inferProviderDefinition,
zooGatewayProviderDefinition,
basetenProviderDefinition,
] as const satisfies readonly ProviderDefinition[]
44 changes: 44 additions & 0 deletions packages/types/src/providers/infer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { z } from "zod"

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

// Infer: OpenAI-compatible gateway to OpenAI, Anthropic, Google and xAI models.
// https://infer.flow7.org/docs · base URL: https://infer.flow7.org/v1
//
// A model id selects a model and a route, for example `infer/claude-opus-5-5:low-cost`.
// The routes are Low cost, Balanced, Stable and Official, at different prices.
// The public catalog lists each route with its prices and limits, so the model list
// is fetched at runtime. The values below are only a fallback for the time before
// the catalog resolves.

export const INFER_BASE_URL = "https://infer.flow7.org/v1"

Check warning on line 16 in packages/types/src/providers/infer.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

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

export const INFER_CATALOG_URL = "https://infer.flow7.org/api/public/catalog"

Check warning on line 18 in packages/types/src/providers/infer.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

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

export const inferDefaultModelId = "infer/claude-opus-5-5:low-cost"

export const inferDefaultModelInfo: ModelInfo = {

Check warning on line 22 in packages/types/src/providers/infer.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/infer.ts:22: Survived ObjectLiteral mutant (replacement: {}). See the job summary for the complete list and resolution guidance.
maxTokens: 128_000,
contextWindow: 1_000_000,
supportsImages: false,

Check warning on line 25 in packages/types/src/providers/infer.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/infer.ts:25: Survived BooleanLiteral mutant (replacement: true). See the job summary for the complete list and resolution guidance.
supportsPromptCache: false,

Check warning on line 26 in packages/types/src/providers/infer.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

packages/types/src/providers/infer.ts:26: Survived BooleanLiteral mutant (replacement: true). See the job summary for the complete list and resolution guidance.
// Prices are intentionally omitted: they come only from the live catalog, so a
// fallback never shows a stale price.
description: "Infer model. Routes, prices and limits are resolved dynamically from the public catalog.",

Check warning on line 29 in packages/types/src/providers/infer.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

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

const INFER_MODEL_ID_FIELD = "inferModelId"

Check warning on line 32 in packages/types/src/providers/infer.ts

View workflow job for this annotation

GitHub Actions / mutation-diff

Mutation test advisory

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

export const inferProviderDefinition = createProviderDefinition({
apiProvider: providerIdentifiers.infer,
modelIdKey: INFER_MODEL_ID_FIELD,
getModelId: createModelIdAccessor(INFER_MODEL_ID_FIELD),
getDefaultModelId: () => inferDefaultModelId,
schema: {
...baseProviderSettingsShape,
inferApiKey: z.string().optional(),
[INFER_MODEL_ID_FIELD]: z.string().optional(),
},
})
2 changes: 2 additions & 0 deletions src/api/__tests__/index.spec.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
VercelAiGatewayHandler,
OpencodeGoHandler,
KenariHandler,
InferHandler,
NanoGptHandler,
ZooGatewayHandler,
MiniMaxHandler,
Expand Down Expand Up @@ -285,6 +286,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
return new OpencodeGoHandler(options)
case providerIdentifiers.kenari:
return new KenariHandler(options)
case providerIdentifiers.infer:
return new InferHandler(options)
case providerIdentifiers.nanogpt:
return new NanoGptHandler(options)
case providerIdentifiers.zooGateway:
Expand Down
Loading
Loading