Skip to content
Merged
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/types/src/global-settings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -316,6 +316,7 @@ export const SECRET_STATE_KEYS = [
"sambaNovaApiKey",
"zaiApiKey",
"fireworksApiKey",
"friendliApiKey",
"vercelAiGatewayApiKey",
"opencodeGoApiKey",
"basetenApiKey",
Expand Down
14 changes: 14 additions & 0 deletions packages/types/src/provider-settings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@ import {
bedrockModels,
deepSeekModels,
fireworksModels,
friendliModels,
geminiModels,
mistralModels,
moonshotModels,
Expand DownExpand Up@@ -119,6 +120,7 @@ export const providerNames = [
"baseten",
"deepseek",
"fireworks",
"friendli",
"gemini",
"gemini-cli",
"mistral",
Expand DownExpand Up@@ -393,6 +395,10 @@ const fireworksSchema = apiModelIdProviderModelSchema.extend({
fireworksApiKey: z.string().optional(),
})

const friendliSchema = apiModelIdProviderModelSchema.extend({
friendliApiKey: z.string().optional(),
})

const qwenCodeSchema = apiModelIdProviderModelSchema.extend({
qwenCodeOauthPath: z.string().optional(),
})
Expand DownExpand Up@@ -449,6 +455,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
sambaNovaSchema.merge(z.object({ apiProvider: z.literal("sambanova") })),
zaiSchema.merge(z.object({ apiProvider: z.literal("zai") })),
fireworksSchema.merge(z.object({ apiProvider: z.literal("fireworks") })),
friendliSchema.merge(z.object({ apiProvider: z.literal("friendli") })),
qwenCodeSchema.merge(z.object({ apiProvider: z.literal("qwen-code") })),
vercelAiGatewaySchema.merge(z.object({ apiProvider: z.literal("vercel-ai-gateway") })),
opencodeGoSchema.merge(z.object({ apiProvider: z.literal("opencode-go") })),
Expand DownExpand Up@@ -485,6 +492,7 @@ export const providerSettingsSchema = z.object({
...sambaNovaSchema.shape,
...zaiSchema.shape,
...fireworksSchema.shape,
...friendliSchema.shape,
...qwenCodeSchema.shape,
...vercelAiGatewaySchema.shape,
...opencodeGoSchema.shape,
Expand DownExpand Up@@ -565,6 +573,7 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
sambanova: "apiModelId",
zai: "apiModelId",
fireworks: "apiModelId",
friendli: "apiModelId",
"vercel-ai-gateway": "vercelAiGatewayModelId",
"opencode-go": "opencodeGoModelId",
"zoo-gateway": "zooGatewayModelId",
Expand DownExpand Up@@ -638,6 +647,11 @@ export const MODELS_BY_PROVIDER: Record<
label: "Fireworks",
models: Object.keys(fireworksModels),
},
friendli: {
id: "friendli",
label: "Friendli",
models: Object.keys(friendliModels),
},
gemini: {
id: "gemini",
label: "Google Gemini",
Expand Down
63 changes: 63 additions & 0 deletions packages/types/src/providers/friendli.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
import type { ModelInfo } from "../model.js"

export type FriendliModelId =
| "zai-org/GLM-5.2"
| "zai-org/GLM-5.1"
| "deepseek-ai/DeepSeek-V3.2"
| "MiniMaxAI/MiniMax-M2.5"

export const friendliDefaultModelId: FriendliModelId = "zai-org/GLM-5.2"

// Pricing sourced from https://friendli.ai/api/public/model-apis (per 1M tokens).
export const friendliModels = {
"zai-org/GLM-5.2": {
maxTokens: 131_072,
contextWindow: 1_000_000,
supportsImages: false,
supportsPromptCache: true,
supportsMaxTokens: true,
inputPrice: 1.4,
outputPrice: 4.4,
cacheWritesPrice: 0,
cacheReadsPrice: 0.26,
description:
"GLM-5.2 is Zhipu's flagship model with a 1M context window and 128k max output, served via Friendli Model APIs. It delivers top-tier long-context reasoning, coding, and agentic performance for extended engineering sessions.",
},
"zai-org/GLM-5.1": {
maxTokens: 131_072,
contextWindow: 200_000,
supportsImages: false,
supportsPromptCache: true,
supportsMaxTokens: true,
inputPrice: 1.4,
outputPrice: 4.4,
cacheWritesPrice: 0,
cacheReadsPrice: 0.26,
description:
"GLM-5.1 is Zhipu's most capable model with a 200k context window and 128k max output, served via Friendli Model APIs. It delivers top-tier reasoning, coding, and agentic performance.",
},
"deepseek-ai/DeepSeek-V3.2": {
maxTokens: 16384,
contextWindow: 163_840,
supportsImages: false,
supportsPromptCache: true,
inputPrice: 0.5,
outputPrice: 1.5,
cacheWritesPrice: 0,
cacheReadsPrice: 0.25,
description:
"DeepSeek V3.2 is the latest iteration of the V3 model family with enhanced reasoning capabilities, improved code generation, and better instruction following, served via Friendli Model APIs.",
},
"MiniMaxAI/MiniMax-M2.5": {
maxTokens: 4096,
contextWindow: 204_800,
supportsImages: false,
supportsPromptCache: true,
inputPrice: 0.3,
outputPrice: 1.2,
cacheWritesPrice: 0,
cacheReadsPrice: 0.06,
description:
"MiniMax M2.5 is a high-performance language model with a 204.8K context window, optimized for long-context understanding and generation tasks, served via Friendli Model APIs.",
},
} as const satisfies Record<string, ModelInfo>
4 changes: 4 additions & 0 deletions packages/types/src/providers/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,7 @@ export * from "./baseten.js"
export * from "./bedrock.js"
export * from "./deepseek.js"
export * from "./fireworks.js"
export * from "./friendli.js"
export * from "./gemini.js"
export * from "./lite-llm.js"
export * from "./lm-studio.js"
Expand DownExpand Up@@ -33,6 +34,7 @@ import { basetenDefaultModelId } from "./baseten.js"
import { bedrockDefaultModelId } from "./bedrock.js"
import { deepSeekDefaultModelId } from "./deepseek.js"
import { fireworksDefaultModelId } from "./fireworks.js"
import { friendliDefaultModelId } from "./friendli.js"
import { geminiDefaultModelId } from "./gemini.js"
import { litellmDefaultModelId } from "./lite-llm.js"
import { mistralDefaultModelId } from "./mistral.js"
Expand DownExpand Up@@ -111,6 +113,8 @@ export function getProviderDefaultModelId(
return sambaNovaDefaultModelId
case "fireworks":
return fireworksDefaultModelId
case "friendli":
return friendliDefaultModelId
case "qwen-code":
return qwenCodeDefaultModelId
case "poe":
Expand Down
3 changes: 3 additions & 0 deletions src/api/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,7 @@ import {
SambaNovaHandler,
ZAiHandler,
FireworksHandler,
FriendliHandler,
VercelAiGatewayHandler,
OpencodeGoHandler,
ZooGatewayHandler,
Expand DownExpand Up@@ -189,6 +190,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
return new ZAiHandler(options)
case "fireworks":
return new FireworksHandler(options)
case "friendli":
return new FriendliHandler(options)
case "vercel-ai-gateway":
return new VercelAiGatewayHandler(options)
case "opencode-go":
Expand Down
Loading
Loading