Compare commits

...
12 Commits
Author SHA1 Message Date
yiling 6ab650bc80 Release v0.2.1 2026-07-22 20:01:30 +08:00
Yiling-J 1886cbe420 Merge pull request #212 from shumaiOne/fix/provider-update-preserve-model-ids
fix(provider): preserve model ids on provider update
2026-07-22 16:35:08 +08:00
yiling 43dd53a30d fix(provider): preserve model ids on provider update 2026-07-22 16:27:58 +08:00
Yiling-J b1e77db6d0 Merge pull request #211 from shumaiOne/fix/pi-model-fallback
fix(agent): handle non-builtin models in getModelFromDb and upgrade pi-ai
2026-07-22 16:16:26 +08:00
yiling e9959bcc68 fix(agent): handle non-builtin models in getModelFromDb and upgrade pi-ai 2026-07-22 16:09:36 +08:00
Yiling-J fbf963fe43 Merge pull request #210 from shumaiOne/fix/generate-providers-split
refactor(core): split generated providers into per-provider files
2026-07-22 15:09:07 +08:00
yiling c364e0e695 fix(core): guard top-level sync execution and add remote fallback for model data loading 2026-07-22 12:19:37 +08:00
yiling a4b6b0b775 refactor(core): split generated providers into per-provider files 2026-07-22 12:04:07 +08:00
Yiling-J acc255fff4 Merge pull request #209 from shumaiOne/feat/skill-permission
feat(skill): add team owner skill permission control
2026-07-22 11:13:31 +08:00
yiling bc63a95bf5 fix(agent): update agent tools to throw errors directly on failure 2026-07-22 11:05:19 +08:00
yiling bbe1e7128d fix(agent): throw error on read_skill failure instead of returning error content 2026-07-22 10:43:14 +08:00
yiling 9158598c5b feat(skill): add team owner skill permission control 2026-07-22 10:27:32 +08:00
98 changed files with 20723 additions and 17570 deletions
+1
View File
@@ -11,6 +11,7 @@ data/
*.db
*.diff
*.orig
.agents
# Playwright
/playwright-report/
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/agent-app",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/cli",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/transcode-app",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/web-app",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"dependencies": {
+21 -17
View File
@@ -33,7 +33,7 @@
},
"apps/agent": {
"name": "@shumai/agent-app",
"version": "0.1.10",
"version": "0.2.0",
"bin": {
"shumai-agent": "./src/index.ts",
},
@@ -45,7 +45,7 @@
},
"apps/cli": {
"name": "@shumai/cli",
"version": "0.1.10",
"version": "0.2.0",
"bin": {
"shumai-cli": "./src/index.ts",
},
@@ -60,7 +60,7 @@
},
"apps/transcode": {
"name": "@shumai/transcode-app",
"version": "0.1.10",
"version": "0.2.0",
"bin": {
"shumai-transcode": "./src/index.ts",
},
@@ -72,7 +72,7 @@
},
"apps/web": {
"name": "@shumai/web-app",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@shumai/agent": "workspace:*",
"@shumai/api": "workspace:*",
@@ -92,11 +92,11 @@
},
"packages/agent": {
"name": "@shumai/agent",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@anthropic-ai/sandbox-runtime": "0.0.52",
"@earendil-works/pi-agent-core": "0.78.0",
"@earendil-works/pi-ai": "0.75.4",
"@earendil-works/pi-ai": "0.80.7",
"@google/genai": "1.52.0",
"@shumai/core": "workspace:*",
"@shumai/db": "workspace:*",
@@ -117,7 +117,7 @@
},
"packages/api": {
"name": "@shumai/api",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@hono/zod-validator": "0.7.6",
"@shumai/core": "workspace:*",
@@ -131,7 +131,7 @@
},
"packages/core": {
"name": "@shumai/core",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@earendil-works/pi-agent-core": "0.78.0",
"@shumai/db": "workspace:*",
@@ -162,7 +162,7 @@
},
"packages/db": {
"name": "@shumai/db",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@earendil-works/pi-agent-core": "0.78.0",
"@prisma/adapter-pg": "7.8.0",
@@ -178,7 +178,7 @@
},
"packages/dtos": {
"name": "@shumai/dtos",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@earendil-works/pi-agent-core": "0.78.0",
"zod": "4.4.3",
@@ -186,7 +186,7 @@
},
"packages/e2e": {
"name": "@shumai/e2e",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@earendil-works/pi-agent-core": "0.78.0",
"@google/genai": "1.52.0",
@@ -200,11 +200,11 @@
},
"packages/tableprinter": {
"name": "@shumai/tableprinter",
"version": "0.1.10",
"version": "0.2.0",
},
"packages/transcode": {
"name": "@shumai/transcode",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@shumai/core": "workspace:*",
"@shumai/db": "workspace:*",
@@ -218,7 +218,7 @@
},
"packages/webui": {
"name": "@shumai/webui",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@base-ui/react": "1.5.0",
"@dnd-kit/abstract": "0.4.0",
@@ -316,7 +316,7 @@
},
"packages/workflow-core": {
"name": "@shumai/workflow-core",
"version": "0.1.10",
"version": "0.2.0",
"dependencies": {
"@shumai/core": "workspace:*",
"@shumai/db": "workspace:*",
@@ -465,7 +465,7 @@
"@earendil-works/pi-agent-core": ["@earendil-works/pi-agent-core@0.78.0", "", { "dependencies": { "@earendil-works/pi-ai": "^0.78.0", "ignore": "7.0.5", "typebox": "1.1.38", "yaml": "2.9.0" } }, "sha512-xhWd59Qzd8yO88gYQw2S4dEQstJJEiUtxRP01//YzVJ61jCtUASMfcyAmYhgGYR4Onp7GmwEAbBBGOiV6Iwk9g=="],
"@earendil-works/pi-ai": ["@earendil-works/pi-ai@0.75.4", "", { "dependencies": { "@anthropic-ai/sdk": "0.91.1", "@aws-sdk/client-bedrock-runtime": "3.1048.0", "@google/genai": "1.52.0", "@mistralai/mistralai": "2.2.1", "http-proxy-agent": "7.0.2", "https-proxy-agent": "7.0.6", "openai": "6.26.0", "partial-json": "0.1.7", "typebox": "1.1.38" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-m/w8Hh3vQ0rAycwJiJWdzkypkn4295f4eq/966lDRy8aX5sk6bgYXH8TQmL16TO7Uwc7MbJG0QoyFHgX8RqXUQ=="],
"@earendil-works/pi-ai": ["@earendil-works/pi-ai@0.80.7", "", { "dependencies": { "@anthropic-ai/sdk": "0.91.1", "@aws-sdk/client-bedrock-runtime": "3.1048.0", "@google/genai": "1.52.0", "@mistralai/mistralai": "2.2.6", "@opentelemetry/api": "1.9.0", "@smithy/node-http-handler": "4.7.3", "http-proxy-agent": "7.0.2", "https-proxy-agent": "7.0.6", "openai": "6.26.0", "partial-json": "0.1.7", "typebox": "1.1.38" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-8RLKLwe5TFM9kKFMNu/lTzveduq4GxZbnlG6ba8FAhLeb5wJP4zbj1eBumKBRvggpFQnW5R/Vo2a8zTlHsV9SQ=="],
"@electric-sql/pglite": ["@electric-sql/pglite@0.4.1", "", {}, "sha512-mZ9NzzUSYPOCnxHH1oAHPRzoMFJHY472raDKwXl/+6oPbpdJ7g8LsCN4FSaIIfkiCKHhb3iF/Zqo3NYxaIhU7Q=="],
@@ -731,7 +731,7 @@
"@lix-js/server-protocol-schema": ["@lix-js/server-protocol-schema@0.1.1", "", {}, "sha512-jBeALB6prAbtr5q4vTuxnRZZv1M2rKe8iNqRQhFJ4Tv7150unEa0vKyz0hs8Gl3fUGsWaNJBh3J8++fpbrpRBQ=="],
"@mistralai/mistralai": ["@mistralai/mistralai@2.2.1", "", { "dependencies": { "ws": "^8.18.0", "zod": "^3.25.0 || ^4.0.0", "zod-to-json-schema": "^3.25.0" } }, "sha512-uKU8CZmL2RzYKmplsU01hii4p3pe4HqJefpWNRWXm1Tcm0Sm4xXfwSLIy4k7ZCPlbETCGcp69E7hZs+WOJ5itQ=="],
"@mistralai/mistralai": ["@mistralai/mistralai@2.2.6", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.40.0", "ws": "^8.18.0", "zod": "^3.25.0 || ^4.0.0", "zod-to-json-schema": "^3.25.0" }, "peerDependencies": { "@opentelemetry/api": "^1.9.0" }, "optionalPeers": ["@opentelemetry/api"] }, "sha512-W8pX7zHxjJvMIpw8JMxeJEleapXX0Q9NPszdNzqkM3MIEoIGPObdodujj+WHteXEvGfaP/AMwlNyRfEzSY6dQQ=="],
"@napi-rs/canvas": ["@napi-rs/canvas@1.0.2", "", { "optionalDependencies": { "@napi-rs/canvas-android-arm64": "1.0.2", "@napi-rs/canvas-darwin-arm64": "1.0.2", "@napi-rs/canvas-darwin-x64": "1.0.2", "@napi-rs/canvas-linux-arm-gnueabihf": "1.0.2", "@napi-rs/canvas-linux-arm64-gnu": "1.0.2", "@napi-rs/canvas-linux-arm64-musl": "1.0.2", "@napi-rs/canvas-linux-riscv64-gnu": "1.0.2", "@napi-rs/canvas-linux-x64-gnu": "1.0.2", "@napi-rs/canvas-linux-x64-musl": "1.0.2", "@napi-rs/canvas-win32-arm64-msvc": "1.0.2", "@napi-rs/canvas-win32-x64-msvc": "1.0.2" } }, "sha512-EYEqlMYaCbpZDz+IgDH5xp9MTd3ui4dmGqbQYryhMLnSRxrhHKq5KQWHHKxFUcEP4Hp8/BWgvqXocX4j7iSbOQ=="],
@@ -763,6 +763,8 @@
"@nodable/entities": ["@nodable/entities@2.1.1", "", {}, "sha512-Pig3HxDIoMgjdEH8OCf/dkcTmLFjJRjWuq8jSnklu284/TKOPibSRERmOykiwmyXTtv61mP+44f3GMx0tLAyjg=="],
"@opentelemetry/api": ["@opentelemetry/api@1.9.0", "", {}, "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg=="],
"@opentelemetry/semantic-conventions": ["@opentelemetry/semantic-conventions@1.41.1", "", {}, "sha512-/UhIkaZgPutTFmQ7RnIJGgDXZmtEJ7Dvi86xNTFWcnRxVRNk/aotsqDJYeEvDP+FSMB2SdW+pQzNMcWP0rwuNA=="],
"@oven/bun-darwin-aarch64": ["@oven/bun-darwin-aarch64@1.3.14", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Omj20SuiHBOUjUBIyqtkNjSUIjOtEOJwmbix/ZyFH4BaQ6OZTaaRWIR4TjHVz0yadHgli6lLTiAh1uarnvD49A=="],
@@ -3245,6 +3247,8 @@
"yauzl/buffer-crc32": ["buffer-crc32@0.2.13", "", {}, "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ=="],
"@earendil-works/pi-agent-core/@earendil-works/pi-ai/@mistralai/mistralai": ["@mistralai/mistralai@2.2.1", "", { "dependencies": { "ws": "^8.18.0", "zod": "^3.25.0 || ^4.0.0", "zod-to-json-schema": "^3.25.0" } }, "sha512-uKU8CZmL2RzYKmplsU01hii4p3pe4HqJefpWNRWXm1Tcm0Sm4xXfwSLIy4k7ZCPlbETCGcp69E7hZs+WOJ5itQ=="],
"@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
"@isaacs/cliui/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "shumai",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"repository": {
+11 -11
View File
@@ -1,27 +1,27 @@
{
"name": "@shumai/agent",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.ts",
"dependencies": {
"@shumai/db": "workspace:*",
"@shumai/dtos": "workspace:*",
"@shumai/core": "workspace:*",
"@shumai/workflow-core": "workspace:*",
"@google/genai": "1.52.0",
"@anthropic-ai/sandbox-runtime": "0.0.52",
"@earendil-works/pi-agent-core": "0.78.0",
"@earendil-works/pi-ai": "0.75.4",
"@earendil-works/pi-ai": "0.80.7",
"@google/genai": "1.52.0",
"@shumai/core": "workspace:*",
"@shumai/db": "workspace:*",
"@shumai/dtos": "workspace:*",
"@shumai/workflow-core": "workspace:*",
"@sinclair/typebox": "0.34.49",
"@temporalio/activity": "1.17.2",
"@temporalio/worker": "1.17.2",
"@temporalio/workflow": "1.17.2",
"@sinclair/typebox": "0.34.49",
"ulid": "3.0.2",
"adm-zip": "0.5.17",
"zod": "4.4.3",
"jittered-fractional-indexing": "1.0.1"
"jittered-fractional-indexing": "1.0.1",
"ulid": "3.0.2",
"zod": "4.4.3"
},
"devDependencies": {
"@types/adm-zip": "0.5.8"
+38 -1
View File
@@ -1,5 +1,10 @@
import { describe, it, expect, vi } from 'vitest'
import { formatSkillsForPrompt, createAgentSession } from './index'
import {
formatSkillsForPrompt,
createAgentSession,
getModelFromDb,
type DbProviderInfo,
} from './index'
import { createSandboxedBashTool } from './tools/sandboxed-bash'
import { SandboxManager, type SandboxAskCallback } from '@anthropic-ai/sandbox-runtime'
import { prisma } from '@shumai/db'
@@ -374,3 +379,35 @@ describe('Sandbox Network isolation integration', () => {
}
})
})
describe('getModelFromDb', () => {
it('should correctly initialize non-built-in model with provider and id', () => {
const providers: DbProviderInfo[] = [
{
name: 'google',
config: { api: 'google-generative-ai', apiKey: 'GOOGLE_API_KEY' },
models: [
{
modelId: 'non-existent-or-future-model',
name: 'Future Model',
config: {
api: 'google-generative-ai',
reasoning: false,
input: ['text'],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 8192,
maxTokens: 4096,
},
},
],
},
]
const model = getModelFromDb(providers, 'google', 'non-existent-or-future-model')
expect(model).toBeDefined()
expect(model?.id).toBe('non-existent-or-future-model')
expect(model?.provider).toBe('google')
expect(model?.api).toBe('google-generative-ai')
})
})
+7 -3
View File
@@ -6,7 +6,7 @@ import {
type ThinkingLevel,
} from '@earendil-works/pi-agent-core'
import { NodeExecutionEnv } from '@earendil-works/pi-agent-core/node'
import { getModel } from '@earendil-works/pi-ai'
import { getModel } from '@earendil-works/pi-ai/compat'
import { Type, type TSchema } from '@sinclair/typebox'
import * as fs from 'fs'
import * as path from 'path'
@@ -47,7 +47,11 @@ export function getModelFromDb(providers: DbProviderInfo[], providerName: string
try {
// Try to get built-in model as template
// eslint-disable-next-line @typescript-eslint/no-explicit-any
m = { ...(getModel as any)(providerName, modelId) }
const builtIn = (getModel as any)(providerName, modelId)
if (!builtIn) {
throw new Error(`Model ${modelId} is not a built-in model`)
}
m = { ...builtIn }
} catch {
// Not a built-in model
m = {
@@ -243,7 +247,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
sandboxState.blockedHost = ''
},
})
const readSkill = createReadSkillTool(onEnvsAdded)
const readSkill = createReadSkillTool(userId, onEnvsAdded)
const systemTools: AgentTool[] = []
if (userId) {
+82 -105
View File
@@ -23,126 +23,103 @@ export function createAnalyzeImageTool(
'Retrieves and views the image content. Call this tool if you need to analyze the image.',
parameters: analyzeImageSchema,
execute: async (_toolCallId, params) => {
try {
const assetId = params.assetId
const assetId = params.assetId
if (!userId) {
return {
content: [{ type: 'text', text: 'User ID is required for authorization.' }],
details: {},
}
if (!userId) {
throw new Error('User ID is required for authorization.')
}
await authzService.hasPermission({
user: { id: userId } as User,
permission: Permission.Read,
type: ResourceType.Asset,
id: assetId,
})
const asset = await prisma.asset.findUnique({
where: { id: assetId },
include: { storageKey: true },
})
if (!asset) {
throw new Error(`Asset with ID ${assetId} not found.`)
}
// Get default media key
let mediaKey = asset.storageKey?.key
if (asset.media) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mediaInfo = asset.media as any
if (mediaInfo.imageTranscodes && mediaInfo.imageTranscodes.length > 0) {
mediaKey = mediaInfo.imageTranscodes[0].key || mediaKey
}
}
await authzService.hasPermission({
user: { id: userId } as User,
permission: Permission.Read,
type: ResourceType.Asset,
id: assetId,
if (!mediaKey) {
throw new Error('No media content found for this asset.')
}
// Check if trigger comment has draw annotations for this asset
let annotations: unknown = null
if (userCommentId) {
const comment = await prisma.assetComment.findUnique({
where: { id: userCommentId },
})
const asset = await prisma.asset.findUnique({
where: { id: assetId },
include: { storageKey: true },
})
if (!asset) {
return {
content: [{ type: 'text', text: `Asset with ID ${assetId} not found.` }],
details: {},
if (comment && comment.assetId === assetId && comment.annotation) {
const list = comment.annotation
if (Array.isArray(list) && list.length > 0) {
annotations = list
}
}
}
// Get default media key
let mediaKey = asset.storageKey?.key
if (asset.media) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mediaInfo = asset.media as any
if (mediaInfo.imageTranscodes && mediaInfo.imageTranscodes.length > 0) {
mediaKey = mediaInfo.imageTranscodes[0].key || mediaKey
}
}
let keyToUse = mediaKey
if (!mediaKey) {
return {
content: [{ type: 'text', text: 'No media content found for this asset.' }],
details: {},
}
}
// Check if trigger comment has draw annotations for this asset
let annotations: unknown = null
if (userCommentId) {
const comment = await prisma.assetComment.findUnique({
where: { id: userCommentId },
})
if (comment && comment.assetId === assetId && comment.annotation) {
const list = comment.annotation
if (Array.isArray(list) && list.length > 0) {
annotations = list
}
}
}
let keyToUse = mediaKey
if (annotations) {
// Trigger transcode workflow to draw annotation
const task = await prisma.workflowTask.create({
data: {
assetId,
if (annotations) {
// Trigger transcode workflow to draw annotation
const task = await prisma.workflowTask.create({
data: {
assetId,
projectId: asset.projectId || 'none',
type: WorkflowTaskType.transcode_image_annotation,
status: WorkflowTaskStatus.pending,
payload: {
projectId: asset.projectId || 'none',
type: WorkflowTaskType.transcode_image_annotation,
status: WorkflowTaskStatus.pending,
payload: {
projectId: asset.projectId || 'none',
imageAnnotation: {
annotations: annotations as PrismaJson.AnnotationList,
},
imageAnnotation: {
annotations: annotations as PrismaJson.AnnotationList,
},
},
})
const completedTask = await workflowService.executeWait(task)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const output = completedTask.output as any
if (output?.key) {
keyToUse = output.key
} else {
throw new Error('Image annotation transcode workflow failed to output S3 key.')
}
}
// Retrieve the image content from S3
const bucket = process.env.S3_BUCKET || 'shumai'
const { buffer, contentType } = await s3Service.getObject(bucket, keyToUse)
const content: ImageContent[] = [
{
type: 'image',
data: buffer.toString('base64'),
mimeType: contentType || 'image/webp',
},
]
})
return {
content,
details: {
sourceKeys: [keyToUse],
},
}
} catch (error) {
return {
content: [
{
type: 'text',
text: `Error analyzing image: ${
error instanceof Error ? error.message : String(error)
}`,
},
],
details: {},
const completedTask = await workflowService.executeWait(task)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const output = completedTask.output as any
if (output?.key) {
keyToUse = output.key
} else {
throw new Error('Image annotation transcode workflow failed to output S3 key.')
}
}
// Retrieve the image content from S3
const bucket = process.env.S3_BUCKET || 'shumai'
const { buffer, contentType } = await s3Service.getObject(bucket, keyToUse)
const content: ImageContent[] = [
{
type: 'image',
data: buffer.toString('base64'),
mimeType: contentType || 'image/webp',
},
]
return {
content,
details: {
sourceKeys: [keyToUse],
},
}
},
}
}
+24 -36
View File
@@ -58,45 +58,33 @@ export function createCreateFileTool(userId: string): AgentTool<typeof createFil
description: 'Create a new file in a specified parent folder from a local file path.',
parameters: createFileSchema,
execute: async (_toolCallId, params) => {
try {
const absolutePath = path.resolve(process.cwd(), params.path)
if (!fs.existsSync(absolutePath)) {
throw new Error(`Local file not found at path: ${params.path}`)
}
const absolutePath = path.resolve(process.cwd(), params.path)
if (!fs.existsSync(absolutePath)) {
throw new Error(`Local file not found at path: ${params.path}`)
}
const fileSize = fs.statSync(absolutePath).size
const mimeType = getMimeType(absolutePath)
const fileSize = fs.statSync(absolutePath).size
const mimeType = getMimeType(absolutePath)
// Generate compliant S3 key matching normal file upload format
const s3Key = `files/${ulid()}/${sanitizeFilename(path.basename(absolutePath))}`
await s3Service.uploadFileToKey(absolutePath, s3Key, mimeType)
// Generate compliant S3 key matching normal file upload format
const s3Key = `files/${ulid()}/${sanitizeFilename(path.basename(absolutePath))}`
await s3Service.uploadFileToKey(absolutePath, s3Key, mimeType)
const result = await executeAgentToolWorkflow({
toolName: 'create_file',
args: {
parent: params.parent,
s3Key,
name: path.basename(absolutePath),
size: fileSize,
contentType: mimeType,
},
userId,
assetId: params.parent,
})
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
details: result,
}
} catch (error) {
return {
content: [
{
type: 'text',
text: `Error creating file: ${error instanceof Error ? error.message : String(error)}`,
},
],
details: {},
}
const result = await executeAgentToolWorkflow({
toolName: 'create_file',
args: {
parent: params.parent,
s3Key,
name: path.basename(absolutePath),
size: fileSize,
contentType: mimeType,
},
userId,
assetId: params.parent,
})
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
details: result,
}
},
}
+9 -21
View File
@@ -19,27 +19,15 @@ export function createCreateFolderTool(userId: string): AgentTool<typeof createF
description: 'Create a new folder in a specified parent folder.',
parameters: createFolderSchema,
execute: async (_toolCallId, params) => {
try {
const result = await executeAgentToolWorkflow({
toolName: 'create_folder',
args: params,
userId,
assetId: params.parent,
})
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
details: result,
}
} catch (error) {
return {
content: [
{
type: 'text',
text: `Error creating folder: ${error instanceof Error ? error.message : String(error)}`,
},
],
details: {},
}
const result = await executeAgentToolWorkflow({
toolName: 'create_folder',
args: params,
userId,
assetId: params.parent,
})
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
details: result,
}
},
}
+24 -36
View File
@@ -59,45 +59,33 @@ export function createCreateVersionTool(userId: string): AgentTool<typeof create
description: 'Create a new version of an existing file from a local file path.',
parameters: createVersionSchema,
execute: async (_toolCallId, params) => {
try {
const absolutePath = path.resolve(process.cwd(), params.path)
if (!fs.existsSync(absolutePath)) {
throw new Error(`Local file not found at path: ${params.path}`)
}
const absolutePath = path.resolve(process.cwd(), params.path)
if (!fs.existsSync(absolutePath)) {
throw new Error(`Local file not found at path: ${params.path}`)
}
const fileSize = fs.statSync(absolutePath).size
const mimeType = getMimeType(absolutePath)
const fileSize = fs.statSync(absolutePath).size
const mimeType = getMimeType(absolutePath)
// Generate compliant S3 key matching normal file upload format
const s3Key = `files/${ulid()}/${sanitizeFilename(path.basename(absolutePath))}`
await s3Service.uploadFileToKey(absolutePath, s3Key, mimeType)
// Generate compliant S3 key matching normal file upload format
const s3Key = `files/${ulid()}/${sanitizeFilename(path.basename(absolutePath))}`
await s3Service.uploadFileToKey(absolutePath, s3Key, mimeType)
const result = await executeAgentToolWorkflow({
toolName: 'create_version',
args: {
parent: params.parent,
s3Key,
name: path.basename(absolutePath),
size: fileSize,
contentType: mimeType,
},
userId,
assetId: params.parent,
})
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
details: result,
}
} catch (error) {
return {
content: [
{
type: 'text',
text: `Error creating file version: ${error instanceof Error ? error.message : String(error)}`,
},
],
details: {},
}
const result = await executeAgentToolWorkflow({
toolName: 'create_version',
args: {
parent: params.parent,
s3Key,
name: path.basename(absolutePath),
size: fileSize,
contentType: mimeType,
},
userId,
assetId: params.parent,
})
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
details: result,
}
},
}
+9 -21
View File
@@ -34,27 +34,15 @@ export function createListAssetsTool(userId: string): AgentTool<typeof listAsset
description: 'List the assets (files and folders) inside a parent folder with pagination.',
parameters: listAssetsSchema,
execute: async (_toolCallId, params) => {
try {
const result = await executeAgentToolWorkflow({
toolName: 'list_assets',
args: params,
userId,
assetId: params.parent,
})
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
details: result,
}
} catch (error) {
return {
content: [
{
type: 'text',
text: `Error listing assets: ${error instanceof Error ? error.message : String(error)}`,
},
],
details: {},
}
const result = await executeAgentToolWorkflow({
toolName: 'list_assets',
args: params,
userId,
assetId: params.parent,
})
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
details: result,
}
},
}
+24 -42
View File
@@ -151,49 +151,37 @@ describe('readPdfPagesTool', () => {
expect(result.details.sourceKeys).toEqual(['pdf_pages/page_1.webp', 'pdf_pages/page_2.webp'])
})
it('should return error text if start page is less than 1', async () => {
it('should throw error if start page is less than 1', async () => {
const tool = createReadPdfPagesTool('user-1')
const result = await tool.execute('call-1', { assetId: 'asset-1', start: 0, end: 5 })
expect(result.content[0]).toEqual({
type: 'text',
text: 'Invalid page range: start page (0) must be at least 1.',
})
await expect(tool.execute('call-1', { assetId: 'asset-1', start: 0, end: 5 })).rejects.toThrow(
'Invalid page range: start page (0) must be at least 1.',
)
})
it('should return error text if start page is greater than end page', async () => {
it('should throw error if start page is greater than end page', async () => {
const tool = createReadPdfPagesTool('user-1')
const result = await tool.execute('call-1', { assetId: 'asset-1', start: 5, end: 2 })
expect(result.content[0]).toEqual({
type: 'text',
text: 'Invalid page range: start page (5) must be less than or equal to end page (2).',
})
await expect(tool.execute('call-1', { assetId: 'asset-1', start: 5, end: 2 })).rejects.toThrow(
'Invalid page range: start page (5) must be less than or equal to end page (2).',
)
})
it('should return error text if page range exceeds maximum limit of 20', async () => {
it('should throw error if page range exceeds maximum limit of 20', async () => {
const tool = createReadPdfPagesTool('user-1')
const result = await tool.execute('call-1', { assetId: 'asset-1', start: 1, end: 25 })
expect(result.content[0]).toEqual({
type: 'text',
text: 'Page range (25 pages requested) exceeds the maximum limit of 20 pages per request.',
})
await expect(tool.execute('call-1', { assetId: 'asset-1', start: 1, end: 25 })).rejects.toThrow(
'Page range (25 pages requested) exceeds the maximum limit of 20 pages per request.',
)
})
it('should return error text if asset not found', async () => {
it('should throw error if asset not found', async () => {
vi.mocked(prisma.asset.findUnique).mockResolvedValue(null)
const tool = createReadPdfPagesTool('user-1')
const result = await tool.execute('call-1', { assetId: 'asset-1', start: 1, end: 3 })
expect(result.content[0]).toEqual({
type: 'text',
text: 'Asset with ID asset-1 not found.',
})
await expect(tool.execute('call-1', { assetId: 'asset-1', start: 1, end: 3 })).rejects.toThrow(
'Asset with ID asset-1 not found.',
)
})
it('should return error text if proxyType is not pdf', async () => {
it('should throw error if proxyType is not pdf', async () => {
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
id: 'asset-1',
projectId: 'project-1',
@@ -201,15 +189,12 @@ describe('readPdfPagesTool', () => {
} as unknown as Asset)
const tool = createReadPdfPagesTool('user-1')
const result = await tool.execute('call-1', { assetId: 'asset-1', start: 1, end: 3 })
expect(result.content[0]).toEqual({
type: 'text',
text: 'Asset asset-1 is not a PDF or document.',
})
await expect(tool.execute('call-1', { assetId: 'asset-1', start: 1, end: 3 })).rejects.toThrow(
'Asset asset-1 is not a PDF or document.',
)
})
it('should return error text if proxyType is null/undefined (unprocessed)', async () => {
it('should throw error if proxyType is null/undefined (unprocessed)', async () => {
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
id: 'asset-1',
projectId: 'project-1',
@@ -217,11 +202,8 @@ describe('readPdfPagesTool', () => {
} as unknown as Asset)
const tool = createReadPdfPagesTool('user-1')
const result = await tool.execute('call-1', { assetId: 'asset-1', start: 1, end: 3 })
expect(result.content[0]).toEqual({
type: 'text',
text: 'Asset asset-1 is not a PDF or document.',
})
await expect(tool.execute('call-1', { assetId: 'asset-1', start: 1, end: 3 })).rejects.toThrow(
'Asset asset-1 is not a PDF or document.',
)
})
})
+94 -140
View File
@@ -25,161 +25,115 @@ export function createReadPdfPagesTool(
'Converts specific page range of a PDF document into 1080p WebP images for visual analysis. Maximum 20 pages allowed per call.',
parameters: readPdfPagesSchema,
execute: async (_toolCallId, params) => {
try {
if (params.start < 1) {
return {
content: [
{
type: 'text',
text: `Invalid page range: start page (${params.start}) must be at least 1.`,
},
],
details: {},
}
}
if (params.start < 1) {
throw new Error(`Invalid page range: start page (${params.start}) must be at least 1.`)
}
if (params.start > params.end) {
return {
content: [
{
type: 'text',
text: `Invalid page range: start page (${params.start}) must be less than or equal to end page (${params.end}).`,
},
],
details: {},
}
}
if (params.start > params.end) {
throw new Error(
`Invalid page range: start page (${params.start}) must be less than or equal to end page (${params.end}).`,
)
}
const MAX_PAGE_RANGE = 20
const requestedPages = params.end - params.start + 1
if (requestedPages > MAX_PAGE_RANGE) {
return {
content: [
{
type: 'text',
text: `Page range (${requestedPages} pages requested) exceeds the maximum limit of ${MAX_PAGE_RANGE} pages per request.`,
},
],
details: {},
}
}
const MAX_PAGE_RANGE = 20
const requestedPages = params.end - params.start + 1
if (requestedPages > MAX_PAGE_RANGE) {
throw new Error(
`Page range (${requestedPages} pages requested) exceeds the maximum limit of ${MAX_PAGE_RANGE} pages per request.`,
)
}
const targetAssetId = params.assetId
const targetAssetId = params.assetId
if (!userId) {
return {
content: [{ type: 'text', text: 'User ID is required for authorization.' }],
details: {},
}
}
if (!userId) {
throw new Error('User ID is required for authorization.')
}
await authzService.hasPermission({
user: { id: userId } as User,
permission: Permission.Read,
type: ResourceType.Asset,
id: targetAssetId,
await authzService.hasPermission({
user: { id: userId } as User,
permission: Permission.Read,
type: ResourceType.Asset,
id: targetAssetId,
})
const asset = await prisma.asset.findUnique({
where: { id: targetAssetId },
})
if (!asset) {
throw new Error(`Asset with ID ${targetAssetId} not found.`)
}
const proxyType = (asset.media as PrismaJson.MediaInfo | null)?.proxyType
if (proxyType !== 'pdf') {
throw new Error(`Asset ${targetAssetId} is not a PDF or document.`)
}
// Fetch trigger comment details for comment page and annotations
let commentTimestamp: number | null = null
let annotations: unknown = null
if (userCommentId) {
const comment = await prisma.assetComment.findUnique({
where: { id: userCommentId },
})
const asset = await prisma.asset.findUnique({
where: { id: targetAssetId },
})
if (!asset) {
return {
content: [{ type: 'text', text: `Asset with ID ${targetAssetId} not found.` }],
details: {},
}
}
const proxyType = (asset.media as PrismaJson.MediaInfo | null)?.proxyType
if (proxyType !== 'pdf') {
return {
content: [{ type: 'text', text: `Asset ${targetAssetId} is not a PDF or document.` }],
details: {},
}
}
// Fetch trigger comment details for comment page and annotations
let commentTimestamp: number | null = null
let annotations: unknown = null
if (userCommentId) {
const comment = await prisma.assetComment.findUnique({
where: { id: userCommentId },
})
if (comment && comment.assetId === targetAssetId) {
commentTimestamp = comment.second !== null ? comment.second : null
if (comment.annotation) {
const list = comment.annotation
if (Array.isArray(list) && list.length > 0) {
annotations = list
}
if (comment && comment.assetId === targetAssetId) {
commentTimestamp = comment.second !== null ? comment.second : null
if (comment.annotation) {
const list = comment.annotation
if (Array.isArray(list) && list.length > 0) {
annotations = list
}
}
}
}
// Trigger transcode workflow to render PDF pages
const task = await prisma.workflowTask.create({
data: {
assetId: targetAssetId,
// Trigger transcode workflow to render PDF pages
const task = await prisma.workflowTask.create({
data: {
assetId: targetAssetId,
projectId: asset.projectId || 'none',
type: WorkflowTaskType.transcode_pdf_pages,
status: WorkflowTaskStatus.pending,
payload: {
projectId: asset.projectId || 'none',
type: WorkflowTaskType.transcode_pdf_pages,
status: WorkflowTaskStatus.pending,
payload: {
projectId: asset.projectId || 'none',
pdfPages: {
start: params.start,
end: params.end,
commentTimestamp,
annotations: annotations as PrismaJson.AnnotationList,
},
pdfPages: {
start: params.start,
end: params.end,
commentTimestamp,
annotations: annotations as PrismaJson.AnnotationList,
},
},
},
})
const completedTask = await workflowService.executeWait(task)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const output = completedTask.output as any
const pages = output?.pages as Array<{ key: string; page: number }> | undefined
if (!pages || pages.length === 0) {
throw new Error('No PDF page images were generated.')
}
const content: ImageContent[] = []
const sourceKeys: string[] = []
const bucket = process.env.S3_BUCKET || 'shumai'
for (const pageItem of pages) {
const { buffer, contentType } = await s3Service.getObject(bucket, pageItem.key)
content.push({
type: 'image',
data: buffer.toString('base64'),
mimeType: contentType || 'image/webp',
})
sourceKeys.push(pageItem.key)
}
const completedTask = await workflowService.executeWait(task)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const output = completedTask.output as any
const pages = output?.pages as Array<{ key: string; page: number }> | undefined
if (!pages || pages.length === 0) {
return {
content: [{ type: 'text', text: 'No PDF page images were generated.' }],
details: {},
}
}
const content: ImageContent[] = []
const sourceKeys: string[] = []
const bucket = process.env.S3_BUCKET || 'shumai'
for (const pageItem of pages) {
const { buffer, contentType } = await s3Service.getObject(bucket, pageItem.key)
content.push({
type: 'image',
data: buffer.toString('base64'),
mimeType: contentType || 'image/webp',
})
sourceKeys.push(pageItem.key)
}
return {
content,
details: {
sourceKeys,
},
}
} catch (error) {
return {
content: [
{
type: 'text',
text: `Error reading PDF pages: ${
error instanceof Error ? error.message : String(error)
}`,
},
],
details: {},
}
return {
content,
details: {
sourceKeys,
},
}
},
}
+63 -16
View File
@@ -18,16 +18,11 @@ describe('readSkillTool', () => {
vi.clearAllMocks()
})
it('should return error if skill not found', async () => {
const readSkillTool = createReadSkillTool(() => {})
const result = await readSkillTool.execute(
'1',
{ skillId: 'non-existent' },
undefined,
undefined,
)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect((result.content[0] as any).text).toContain('not found')
it('should throw error if skill not found', async () => {
const readSkillTool = createReadSkillTool(undefined, () => {})
await expect(
readSkillTool.execute('1', { skillId: 'non-existent' }, undefined, undefined),
).rejects.toThrow('not found')
})
it('should read skill from cache if hash matches', async () => {
@@ -49,7 +44,7 @@ describe('readSkillTool', () => {
return ''
})
const readSkillTool = createReadSkillTool(() => {})
const readSkillTool = createReadSkillTool(undefined, () => {})
const result = await readSkillTool.execute('1', { skillId: skill.id }, undefined, undefined)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -101,7 +96,7 @@ describe('readSkillTool', () => {
contentType: 'application/zip',
})
const readSkillTool = createReadSkillTool(() => {})
const readSkillTool = createReadSkillTool(undefined, () => {})
const result = await readSkillTool.execute('1', { skillId: skill.id }, undefined, undefined)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -146,7 +141,7 @@ describe('readSkillTool', () => {
})
let capturedEnvs: Record<string, string> = {}
const readSkillTool = createReadSkillTool((envs) => {
const readSkillTool = createReadSkillTool(undefined, (envs) => {
capturedEnvs = { ...capturedEnvs, ...envs }
})
await readSkillTool.execute('1', { skillId: skill.id }, undefined, undefined)
@@ -181,7 +176,7 @@ describe('readSkillTool', () => {
})
let capturedEnvs: Record<string, string> = {}
const readSkillTool = createReadSkillTool((envs) => {
const readSkillTool = createReadSkillTool(undefined, (envs) => {
capturedEnvs = { ...capturedEnvs, ...envs }
})
await readSkillTool.execute('1', { skillId: skill.id }, undefined, undefined)
@@ -216,7 +211,7 @@ describe('readSkillTool', () => {
})
let capturedEnvs: Record<string, string> = {}
const readSkillTool = createReadSkillTool((envs) => {
const readSkillTool = createReadSkillTool(undefined, (envs) => {
capturedEnvs = { ...capturedEnvs, ...envs }
})
await readSkillTool.execute('1', { skillId: skill.id }, undefined, undefined)
@@ -251,7 +246,7 @@ describe('readSkillTool', () => {
})
let capturedEnvs: Record<string, string> = {}
const readSkillTool = createReadSkillTool((envs) => {
const readSkillTool = createReadSkillTool(undefined, (envs) => {
capturedEnvs = { ...capturedEnvs, ...envs }
})
await readSkillTool.execute('1', { skillId: skill.id }, undefined, undefined)
@@ -261,4 +256,56 @@ describe('readSkillTool', () => {
})
})
})
describe('permissions', () => {
it('should allow loading skill matching user role level or lower', async () => {
const team = await prisma.team.create({ data: { name: 'Permission Team' } })
const ownerUser = await prisma.user.create({
data: { name: 'Owner User', email: 'owner@test.com' },
})
const reviewerUser = await prisma.user.create({
data: { name: 'Reviewer User', email: 'reviewer@test.com' },
})
await prisma.teamMember.create({
data: { teamId: team.id, userId: ownerUser.id, role: 'owner' },
})
await prisma.teamMember.create({
data: { teamId: team.id, userId: reviewerUser.id, role: 'reviewer' },
})
const ownerSkill = await prisma.skill.create({
data: {
name: 'Owner Skill',
assetId: 'asset1',
hash: 'hash-owner',
teamId: team.id,
permission: 'owner',
},
})
vi.spyOn(fs, 'existsSync').mockReturnValue(true)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.spyOn(fs, 'readFileSync').mockImplementation((path: any) => {
if (path.toString().endsWith('.hash')) return 'hash-owner'
if (path.toString().endsWith('SKILL.md')) return '# Owner Skill'
return ''
})
const ownerTool = createReadSkillTool(ownerUser.id, () => {})
const resultOwner = await ownerTool.execute(
'1',
{ skillId: ownerSkill.id },
undefined,
undefined,
)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect((resultOwner.content[0] as any).text).toBe('# Owner Skill')
const reviewerTool = createReadSkillTool(reviewerUser.id, () => {})
await expect(
reviewerTool.execute('1', { skillId: ownerSkill.id }, undefined, undefined),
).rejects.toThrow('Permission denied')
})
})
})
+43 -30
View File
@@ -7,7 +7,14 @@ const readSkillSchema = Type.Object({
skillId: Type.String({ description: 'The ID of the skill to read' }),
})
const ROLE_HIERARCHY: Record<string, number> = {
owner: 3,
editor: 2,
reviewer: 1,
}
export const createReadSkillTool = (
userId: string | undefined,
onEnvsAdded: (envs: Record<string, string>) => void,
): AgentTool<typeof readSkillSchema, { skillId: string }> => ({
name: 'read_skill',
@@ -15,41 +22,47 @@ export const createReadSkillTool = (
description: 'Downloads and reads an agent skill to understand how to use it.',
parameters: readSkillSchema,
execute: async (_toolCallId, params) => {
try {
const skill = await prisma.skill.findUnique({
where: { id: params.skillId },
})
const skill = await prisma.skill.findUnique({
where: { id: params.skillId },
})
if (!skill) {
return {
content: [{ type: 'text', text: `Skill with ID ${params.skillId} not found.` }],
details: { skillId: params.skillId },
}
}
if (!skill) {
throw new Error(`Skill with ID ${params.skillId} not found.`)
}
// Capture environment variables using agentService
const envs = await agentService.getSkillEnvs(params.skillId)
onEnvsAdded(envs)
const requiredLevel = ROLE_HIERARCHY[skill.permission] || 1
// Retrieve skill content using agentService
const skillMdContent = await agentService.getSkillContent(params.skillId)
return {
content: [{ type: 'text', text: skillMdContent }],
details: { skillId: params.skillId },
}
} catch (error) {
return {
content: [
{
type: 'text',
text: `Error reading skill ${params.skillId}: ${
error instanceof Error ? error.message : String(error)
}`,
if (userId) {
const member = await prisma.teamMember.findUnique({
where: {
teamIdUserId: {
teamId: skill.teamId,
userId,
},
],
details: { skillId: params.skillId },
},
})
const userLevel = member ? ROLE_HIERARCHY[member.role] || 0 : 0
if (userLevel < requiredLevel) {
throw new Error(
`Permission denied: Insufficient role to load skill "${skill.name}". Minimum required role is "${skill.permission}".`,
)
}
} else if (requiredLevel > 1) {
throw new Error(
`Permission denied: User context required to load skill "${skill.name}". Minimum required role is "${skill.permission}".`,
)
}
// Capture environment variables using agentService
const envs = await agentService.getSkillEnvs(params.skillId)
onEnvsAdded(envs)
// Retrieve skill content using agentService
const skillMdContent = await agentService.getSkillContent(params.skillId)
return {
content: [{ type: 'text', text: skillMdContent }],
details: { skillId: params.skillId },
}
},
})
+77 -100
View File
@@ -26,118 +26,95 @@ export function createScreenshotTool(
'Takes screenshots for a video at specified interval. It returns the images to the agent context.',
parameters: screenshotSchema,
execute: async (_toolCallId, params) => {
try {
const assetId = params.assetId
const assetId = params.assetId
if (!userId) {
return {
content: [{ type: 'text', text: 'User ID is required for authorization.' }],
details: {},
}
}
if (!userId) {
throw new Error('User ID is required for authorization.')
}
await authzService.hasPermission({
user: { id: userId } as User,
permission: Permission.Read,
type: ResourceType.Asset,
id: assetId,
await authzService.hasPermission({
user: { id: userId } as User,
permission: Permission.Read,
type: ResourceType.Asset,
id: assetId,
})
const asset = await prisma.asset.findUnique({
where: { id: assetId },
})
if (!asset) {
throw new Error(`Asset with ID ${assetId} not found.`)
}
// Fetch trigger comment details for timestamp and annotations
let commentTimestamp: number | null = null
let annotations: unknown = null
if (userCommentId) {
const comment = await prisma.assetComment.findUnique({
where: { id: userCommentId },
})
const asset = await prisma.asset.findUnique({
where: { id: assetId },
})
if (!asset) {
return {
content: [{ type: 'text', text: `Asset with ID ${assetId} not found.` }],
details: {},
}
}
// Fetch trigger comment details for timestamp and annotations
let commentTimestamp: number | null = null
let annotations: unknown = null
if (userCommentId) {
const comment = await prisma.assetComment.findUnique({
where: { id: userCommentId },
})
if (comment && comment.assetId === assetId) {
commentTimestamp = comment.second !== null ? comment.second : null
if (comment.annotation) {
const list = comment.annotation
if (Array.isArray(list) && list.length > 0) {
annotations = list
}
if (comment && comment.assetId === assetId) {
commentTimestamp = comment.second !== null ? comment.second : null
if (comment.annotation) {
const list = comment.annotation
if (Array.isArray(list) && list.length > 0) {
annotations = list
}
}
}
}
// Trigger transcode workflow to take screenshots
const task = await prisma.workflowTask.create({
data: {
assetId,
// Trigger transcode workflow to take screenshots
const task = await prisma.workflowTask.create({
data: {
assetId,
projectId: asset.projectId || 'none',
type: WorkflowTaskType.transcode_screenshot,
status: WorkflowTaskStatus.pending,
payload: {
projectId: asset.projectId || 'none',
type: WorkflowTaskType.transcode_screenshot,
status: WorkflowTaskStatus.pending,
payload: {
projectId: asset.projectId || 'none',
screenshot: {
start: params.start,
end: params.end,
count: params.count,
commentTimestamp,
annotations: annotations as PrismaJson.AnnotationList,
},
screenshot: {
start: params.start,
end: params.end,
count: params.count,
commentTimestamp,
annotations: annotations as PrismaJson.AnnotationList,
},
},
},
})
const completedTask = await workflowService.executeWait(task)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const output = completedTask.output as any
const screenshots = output?.screenshots as
| Array<{ key: string; timestamp: number }>
| undefined
if (!screenshots || screenshots.length === 0) {
throw new Error('No screenshots were generated.')
}
const content: ImageContent[] = []
const sourceKeys: string[] = []
const bucket = process.env.S3_BUCKET || 'shumai'
for (const shot of screenshots) {
const { buffer, contentType } = await s3Service.getObject(bucket, shot.key)
content.push({
type: 'image',
data: buffer.toString('base64'),
mimeType: contentType || 'image/webp',
})
sourceKeys.push(shot.key)
}
const completedTask = await workflowService.executeWait(task)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const output = completedTask.output as any
const screenshots = output?.screenshots as
| Array<{ key: string; timestamp: number }>
| undefined
if (!screenshots || screenshots.length === 0) {
return {
content: [{ type: 'text', text: 'No screenshots were generated.' }],
details: {},
}
}
const content: ImageContent[] = []
const sourceKeys: string[] = []
const bucket = process.env.S3_BUCKET || 'shumai'
for (const shot of screenshots) {
const { buffer, contentType } = await s3Service.getObject(bucket, shot.key)
content.push({
type: 'image',
data: buffer.toString('base64'),
mimeType: contentType || 'image/webp',
})
sourceKeys.push(shot.key)
}
return {
content,
details: {
sourceKeys,
},
}
} catch (error) {
return {
content: [
{
type: 'text',
text: `Error taking screenshots: ${
error instanceof Error ? error.message : String(error)
}`,
},
],
details: {},
}
return {
content,
details: {
sourceKeys,
},
}
},
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/api",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"main": "./src/index.ts",
+38
View File
@@ -47,6 +47,7 @@ describe('Skill API', () => {
config: null,
assetId: 'asset1',
hash: 'hash1',
permission: 'reviewer' as const,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
@@ -79,6 +80,7 @@ describe('Skill API', () => {
config: null,
assetId: 'asset1',
hash: 'hash1',
permission: 'reviewer' as const,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
}
@@ -110,6 +112,7 @@ describe('Skill API', () => {
config: null,
assetId: 'asset1',
hash: 'hash1',
permission: 'reviewer' as const,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
}
@@ -174,6 +177,7 @@ describe('Skill API', () => {
config: mockConfig,
assetId: 'asset1',
hash: 'hash1',
permission: 'reviewer' as const,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
}
@@ -197,4 +201,38 @@ describe('Skill API', () => {
expect(skillService.updateSkillConfig).toHaveBeenCalledWith('skill1', mockConfig)
})
})
describe('PATCH /skills/:id/permission', () => {
test('Success', async () => {
const mockSkill = {
id: 'skill1',
name: 'Skill 1',
description: 'Desc 1',
config: null,
assetId: 'asset1',
hash: 'hash1',
permission: 'owner' as const,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
}
vi.spyOn(skillService, 'updateSkillPermission').mockResolvedValue(mockSkill)
const res = await app.request('/skills/skill1/permission', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer test' },
body: JSON.stringify({ permission: 'owner' }),
})
expect(res.status).toBe(200)
expect(await res.json()).toEqual(mockSkill)
expect(authzService.hasPermission).toHaveBeenCalledWith(
expect.objectContaining({
type: ResourceType.Skill,
id: 'skill1',
permission: Permission.Admin,
}),
)
expect(skillService.updateSkillPermission).toHaveBeenCalledWith('skill1', 'owner')
})
})
})
+24 -1
View File
@@ -2,7 +2,11 @@ import { Hono } from 'hono'
import { zValidator } from '@hono/zod-validator'
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
import { skillService } from '@shumai/core/src/skill/skill'
import { upsertSkillRequestSchema, updateSkillConfigRequestSchema } from '@shumai/dtos'
import {
upsertSkillRequestSchema,
updateSkillConfigRequestSchema,
updateSkillPermissionRequestSchema,
} from '@shumai/dtos'
import type { Prisma } from '@shumai/db'
type User = Prisma.UserGetPayload<Record<string, never>>
@@ -73,5 +77,24 @@ const route = new Hono<{ Variables: { user: User } }>()
const skill = await skillService.updateSkillConfig(id, req.config)
return c.json(skill)
})
.patch(
'/skills/:id/permission',
zValidator('json', updateSkillPermissionRequestSchema),
async (c) => {
const user = c.get('user')
const id = c.req.param('id')
const req = c.req.valid('json')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Skill,
id,
})
const skill = await skillService.updateSkillPermission(id, req.permission)
return c.json(skill)
},
)
export default route
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/core",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"main": "./src/index.ts",
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,65 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'ant-ling'
export const providerConfig = {
name: 'ant-ling',
config: {
api: 'openai-completions',
baseUrl: 'https://api.ant-ling.com/v1',
apiKey: '',
},
models: [
{
modelId: 'Ling-2.6-1T',
name: 'Ling 2.6 1T',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.06,
output: 0.25,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Ling-2.6-flash',
name: 'Ling 2.6 Flash',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.01,
output: 0.02,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Ring-2.6-1T',
name: 'Ring 2.6 1T',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.06,
output: 0.25,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,252 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'anthropic'
export const providerConfig = {
name: 'anthropic',
config: {
api: 'anthropic-messages',
baseUrl: 'https://api.anthropic.com',
apiKey: 'ANTHROPIC_API_KEY',
},
models: [
{
modelId: 'claude-fable-5',
name: 'Claude Fable 5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 10,
output: 50,
cacheRead: 1,
cacheWrite: 12.5,
},
},
},
{
modelId: 'claude-haiku-4-5',
name: 'Claude Haiku 4.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 1,
output: 5,
cacheRead: 0.1,
cacheWrite: 1.25,
},
},
},
{
modelId: 'claude-haiku-4-5-20251001',
name: 'Claude Haiku 4.5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 1,
output: 5,
cacheRead: 0.1,
cacheWrite: 1.25,
},
},
},
{
modelId: 'claude-opus-4-1',
name: 'Claude Opus 4.1 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 32000,
cost: {
input: 15,
output: 75,
cacheRead: 1.5,
cacheWrite: 18.75,
},
},
},
{
modelId: 'claude-opus-4-1-20250805',
name: 'Claude Opus 4.1',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 32000,
cost: {
input: 15,
output: 75,
cacheRead: 1.5,
cacheWrite: 18.75,
},
},
},
{
modelId: 'claude-opus-4-5',
name: 'Claude Opus 4.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-5-20251101',
name: 'Claude Opus 4.5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-6',
name: 'Claude Opus 4.6',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-7',
name: 'Claude Opus 4.7',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-8',
name: 'Claude Opus 4.8',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-sonnet-4-5',
name: 'Claude Sonnet 4.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 64000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-4-5-20250929',
name: 'Claude Sonnet 4.5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 64000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-4-6',
name: 'Claude Sonnet 4.6',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-5',
name: 'Claude Sonnet 5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 2,
output: 10,
cacheRead: 0.2,
cacheWrite: 2.5,
},
},
},
],
} as const
@@ -0,0 +1,796 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'azure-openai-responses'
export const providerConfig = {
name: 'azure-openai-responses',
config: {
api: 'azure-openai-responses',
baseUrl: '',
apiKey: 'AZURE_OPENAI_API_KEY',
},
models: [
{
modelId: 'gpt-4',
name: 'GPT-4',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text'],
contextWindow: 8192,
maxTokens: 8192,
cost: {
input: 30,
output: 60,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4-turbo',
name: 'GPT-4 Turbo',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 4096,
cost: {
input: 10,
output: 30,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4.1',
name: 'GPT-4.1',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 1047576,
maxTokens: 32768,
cost: {
input: 2,
output: 8,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4.1-mini',
name: 'GPT-4.1 mini',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 1047576,
maxTokens: 32768,
cost: {
input: 0.4,
output: 1.6,
cacheRead: 0.1,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4.1-nano',
name: 'GPT-4.1 nano',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 1047576,
maxTokens: 32768,
cost: {
input: 0.1,
output: 0.4,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o',
name: 'GPT-4o',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 2.5,
output: 10,
cacheRead: 1.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o-2024-05-13',
name: 'GPT-4o (2024-05-13)',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 4096,
cost: {
input: 5,
output: 15,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o-2024-08-06',
name: 'GPT-4o (2024-08-06)',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 2.5,
output: 10,
cacheRead: 1.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o-2024-11-20',
name: 'GPT-4o (2024-11-20)',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 2.5,
output: 10,
cacheRead: 1.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o-mini',
name: 'GPT-4o mini',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 0.15,
output: 0.6,
cacheRead: 0.075,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5',
name: 'GPT-5',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-chat-latest',
name: 'GPT-5 Chat Latest',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-codex',
name: 'GPT-5-Codex',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-mini',
name: 'GPT-5 Mini',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.25,
output: 2,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-nano',
name: 'GPT-5 Nano',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.05,
output: 0.4,
cacheRead: 0.005,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-pro',
name: 'GPT-5 Pro',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 15,
output: 120,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1',
name: 'GPT-5.1',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-chat-latest',
name: 'GPT-5.1 Chat',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex',
name: 'GPT-5.1 Codex',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex-max',
name: 'GPT-5.1 Codex Max',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex-mini',
name: 'GPT-5.1 Codex mini',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.25,
output: 2,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2',
name: 'GPT-5.2',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2-chat-latest',
name: 'GPT-5.2 Chat',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2-codex',
name: 'GPT-5.2 Codex',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2-pro',
name: 'GPT-5.2 Pro',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 21,
output: 168,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.3-chat-latest',
name: 'GPT-5.3 Chat (latest)',
config: {
api: 'azure-openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.3-codex',
name: 'GPT-5.3 Codex',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.3-codex-spark',
name: 'GPT-5.3 Codex Spark',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 32000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4',
name: 'GPT-5.4',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4-mini',
name: 'GPT-5.4 mini',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.75,
output: 4.5,
cacheRead: 0.075,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4-nano',
name: 'GPT-5.4 nano',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.2,
output: 1.25,
cacheRead: 0.02,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4-pro',
name: 'GPT-5.4 Pro',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 30,
output: 180,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.5',
name: 'GPT-5.5',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.5-pro',
name: 'GPT-5.5 Pro',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 30,
output: 180,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.6-luna',
name: 'GPT-5.6 Luna',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 1,
output: 6,
cacheRead: 0.1,
cacheWrite: 1.25,
},
},
},
{
modelId: 'gpt-5.6-sol',
name: 'GPT-5.6 Sol',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'gpt-5.6-terra',
name: 'GPT-5.6 Terra',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 3.125,
},
},
},
{
modelId: 'gpt-realtime-2.1',
name: 'GPT-Realtime-2.1',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 32000,
cost: {
input: 4,
output: 24,
cacheRead: 0.4,
cacheWrite: 0,
},
},
},
{
modelId: 'o1',
name: 'o1',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 15,
output: 60,
cacheRead: 7.5,
cacheWrite: 0,
},
},
},
{
modelId: 'o1-pro',
name: 'o1-pro',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 150,
output: 600,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'o3',
name: 'o3',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 2,
output: 8,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'o3-deep-research',
name: 'o3-deep-research',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 10,
output: 40,
cacheRead: 2.5,
cacheWrite: 0,
},
},
},
{
modelId: 'o3-mini',
name: 'o3-mini',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 1.1,
output: 4.4,
cacheRead: 0.55,
cacheWrite: 0,
},
},
},
{
modelId: 'o3-pro',
name: 'o3-pro',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 20,
output: 80,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'o4-mini',
name: 'o4-mini',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 1.1,
output: 4.4,
cacheRead: 0.275,
cacheWrite: 0,
},
},
},
{
modelId: 'o4-mini-deep-research',
name: 'o4-mini-deep-research',
config: {
api: 'azure-openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 2,
output: 8,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,65 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'cerebras'
export const providerConfig = {
name: 'cerebras',
config: {
api: 'openai-completions',
baseUrl: 'https://api.cerebras.ai/v1',
apiKey: 'CEREBRAS_API_KEY',
},
models: [
{
modelId: 'gemma-4-31b',
name: 'Gemma 4 31B IT',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 131072,
maxTokens: 40960,
cost: {
input: 0.99,
output: 1.49,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-oss-120b',
name: 'GPT OSS 120B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 40960,
cost: {
input: 0.35,
output: 0.75,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-glm-4.7',
name: 'Z.AI GLM-4.7',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 40960,
cost: {
input: 2.25,
output: 2.75,
cacheRead: 2.25,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,729 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'cloudflare-ai-gateway'
export const providerConfig = {
name: 'cloudflare-ai-gateway',
config: {
api: 'anthropic-messages',
baseUrl:
'https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic',
apiKey: 'CLOUDFLARE_API_KEY',
},
models: [
{
modelId: 'claude-3-5-haiku',
name: 'Claude Haiku 3.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: false,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 8192,
cost: {
input: 0.8,
output: 4,
cacheRead: 0.08,
cacheWrite: 1,
},
},
},
{
modelId: 'claude-3-haiku',
name: 'Claude Haiku 3',
config: {
api: 'anthropic-messages',
reasoning: false,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 4096,
cost: {
input: 0.25,
output: 1.25,
cacheRead: 0.03,
cacheWrite: 0.3,
},
},
},
{
modelId: 'claude-3-opus',
name: 'Claude Opus 3',
config: {
api: 'anthropic-messages',
reasoning: false,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 4096,
cost: {
input: 15,
output: 75,
cacheRead: 1.5,
cacheWrite: 18.75,
},
},
},
{
modelId: 'claude-3-sonnet',
name: 'Claude Sonnet 3',
config: {
api: 'anthropic-messages',
reasoning: false,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 4096,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 0.3,
},
},
},
{
modelId: 'claude-3.5-haiku',
name: 'Claude Haiku 3.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: false,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 8192,
cost: {
input: 0.8,
output: 4,
cacheRead: 0.08,
cacheWrite: 1,
},
},
},
{
modelId: 'claude-3.5-sonnet',
name: 'Claude Sonnet 3.5 v2',
config: {
api: 'anthropic-messages',
reasoning: false,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 8192,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-fable-5',
name: 'Claude Fable 5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 10,
output: 50,
cacheRead: 1,
cacheWrite: 12.5,
},
},
},
{
modelId: 'claude-haiku-4-5',
name: 'Claude Haiku 4.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 1,
output: 5,
cacheRead: 0.1,
cacheWrite: 1.25,
},
},
},
{
modelId: 'claude-opus-4',
name: 'Claude Opus 4 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 32000,
cost: {
input: 15,
output: 75,
cacheRead: 1.5,
cacheWrite: 18.75,
},
},
},
{
modelId: 'claude-opus-4-1',
name: 'Claude Opus 4.1 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 32000,
cost: {
input: 15,
output: 75,
cacheRead: 1.5,
cacheWrite: 18.75,
},
},
},
{
modelId: 'claude-opus-4-5',
name: 'Claude Opus 4.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-6',
name: 'Claude Opus 4.6 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-7',
name: 'Claude Opus 4.7',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-8',
name: 'Claude Opus 4.8',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-sonnet-4',
name: 'Claude Sonnet 4 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-4-5',
name: 'Claude Sonnet 4.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-4-6',
name: 'Claude Sonnet 4.6',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 64000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-5',
name: 'Claude Sonnet 5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 2,
output: 10,
cacheRead: 0.2,
cacheWrite: 2.5,
},
},
},
{
modelId: 'gpt-4',
name: 'GPT-4',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text'],
contextWindow: 8192,
maxTokens: 8192,
cost: {
input: 30,
output: 60,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4-turbo',
name: 'GPT-4 Turbo',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 4096,
cost: {
input: 10,
output: 30,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o',
name: 'GPT-4o',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 2.5,
output: 10,
cacheRead: 1.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o-mini',
name: 'GPT-4o mini',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 0.15,
output: 0.6,
cacheRead: 0.08,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1',
name: 'GPT-5.1',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.13,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex',
name: 'GPT-5.1 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2',
name: 'GPT-5.2',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2-codex',
name: 'GPT-5.2 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.3-codex',
name: 'GPT-5.3 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4',
name: 'GPT-5.4',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.5',
name: 'GPT-5.5',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.6-luna',
name: 'GPT-5.6 Luna',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 1,
output: 6,
cacheRead: 0.1,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.6-sol',
name: 'GPT-5.6 Sol',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.6-terra',
name: 'GPT-5.6 Terra',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 0,
},
},
},
{
modelId: 'o1',
name: 'o1',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 15,
output: 60,
cacheRead: 7.5,
cacheWrite: 0,
},
},
},
{
modelId: 'o3',
name: 'o3',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 2,
output: 8,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'o3-mini',
name: 'o3-mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 1.1,
output: 4.4,
cacheRead: 0.55,
cacheWrite: 0,
},
},
},
{
modelId: 'o3-pro',
name: 'o3-pro',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 20,
output: 80,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'o4-mini',
name: 'o4-mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 1.1,
output: 4.4,
cacheRead: 0.28,
cacheWrite: 0,
},
},
},
{
modelId: 'workers-ai/@cf/moonshotai/kimi-k2.5',
name: 'Kimi K2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 256000,
cost: {
input: 0.6,
output: 3,
cacheRead: 0.1,
cacheWrite: 0,
},
},
},
{
modelId: 'workers-ai/@cf/moonshotai/kimi-k2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 256000,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
},
},
},
{
modelId: 'workers-ai/@cf/nvidia/nemotron-3-120b-a12b',
name: 'Nemotron 3 Super 120B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 256000,
maxTokens: 256000,
cost: {
input: 0.5,
output: 1.5,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'workers-ai/@cf/zai-org/glm-4.7-flash',
name: 'GLM-4.7-Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 131072,
cost: {
input: 0.06,
output: 0.4,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'workers-ai/@cf/zai-org/glm-5.2',
name: 'Glm 5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0.26,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,235 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'cloudflare-workers-ai'
export const providerConfig = {
name: 'cloudflare-workers-ai',
config: {
api: 'openai-completions',
baseUrl: 'https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1',
apiKey: 'CLOUDFLARE_API_KEY',
},
models: [
{
modelId: '@cf/google/gemma-4-26b-a4b-it',
name: 'Gemma 4 26B A4B IT',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 16384,
cost: {
input: 0.1,
output: 0.3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/ibm-granite/granite-4.0-h-micro',
name: 'Granite 4.0 H Micro',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 131000,
maxTokens: 131000,
cost: {
input: 0.017,
output: 0.112,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/meta/llama-3.3-70b-instruct-fp8-fast',
name: 'Llama 3.3 70B Instruct fp8 Fast',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 24000,
maxTokens: 24000,
cost: {
input: 0.293,
output: 2.253,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/meta/llama-4-scout-17b-16e-instruct',
name: 'Llama 4 Scout 17B 16E Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text', 'image'],
contextWindow: 131000,
maxTokens: 16384,
cost: {
input: 0.27,
output: 0.85,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/mistralai/mistral-small-3.1-24b-instruct',
name: 'Mistral Small 3.1 24B Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.351,
output: 0.555,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/moonshotai/kimi-k2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 256000,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/moonshotai/kimi-k2.7-code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.19,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/nvidia/nemotron-3-120b-a12b',
name: 'Nemotron 3 Super 120B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 256000,
maxTokens: 256000,
cost: {
input: 0.5,
output: 1.5,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/openai/gpt-oss-120b',
name: 'GPT OSS 120B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 0.35,
output: 0.75,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/openai/gpt-oss-20b',
name: 'GPT OSS 20B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 0.2,
output: 0.3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/qwen/qwen3-30b-a3b-fp8',
name: 'Qwen3 30B A3b fp8',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 32768,
maxTokens: 32768,
cost: {
input: 0.0509,
output: 0.335,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/zai-org/glm-4.7-flash',
name: 'GLM-4.7-Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 131072,
cost: {
input: 0.0605,
output: 0.4,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: '@cf/zai-org/glm-5.2',
name: 'Glm 5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0.26,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,48 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'deepseek'
export const providerConfig = {
name: 'deepseek',
config: {
api: 'openai-completions',
baseUrl: 'https://api.deepseek.com',
apiKey: 'DEEPSEEK_API_KEY',
},
models: [
{
modelId: 'deepseek-v4-flash',
name: 'DeepSeek V4 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0.14,
output: 0.28,
cacheRead: 0.0028,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v4-pro',
name: 'DeepSeek V4 Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0.435,
output: 0.87,
cacheRead: 0.003625,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,286 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'fireworks'
export const providerConfig = {
name: 'fireworks',
config: {
api: 'anthropic-messages',
baseUrl: 'https://api.fireworks.ai/inference',
apiKey: 'FIREWORKS_API_KEY',
},
models: [
{
modelId: 'accounts/fireworks/models/deepseek-v4-flash',
name: 'DeepSeek V4 Flash',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0.14,
output: 0.28,
cacheRead: 0.028,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/deepseek-v4-pro',
name: 'DeepSeek V4 Pro',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 1.74,
output: 3.48,
cacheRead: 0.145,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/glm-5p1',
name: 'GLM 5.1',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 202800,
maxTokens: 131072,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0.26,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/glm-5p2',
name: 'GLM 5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048575,
maxTokens: 131072,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0.14,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/gpt-oss-120b',
name: 'GPT OSS 120B',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 32768,
cost: {
input: 0.15,
output: 0.6,
cacheRead: 0.015,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/gpt-oss-20b',
name: 'GPT OSS 20B',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 32768,
cost: {
input: 0.07,
output: 0.3,
cacheRead: 0.035,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/kimi-k2p6',
name: 'Kimi K2.6',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262000,
maxTokens: 262000,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/kimi-k2p7-code',
name: 'Kimi K2.7 Code',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262000,
maxTokens: 262000,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.19,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/minimax-m2p7',
name: 'MiniMax-M2.7',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 196608,
maxTokens: 196608,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/minimax-m3',
name: 'MiniMax-M3',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 512000,
maxTokens: 512000,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/models/qwen3p7-plus',
name: 'Qwen 3.7 Plus',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.4,
output: 1.6,
cacheRead: 0.08,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/routers/glm-5p1-fast',
name: 'GLM 5.1 Fast',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 202800,
maxTokens: 131072,
cost: {
input: 2.8,
output: 8.8,
cacheRead: 0.52,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/routers/glm-5p2-fast',
name: 'GLM 5.2 Fast',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048575,
maxTokens: 131072,
cost: {
input: 2.1,
output: 6.6,
cacheRead: 0.21,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/routers/kimi-k2p6-fast',
name: 'Kimi K2.6 Fast',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262000,
maxTokens: 262000,
cost: {
input: 2,
output: 8,
cacheRead: 0.3,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/routers/kimi-k2p6-turbo',
name: 'Kimi K2.6 Turbo',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262000,
maxTokens: 262000,
cost: {
input: 2,
output: 8,
cacheRead: 0.3,
cacheWrite: 0,
},
},
},
{
modelId: 'accounts/fireworks/routers/kimi-k2p7-code-fast',
name: 'Kimi K2.7 Code Fast',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262000,
maxTokens: 262000,
cost: {
input: 1.9,
output: 8,
cacheRead: 0.38,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,544 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'github-copilot'
export const providerConfig = {
name: 'github-copilot',
config: {
api: 'openai-completions',
baseUrl: 'https://api.individual.githubcopilot.com',
apiKey: 'COPILOT_GITHUB_TOKEN',
},
models: [
{
modelId: 'claude-fable-5',
name: 'Claude Fable 5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 10,
output: 50,
cacheRead: 1,
cacheWrite: 12.5,
},
},
},
{
modelId: 'claude-haiku-4.5',
name: 'Claude Haiku 4.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 1,
output: 5,
cacheRead: 0.1,
cacheWrite: 1.25,
},
},
},
{
modelId: 'claude-opus-4.5',
name: 'Claude Opus 4.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 32000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4.6',
name: 'Claude Opus 4.6',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 32000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4.7',
name: 'Claude Opus 4.7',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 32000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4.8',
name: 'Claude Opus 4.8',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 64000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-sonnet-4',
name: 'Claude Sonnet 4 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 216000,
maxTokens: 16000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-4.5',
name: 'Claude Sonnet 4.5 (latest)',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 32000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-4.6',
name: 'Claude Sonnet 4.6',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 32000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-5',
name: 'Claude Sonnet 5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 2,
output: 10,
cacheRead: 0.2,
cacheWrite: 2.5,
},
},
},
{
modelId: 'gemini-2.5-pro',
name: 'Gemini 2.5 Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 64000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3-flash-preview',
name: 'Gemini 3 Flash Preview',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 64000,
cost: {
input: 0.5,
output: 3,
cacheRead: 0.05,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.1-pro-preview',
name: 'Gemini 3.1 Pro Preview',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 64000,
cost: {
input: 2,
output: 12,
cacheRead: 0.2,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 200000,
input: 4,
output: 18,
cacheRead: 0.4,
cacheWrite: 0,
},
],
},
},
},
{
modelId: 'gemini-3.5-flash',
name: 'Gemini 3.5 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 1.5,
output: 9,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4.1',
name: 'GPT-4.1',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 2,
output: 8,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-mini',
name: 'GPT-5 Mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 264000,
maxTokens: 64000,
cost: {
input: 0.25,
output: 2,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2',
name: 'GPT-5.2',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2-codex',
name: 'GPT-5.2 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.3-codex',
name: 'GPT-5.3 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4',
name: 'GPT-5.4',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 272000,
input: 5,
output: 22.5,
cacheRead: 0.5,
cacheWrite: 0,
},
],
},
},
},
{
modelId: 'gpt-5.4-mini',
name: 'GPT-5.4 mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.75,
output: 4.5,
cacheRead: 0.075,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4-nano',
name: 'GPT-5.4 nano',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.2,
output: 1.25,
cacheRead: 0.02,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.5',
name: 'GPT-5.5',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 272000,
input: 10,
output: 45,
cacheRead: 1,
cacheWrite: 0,
},
],
},
},
},
{
modelId: 'gpt-5.6-luna',
name: 'GPT-5.6 Luna',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 1,
output: 6,
cacheRead: 0.1,
cacheWrite: 1.25,
tiers: [
{
inputTokensAbove: 200000,
input: 2,
output: 9,
cacheRead: 0.2,
cacheWrite: 2.5,
},
],
},
},
},
{
modelId: 'gpt-5.6-sol',
name: 'GPT-5.6 Sol',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 6.25,
tiers: [
{
inputTokensAbove: 272000,
input: 10,
output: 45,
cacheRead: 1,
cacheWrite: 12.5,
},
],
},
},
},
{
modelId: 'gpt-5.6-terra',
name: 'GPT-5.6 Terra',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 3.125,
tiers: [
{
inputTokensAbove: 272000,
input: 5,
output: 22.5,
cacheRead: 0.5,
cacheWrite: 6.25,
},
],
},
},
},
{
modelId: 'kimi-k2.7-code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 32000,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.19,
cacheWrite: 0,
},
},
},
{
modelId: 'mai-code-1-flash-picker',
name: 'MAI-Code-1-Flash',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text'],
contextWindow: 256000,
maxTokens: 128000,
cost: {
input: 0.75,
output: 4.5,
cacheRead: 0.075,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,184 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'google-vertex'
export const providerConfig = {
name: 'google-vertex',
config: {
api: 'google-vertex',
baseUrl: 'https://{location}-aiplatform.googleapis.com',
apiKey: 'GOOGLE_CLOUD_API_KEY',
},
models: [
{
modelId: 'gemini-2.5-flash',
name: 'Gemini 2.5 Flash',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.3,
output: 2.5,
cacheRead: 0.03,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-2.5-flash-lite',
name: 'Gemini 2.5 Flash-Lite',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.1,
output: 0.4,
cacheRead: 0.01,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-2.5-pro',
name: 'Gemini 2.5 Pro',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3-flash-preview',
name: 'Gemini 3 Flash Preview',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.5,
output: 3,
cacheRead: 0.05,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.1-flash-lite',
name: 'Gemini 3.1 Flash Lite',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.25,
output: 1.5,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.1-pro-preview',
name: 'Gemini 3.1 Pro Preview',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 2,
output: 12,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.1-pro-preview-customtools',
name: 'Gemini 3.1 Pro Preview Custom Tools',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 2,
output: 12,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.5-flash',
name: 'Gemini 3.5 Flash',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 1.5,
output: 9,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-flash-latest',
name: 'Gemini Flash Latest',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 1.5,
output: 9,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-flash-lite-latest',
name: 'Gemini Flash-Lite Latest',
config: {
api: 'google-vertex',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.25,
output: 1.5,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,320 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'google'
export const providerConfig = {
name: 'google',
config: {
api: 'google-generative-ai',
baseUrl: 'https://generativelanguage.googleapis.com/v1beta',
apiKey: 'GEMINI_API_KEY',
},
models: [
{
modelId: 'gemini-2.0-flash',
name: 'Gemini 2.0 Flash',
config: {
api: 'google-generative-ai',
reasoning: false,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 8192,
cost: {
input: 0.1,
output: 0.4,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-2.0-flash-lite',
name: 'Gemini 2.0 Flash-Lite',
config: {
api: 'google-generative-ai',
reasoning: false,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 8192,
cost: {
input: 0.075,
output: 0.3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-2.5-flash',
name: 'Gemini 2.5 Flash',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.3,
output: 2.5,
cacheRead: 0.03,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-2.5-flash-lite',
name: 'Gemini 2.5 Flash-Lite',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.1,
output: 0.4,
cacheRead: 0.01,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-2.5-pro',
name: 'Gemini 2.5 Pro',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3-flash-preview',
name: 'Gemini 3 Flash Preview',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.5,
output: 3,
cacheRead: 0.05,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3-pro-preview',
name: 'Gemini 3 Pro Preview',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 2,
output: 12,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.1-flash-lite',
name: 'Gemini 3.1 Flash Lite',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.25,
output: 1.5,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.1-flash-lite-preview',
name: 'Gemini 3.1 Flash Lite Preview',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.25,
output: 1.5,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.1-pro-preview',
name: 'Gemini 3.1 Pro Preview',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 2,
output: 12,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.1-pro-preview-customtools',
name: 'Gemini 3.1 Pro Preview Custom Tools',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 2,
output: 12,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.5-flash',
name: 'Gemini 3.5 Flash',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 1.5,
output: 9,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.5-flash-lite',
name: 'Gemini 3.5 Flash Lite',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.3,
output: 2.5,
cacheRead: 0.03,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.6-flash',
name: 'Gemini 3.6 Flash',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 1.5,
output: 7.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-flash-latest',
name: 'Gemini Flash Latest',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 1.5,
output: 9,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-flash-lite-latest',
name: 'Gemini Flash-Lite Latest',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.25,
output: 1.5,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gemma-4-26b-a4b-it',
name: 'Gemma 4 26B A4B IT',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 32768,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gemma-4-31b-it',
name: 'Gemma 4 31B IT',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 32768,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,133 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'groq'
export const providerConfig = {
name: 'groq',
config: {
api: 'openai-completions',
baseUrl: 'https://api.groq.com/openai/v1',
apiKey: 'GROQ_API_KEY',
},
models: [
{
modelId: 'llama-3.1-8b-instant',
name: 'Llama 3.1 8B',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 131072,
maxTokens: 131072,
cost: {
input: 0.05,
output: 0.08,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'llama-3.3-70b-versatile',
name: 'Llama 3.3 70B',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 131072,
maxTokens: 32768,
cost: {
input: 0.59,
output: 0.79,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'meta-llama/llama-4-scout-17b-16e-instruct',
name: 'Llama 4 Scout 17B 16E',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text', 'image'],
contextWindow: 131072,
maxTokens: 8192,
cost: {
input: 0.11,
output: 0.34,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'openai/gpt-oss-120b',
name: 'GPT OSS 120B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 65536,
cost: {
input: 0.15,
output: 0.6,
cacheRead: 0.075,
cacheWrite: 0,
},
},
},
{
modelId: 'openai/gpt-oss-20b',
name: 'GPT OSS 20B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 65536,
cost: {
input: 0.075,
output: 0.3,
cacheRead: 0.0375,
cacheWrite: 0,
},
},
},
{
modelId: 'openai/gpt-oss-safeguard-20b',
name: 'Safety GPT OSS 20B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 65536,
cost: {
input: 0.075,
output: 0.3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen/qwen3-32b',
name: 'Qwen3-32B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 40960,
cost: {
input: 0.29,
output: 0.59,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,847 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'huggingface'
export const providerConfig = {
name: 'huggingface',
config: {
api: 'openai-completions',
baseUrl: 'https://router.huggingface.co/v1',
apiKey: 'HF_TOKEN',
},
models: [
{
modelId: 'MiniMaxAI/MiniMax-M2',
name: 'MiniMax-M2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 128000,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'MiniMaxAI/MiniMax-M2.1',
name: 'MiniMax-M2.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'MiniMaxAI/MiniMax-M2.5',
name: 'MiniMax-M2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.03,
cacheWrite: 0,
},
},
},
{
modelId: 'MiniMaxAI/MiniMax-M2.7',
name: 'MiniMax-M2.7',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'MiniMaxAI/MiniMax-M3',
name: 'MiniMax-M3',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 524288,
maxTokens: 128000,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3-235B-A22B',
name: 'Qwen3 235B-A22B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 40960,
maxTokens: 16384,
cost: {
input: 0.2,
output: 0.8,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3-235B-A22B-Thinking-2507',
name: 'Qwen3-235B-A22B-Thinking-2507',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 131072,
cost: {
input: 0.3,
output: 3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3-32B',
name: 'Qwen3 32B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 16384,
cost: {
input: 0.29,
output: 0.59,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3-Coder-30B-A3B-Instruct',
name: 'Qwen3-Coder 30B-A3B Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.07,
output: 0.26,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3-Coder-480B-A35B-Instruct',
name: 'Qwen3-Coder-480B-A35B-Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 66536,
cost: {
input: 2,
output: 2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3-Coder-Next',
name: 'Qwen3-Coder-Next',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.2,
output: 1.5,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3-Next-80B-A3B-Instruct',
name: 'Qwen3-Next-80B-A3B-Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 66536,
cost: {
input: 0.25,
output: 1,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3-Next-80B-A3B-Thinking',
name: 'Qwen3-Next-80B-A3B-Thinking',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 131072,
cost: {
input: 0.3,
output: 2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.5-122B-A10B',
name: 'Qwen3.5 122B-A10B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.4,
output: 3.2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.5-27B',
name: 'Qwen3.5 27B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.3,
output: 2.4,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.5-35B-A3B',
name: 'Qwen3.5 35B-A3B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.25,
output: 2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.5-397B-A17B',
name: 'Qwen3.5-397B-A17B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 32768,
cost: {
input: 0.6,
output: 3.6,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.5-9B',
name: 'Qwen3.5 9B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.17,
output: 0.25,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.6-27B',
name: 'Qwen3.6 27B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.47,
output: 3.19,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.6-35B-A3B',
name: 'Qwen3.6 35B-A3B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.15,
output: 0.95,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'XiaomiMiMo/MiMo-V2-Flash',
name: 'MiMo-V2-Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 4096,
cost: {
input: 0.1,
output: 0.3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'XiaomiMiMo/MiMo-V2.5-Pro',
name: 'MiMo-V2.5-Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 1,
output: 3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-ai/DeepSeek-R1',
name: 'DeepSeek-R1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 64000,
maxTokens: 32768,
cost: {
input: 0.7,
output: 2.5,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-ai/DeepSeek-R1-0528',
name: 'DeepSeek-R1-0528',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 163840,
maxTokens: 163840,
cost: {
input: 3,
output: 5,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-ai/DeepSeek-V3.2',
name: 'DeepSeek-V3.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 163840,
maxTokens: 65536,
cost: {
input: 0.28,
output: 0.4,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-ai/DeepSeek-V4-Flash',
name: 'DeepSeek V4 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 384000,
cost: {
input: 0.14,
output: 0.28,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-ai/DeepSeek-V4-Pro',
name: 'DeepSeek V4 Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 393216,
cost: {
input: 0.435,
output: 0.87,
cacheRead: 0.003625,
cacheWrite: 0,
},
},
},
{
modelId: 'google/gemma-4-26B-A4B-it',
name: 'Gemma 4 26B A4B IT',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 32768,
cost: {
input: 0.13,
output: 0.4,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'google/gemma-4-31B-it',
name: 'Gemma 4 31B IT',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 32768,
cost: {
input: 0.14,
output: 0.4,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'meta-llama/Llama-3.3-70B-Instruct',
name: 'Llama-3.3-70B-Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 131072,
maxTokens: 4096,
cost: {
input: 0.59,
output: 0.79,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'moonshotai/Kimi-K2-Instruct',
name: 'Kimi-K2-Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 131072,
maxTokens: 16384,
cost: {
input: 1,
output: 3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'moonshotai/Kimi-K2-Instruct-0905',
name: 'Kimi-K2-Instruct-0905',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 16384,
cost: {
input: 1,
output: 3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'moonshotai/Kimi-K2-Thinking',
name: 'Kimi-K2-Thinking',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.6,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'moonshotai/Kimi-K2.5',
name: 'Kimi-K2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.6,
output: 3,
cacheRead: 0.1,
cacheWrite: 0,
},
},
},
{
modelId: 'moonshotai/Kimi-K2.6',
name: 'Kimi-K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
},
},
},
{
modelId: 'moonshotai/Kimi-K2.7-Code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.95,
output: 4,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'openai/gpt-oss-120b',
name: 'GPT OSS 120B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 32768,
cost: {
input: 0.25,
output: 0.69,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'openai/gpt-oss-20b',
name: 'GPT OSS 20B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 32768,
cost: {
input: 0.1,
output: 0.5,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'stepfun-ai/Step-3.5-Flash',
name: 'Step 3.5 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 256000,
cost: {
input: 0.1,
output: 0.3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'stepfun-ai/Step-3.7-Flash',
name: 'Step 3.7 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 256000,
cost: {
input: 0.2,
output: 1.15,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-4.5',
name: 'GLM-4.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 98304,
cost: {
input: 0.6,
output: 2.2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-4.5-Air',
name: 'GLM-4.5-Air',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 98304,
cost: {
input: 0.13,
output: 0.85,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-4.5V',
name: 'GLM-4.5V',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 65536,
maxTokens: 16384,
cost: {
input: 0.6,
output: 1.8,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-4.6',
name: 'GLM-4.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.55,
output: 2.2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-4.7',
name: 'GLM-4.7',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.6,
output: 2.2,
cacheRead: 0.11,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-4.7-Flash',
name: 'GLM-4.7-Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 128000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-5',
name: 'GLM-5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 202752,
maxTokens: 131072,
cost: {
input: 1,
output: 3.2,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-5.1',
name: 'GLM-5.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 202752,
maxTokens: 131072,
cost: {
input: 1,
output: 3.2,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-5.2',
name: 'GLM-5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 131072,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,65 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'kimi-coding'
export const providerConfig = {
name: 'kimi-coding',
config: {
api: 'anthropic-messages',
baseUrl: 'https://api.kimi.com/coding',
apiKey: 'KIMI_API_KEY',
},
models: [
{
modelId: 'k3',
name: 'Kimi K3',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-for-coding',
name: 'Kimi K2.7 Code',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 32768,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.19,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-for-coding-highspeed',
name: 'Kimi For Coding HighSpeed',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 32768,
cost: {
input: 1.9,
output: 8,
cacheRead: 0.38,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,65 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'minimax-cn'
export const providerConfig = {
name: 'minimax-cn',
config: {
api: 'anthropic-messages',
baseUrl: 'https://api.minimaxi.com/anthropic',
apiKey: 'MINIMAX_CN_API_KEY',
},
models: [
{
modelId: 'MiniMax-M2.7',
name: 'MiniMax-M2.7',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0.375,
},
},
},
{
modelId: 'MiniMax-M2.7-highspeed',
name: 'MiniMax-M2.7-highspeed',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.6,
output: 2.4,
cacheRead: 0.06,
cacheWrite: 0.375,
},
},
},
{
modelId: 'MiniMax-M3',
name: 'MiniMax-M3',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,65 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'minimax'
export const providerConfig = {
name: 'minimax',
config: {
api: 'anthropic-messages',
baseUrl: 'https://api.minimax.io/anthropic',
apiKey: 'MINIMAX_API_KEY',
},
models: [
{
modelId: 'MiniMax-M2.7',
name: 'MiniMax-M2.7',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0.375,
},
},
},
{
modelId: 'MiniMax-M2.7-highspeed',
name: 'MiniMax-M2.7-highspeed',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.6,
output: 2.4,
cacheRead: 0.06,
cacheWrite: 0.375,
},
},
},
{
modelId: 'MiniMax-M3',
name: 'MiniMax-M3',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,524 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'mistral'
export const providerConfig = {
name: 'mistral',
config: {
api: 'mistral-conversations',
baseUrl: 'https://api.mistral.ai',
apiKey: 'MISTRAL_API_KEY',
},
models: [
{
modelId: 'codestral-latest',
name: 'Codestral (latest)',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 256000,
maxTokens: 4096,
cost: {
input: 0.3,
output: 0.9,
cacheRead: 0.03,
cacheWrite: 0,
},
},
},
{
modelId: 'devstral-2512',
name: 'Devstral 2',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.4,
output: 2,
cacheRead: 0.04,
cacheWrite: 0,
},
},
},
{
modelId: 'devstral-latest',
name: 'Devstral 2',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.4,
output: 2,
cacheRead: 0.04,
cacheWrite: 0,
},
},
},
{
modelId: 'devstral-medium-2507',
name: 'Devstral Medium',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.4,
output: 2,
cacheRead: 0.04,
cacheWrite: 0,
},
},
},
{
modelId: 'devstral-medium-latest',
name: 'Devstral 2 (latest)',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.4,
output: 2,
cacheRead: 0.04,
cacheWrite: 0,
},
},
},
{
modelId: 'devstral-small-2505',
name: 'Devstral Small 2505',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.1,
output: 0.3,
cacheRead: 0.01,
cacheWrite: 0,
},
},
},
{
modelId: 'devstral-small-2507',
name: 'Devstral Small',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.1,
output: 0.3,
cacheRead: 0.01,
cacheWrite: 0,
},
},
},
{
modelId: 'labs-devstral-small-2512',
name: 'Devstral Small 2',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 256000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'magistral-medium-latest',
name: 'Magistral Medium (latest)',
config: {
api: 'mistral-conversations',
reasoning: true,
input: ['text'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 2,
output: 5,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'magistral-small',
name: 'Magistral Small',
config: {
api: 'mistral-conversations',
reasoning: true,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.5,
output: 1.5,
cacheRead: 0.05,
cacheWrite: 0,
},
},
},
{
modelId: 'ministral-3b-latest',
name: 'Ministral 3B (latest)',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.04,
output: 0.04,
cacheRead: 0.004,
cacheWrite: 0,
},
},
},
{
modelId: 'ministral-8b-latest',
name: 'Ministral 8B (latest)',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.1,
output: 0.1,
cacheRead: 0.01,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-large-2411',
name: 'Mistral Large 2.1',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 131072,
maxTokens: 16384,
cost: {
input: 2,
output: 6,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-large-2512',
name: 'Mistral Large 3',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.5,
output: 1.5,
cacheRead: 0.05,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-large-latest',
name: 'Mistral Large (latest)',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.5,
output: 1.5,
cacheRead: 0.05,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-medium-2505',
name: 'Mistral Medium 3',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text', 'image'],
contextWindow: 131072,
maxTokens: 131072,
cost: {
input: 0.4,
output: 2,
cacheRead: 0.04,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-medium-2508',
name: 'Mistral Medium 3.1',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.4,
output: 2,
cacheRead: 0.04,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-medium-2604',
name: 'Mistral Medium 3.5',
config: {
api: 'mistral-conversations',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 1.5,
output: 7.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-medium-3.5',
name: 'Mistral Medium 3.5',
config: {
api: 'mistral-conversations',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 1.5,
output: 7.5,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-medium-latest',
name: 'Mistral Medium (latest)',
config: {
api: 'mistral-conversations',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 1.5,
output: 7.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-nemo',
name: 'Mistral Nemo',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.15,
output: 0.15,
cacheRead: 0.015,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-small-2506',
name: 'Mistral Small 3.2',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 0.1,
output: 0.3,
cacheRead: 0.01,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-small-2603',
name: 'Mistral Small 4',
config: {
api: 'mistral-conversations',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 256000,
cost: {
input: 0.15,
output: 0.6,
cacheRead: 0.015,
cacheWrite: 0,
},
},
},
{
modelId: 'mistral-small-latest',
name: 'Mistral Small (latest)',
config: {
api: 'mistral-conversations',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 256000,
cost: {
input: 0.15,
output: 0.6,
cacheRead: 0.015,
cacheWrite: 0,
},
},
},
{
modelId: 'open-mistral-7b',
name: 'Mistral 7B',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 8000,
maxTokens: 8000,
cost: {
input: 0.25,
output: 0.25,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'open-mistral-nemo',
name: 'Open Mistral Nemo',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.15,
output: 0.15,
cacheRead: 0.015,
cacheWrite: 0,
},
},
},
{
modelId: 'open-mixtral-8x22b',
name: 'Mixtral 8x22B',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 64000,
maxTokens: 64000,
cost: {
input: 2,
output: 6,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'open-mixtral-8x7b',
name: 'Mixtral 8x7B',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text'],
contextWindow: 32000,
maxTokens: 32000,
cost: {
input: 0.7,
output: 0.7,
cacheRead: 0.07,
cacheWrite: 0,
},
},
},
{
modelId: 'pixtral-12b',
name: 'Pixtral 12B',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 0.15,
output: 0.15,
cacheRead: 0.015,
cacheWrite: 0,
},
},
},
{
modelId: 'pixtral-large-latest',
name: 'Pixtral Large (latest)',
config: {
api: 'mistral-conversations',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 2,
output: 6,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,184 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'moonshotai-cn'
export const providerConfig = {
name: 'moonshotai-cn',
config: {
api: 'openai-completions',
baseUrl: 'https://api.moonshot.cn/v1',
apiKey: 'MOONSHOT_API_KEY',
},
models: [
{
modelId: 'kimi-k2-0711-preview',
name: 'Kimi K2 0711',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 131072,
maxTokens: 16384,
cost: {
input: 0.6,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2-0905-preview',
name: 'Kimi K2 0905',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.6,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2-thinking',
name: 'Kimi K2 Thinking',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.6,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2-thinking-turbo',
name: 'Kimi K2 Thinking Turbo',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 1.15,
output: 8,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2-turbo-preview',
name: 'Kimi K2 Turbo',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 2.4,
output: 10,
cacheRead: 0.6,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.5',
name: 'Kimi K2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.6,
output: 3,
cacheRead: 0.1,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.7-code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.19,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.7-code-highspeed',
name: 'Kimi K2.7 Code HighSpeed',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 1.9,
output: 8,
cacheRead: 0.38,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k3',
name: 'Kimi K3',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,184 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'moonshotai'
export const providerConfig = {
name: 'moonshotai',
config: {
api: 'openai-completions',
baseUrl: 'https://api.moonshot.ai/v1',
apiKey: 'MOONSHOT_API_KEY',
},
models: [
{
modelId: 'kimi-k2-0711-preview',
name: 'Kimi K2 0711',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 131072,
maxTokens: 16384,
cost: {
input: 0.6,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2-0905-preview',
name: 'Kimi K2 0905',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.6,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2-thinking',
name: 'Kimi K2 Thinking',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.6,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2-thinking-turbo',
name: 'Kimi K2 Thinking Turbo',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 1.15,
output: 8,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2-turbo-preview',
name: 'Kimi K2 Turbo',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 2.4,
output: 10,
cacheRead: 0.6,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.5',
name: 'Kimi K2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.6,
output: 3,
cacheRead: 0.1,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.7-code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.19,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.7-code-highspeed',
name: 'Kimi K2.7 Code HighSpeed',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 1.9,
output: 8,
cacheRead: 0.38,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k3',
name: 'Kimi K3',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,337 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'nvidia'
export const providerConfig = {
name: 'nvidia',
config: {
api: 'openai-completions',
baseUrl: 'https://integrate.api.nvidia.com/v1',
apiKey: '',
},
models: [
{
modelId: 'meta/llama-3.1-70b-instruct',
name: 'Llama 3.1 70b Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 4096,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'meta/llama-3.1-8b-instruct',
name: 'Llama 3.1 8B Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 16000,
maxTokens: 4096,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'meta/llama-3.2-11b-vision-instruct',
name: 'Llama 3.2 11b Vision Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 4096,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'meta/llama-3.2-90b-vision-instruct',
name: 'Llama-3.2-90B-Vision-Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 8192,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'meta/llama-3.3-70b-instruct',
name: 'Llama 3.3 70b Instruct',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 128000,
maxTokens: 4096,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'minimaxai/minimax-m3',
name: 'MiniMax-M3',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 16384,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mistralai/mistral-large-3-675b-instruct-2512',
name: 'Mistral Large 3 675B Instruct 2512',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mistralai/mistral-small-4-119b-2603',
name: 'mistral-small-4-119b-2603',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 8192,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'moonshotai/kimi-k2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'nvidia/nemotron-3-nano-30b-a3b',
name: 'nemotron-3-nano-30b-a3b',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'nvidia/nemotron-3-nano-omni-30b-a3b-reasoning',
name: 'Nemotron 3 Nano Omni',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 65536,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'nvidia/nemotron-3-super-120b-a12b',
name: 'Nemotron 3 Super',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.2,
output: 0.8,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'nvidia/nemotron-3-ultra-550b-a55b',
name: 'Nemotron 3 Ultra 550B A55B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 0.5,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'nvidia/nvidia-nemotron-nano-9b-v2',
name: 'nvidia-nemotron-nano-9b-v2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'openai/gpt-oss-120b',
name: 'GPT-OSS-120B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 128000,
maxTokens: 8192,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'openai/gpt-oss-20b',
name: 'GPT OSS 20B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 32768,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'stepfun-ai/step-3.5-flash',
name: 'Step 3.5 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 256000,
maxTokens: 16384,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'stepfun-ai/step-3.7-flash',
name: 'Step 3.7 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 16384,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'z-ai/glm-5.2',
name: 'GLM-5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,178 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'openai-codex'
export const providerConfig = {
name: 'openai-codex',
config: {
api: 'openai-codex-responses',
baseUrl: 'https://chatgpt.com/backend-api',
apiKey: '',
},
models: [
{
modelId: 'gpt-5.3-codex-spark',
name: 'GPT-5.3 Codex Spark',
config: {
api: 'openai-codex-responses',
reasoning: true,
input: ['text'],
contextWindow: 128000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4',
name: 'GPT-5.4',
config: {
api: 'openai-codex-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 272000,
input: 5,
output: 22.5,
cacheRead: 0.5,
cacheWrite: 0,
},
],
},
},
},
{
modelId: 'gpt-5.4-mini',
name: 'GPT-5.4 mini',
config: {
api: 'openai-codex-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 0.75,
output: 4.5,
cacheRead: 0.075,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.5',
name: 'GPT-5.5',
config: {
api: 'openai-codex-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 272000,
input: 10,
output: 45,
cacheRead: 1,
cacheWrite: 0,
},
],
},
},
},
{
modelId: 'gpt-5.6-luna',
name: 'GPT-5.6 Luna',
config: {
api: 'openai-codex-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 1,
output: 6,
cacheRead: 0.1,
cacheWrite: 1.25,
tiers: [
{
inputTokensAbove: 272000,
input: 2,
output: 9,
cacheRead: 0.2,
cacheWrite: 2.5,
},
],
},
},
},
{
modelId: 'gpt-5.6-sol',
name: 'GPT-5.6 Sol',
config: {
api: 'openai-codex-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 6.25,
tiers: [
{
inputTokensAbove: 272000,
input: 10,
output: 45,
cacheRead: 1,
cacheWrite: 12.5,
},
],
},
},
},
{
modelId: 'gpt-5.6-terra',
name: 'GPT-5.6 Terra',
config: {
api: 'openai-codex-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 3.125,
tiers: [
{
inputTokensAbove: 272000,
input: 5,
output: 22.5,
cacheRead: 0.5,
cacheWrite: 6.25,
},
],
},
},
},
],
} as const
@@ -0,0 +1,859 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'openai'
export const providerConfig = {
name: 'openai',
config: {
api: 'openai-responses',
baseUrl: 'https://api.openai.com/v1',
apiKey: 'OPENAI_API_KEY',
},
models: [
{
modelId: 'gpt-4',
name: 'GPT-4',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text'],
contextWindow: 8192,
maxTokens: 8192,
cost: {
input: 30,
output: 60,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4-turbo',
name: 'GPT-4 Turbo',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 4096,
cost: {
input: 10,
output: 30,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4.1',
name: 'GPT-4.1',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 1047576,
maxTokens: 32768,
cost: {
input: 2,
output: 8,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4.1-mini',
name: 'GPT-4.1 mini',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 1047576,
maxTokens: 32768,
cost: {
input: 0.4,
output: 1.6,
cacheRead: 0.1,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4.1-nano',
name: 'GPT-4.1 nano',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 1047576,
maxTokens: 32768,
cost: {
input: 0.1,
output: 0.4,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o',
name: 'GPT-4o',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 2.5,
output: 10,
cacheRead: 1.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o-2024-05-13',
name: 'GPT-4o (2024-05-13)',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 4096,
cost: {
input: 5,
output: 15,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o-2024-08-06',
name: 'GPT-4o (2024-08-06)',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 2.5,
output: 10,
cacheRead: 1.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o-2024-11-20',
name: 'GPT-4o (2024-11-20)',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 2.5,
output: 10,
cacheRead: 1.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-4o-mini',
name: 'GPT-4o mini',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 0.15,
output: 0.6,
cacheRead: 0.075,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5',
name: 'GPT-5',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-chat-latest',
name: 'GPT-5 Chat Latest',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-codex',
name: 'GPT-5-Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-mini',
name: 'GPT-5 Mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.25,
output: 2,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-nano',
name: 'GPT-5 Nano',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.05,
output: 0.4,
cacheRead: 0.005,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-pro',
name: 'GPT-5 Pro',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 15,
output: 120,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1',
name: 'GPT-5.1',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-chat-latest',
name: 'GPT-5.1 Chat',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex',
name: 'GPT-5.1 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex-max',
name: 'GPT-5.1 Codex Max',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex-mini',
name: 'GPT-5.1 Codex mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.25,
output: 2,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2',
name: 'GPT-5.2',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2-chat-latest',
name: 'GPT-5.2 Chat',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2-codex',
name: 'GPT-5.2 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2-pro',
name: 'GPT-5.2 Pro',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 21,
output: 168,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.3-chat-latest',
name: 'GPT-5.3 Chat (latest)',
config: {
api: 'openai-responses',
reasoning: false,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 16384,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.3-codex',
name: 'GPT-5.3 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.3-codex-spark',
name: 'GPT-5.3 Codex Spark',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 32000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4',
name: 'GPT-5.4',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 272000,
input: 5,
output: 22.5,
cacheRead: 0.5,
cacheWrite: 0,
},
],
},
},
},
{
modelId: 'gpt-5.4-mini',
name: 'GPT-5.4 mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.75,
output: 4.5,
cacheRead: 0.075,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4-nano',
name: 'GPT-5.4 nano',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.2,
output: 1.25,
cacheRead: 0.02,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4-pro',
name: 'GPT-5.4 Pro',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 30,
output: 180,
cacheRead: 0,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 272000,
input: 60,
output: 270,
cacheRead: 0,
cacheWrite: 0,
},
],
},
},
},
{
modelId: 'gpt-5.5',
name: 'GPT-5.5',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 272000,
input: 10,
output: 45,
cacheRead: 1,
cacheWrite: 0,
},
],
},
},
},
{
modelId: 'gpt-5.5-pro',
name: 'GPT-5.5 Pro',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 30,
output: 180,
cacheRead: 0,
cacheWrite: 0,
tiers: [
{
inputTokensAbove: 272000,
input: 60,
output: 270,
cacheRead: 0,
cacheWrite: 0,
},
],
},
},
},
{
modelId: 'gpt-5.6-luna',
name: 'GPT-5.6 Luna',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 1,
output: 6,
cacheRead: 0.1,
cacheWrite: 1.25,
tiers: [
{
inputTokensAbove: 272000,
input: 2,
output: 9,
cacheRead: 0.2,
cacheWrite: 2.5,
},
],
},
},
},
{
modelId: 'gpt-5.6-sol',
name: 'GPT-5.6 Sol',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 6.25,
tiers: [
{
inputTokensAbove: 272000,
input: 10,
output: 45,
cacheRead: 1,
cacheWrite: 12.5,
},
],
},
},
},
{
modelId: 'gpt-5.6-terra',
name: 'GPT-5.6 Terra',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 3.125,
tiers: [
{
inputTokensAbove: 272000,
input: 5,
output: 22.5,
cacheRead: 0.5,
cacheWrite: 6.25,
},
],
},
},
},
{
modelId: 'gpt-realtime-2.1',
name: 'GPT-Realtime-2.1',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 128000,
maxTokens: 32000,
cost: {
input: 4,
output: 24,
cacheRead: 0.4,
cacheWrite: 0,
},
},
},
{
modelId: 'o1',
name: 'o1',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 15,
output: 60,
cacheRead: 7.5,
cacheWrite: 0,
},
},
},
{
modelId: 'o1-pro',
name: 'o1-pro',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 150,
output: 600,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'o3',
name: 'o3',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 2,
output: 8,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'o3-deep-research',
name: 'o3-deep-research',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 10,
output: 40,
cacheRead: 2.5,
cacheWrite: 0,
},
},
},
{
modelId: 'o3-mini',
name: 'o3-mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 1.1,
output: 4.4,
cacheRead: 0.55,
cacheWrite: 0,
},
},
},
{
modelId: 'o3-pro',
name: 'o3-pro',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 20,
output: 80,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'o4-mini',
name: 'o4-mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 1.1,
output: 4.4,
cacheRead: 0.275,
cacheWrite: 0,
},
},
},
{
modelId: 'o4-mini-deep-research',
name: 'o4-mini-deep-research',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 100000,
cost: {
input: 2,
output: 8,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,269 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'opencode-go'
export const providerConfig = {
name: 'opencode-go',
config: {
api: 'openai-completions',
baseUrl: 'https://opencode.ai/zen/go/v1',
apiKey: 'OPENCODE_API_KEY',
},
models: [
{
modelId: 'deepseek-v4-flash',
name: 'DeepSeek V4 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0.14,
output: 0.28,
cacheRead: 0.0028,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v4-pro',
name: 'DeepSeek V4 Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0.435,
output: 0.87,
cacheRead: 0.003625,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.1',
name: 'GLM-5.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 202752,
maxTokens: 32768,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0.26,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.2',
name: 'GLM-5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0.26,
cacheWrite: 0,
},
},
},
{
modelId: 'grok-4.5',
name: 'Grok 4.5',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 500000,
maxTokens: 500000,
cost: {
input: 2,
output: 6,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.7-code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.19,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k3',
name: 'Kimi K3 (2x usage)',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5',
name: 'MiMo V2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 0.14,
output: 0.28,
cacheRead: 0.0028,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5-pro',
name: 'MiMo V2.5 Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 128000,
cost: {
input: 0.435,
output: 0.87,
cacheRead: 0.003625,
cacheWrite: 0,
},
},
},
{
modelId: 'minimax-m2.7',
name: 'MiniMax-M2.7',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'minimax-m3',
name: 'MiniMax-M3',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.6-plus',
name: 'Qwen3.6 Plus',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 0.5,
output: 3,
cacheRead: 0.05,
cacheWrite: 0.625,
},
},
},
{
modelId: 'qwen3.7-max',
name: 'Qwen3.7 Max',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 2.5,
output: 7.5,
cacheRead: 0.5,
cacheWrite: 3.125,
},
},
},
{
modelId: 'qwen3.7-plus',
name: 'Qwen3.7 Plus',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 0.4,
output: 1.6,
cacheRead: 0.04,
cacheWrite: 0.5,
},
},
},
],
} as const
@@ -0,0 +1,966 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'opencode'
export const providerConfig = {
name: 'opencode',
config: {
api: 'openai-completions',
baseUrl: 'https://opencode.ai/zen/v1',
apiKey: 'OPENCODE_API_KEY',
},
models: [
{
modelId: 'big-pickle',
name: 'Big Pickle',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 32000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'claude-fable-5',
name: 'Claude Fable 5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 10,
output: 50,
cacheRead: 1,
cacheWrite: 12.5,
},
},
},
{
modelId: 'claude-haiku-4-5',
name: 'Claude Haiku 4.5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 1,
output: 5,
cacheRead: 0.1,
cacheWrite: 1.25,
},
},
},
{
modelId: 'claude-opus-4-1',
name: 'Claude Opus 4.1',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 32000,
cost: {
input: 15,
output: 75,
cacheRead: 1.5,
cacheWrite: 18.75,
},
},
},
{
modelId: 'claude-opus-4-5',
name: 'Claude Opus 4.5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-6',
name: 'Claude Opus 4.6',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-7',
name: 'Claude Opus 4.7',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-opus-4-8',
name: 'Claude Opus 4.8',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'claude-sonnet-4',
name: 'Claude Sonnet 4',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-4-5',
name: 'Claude Sonnet 4.5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 64000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-4-6',
name: 'Claude Sonnet 4.6',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 64000,
cost: {
input: 3,
output: 15,
cacheRead: 0.3,
cacheWrite: 3.75,
},
},
},
{
modelId: 'claude-sonnet-5',
name: 'Claude Sonnet 5',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 2,
output: 10,
cacheRead: 0.2,
cacheWrite: 2.5,
},
},
},
{
modelId: 'deepseek-v4-flash',
name: 'DeepSeek V4 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0.14,
output: 0.28,
cacheRead: 0.028,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v4-flash-free',
name: 'DeepSeek V4 Flash Free',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 128000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v4-pro',
name: 'DeepSeek V4 Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 1.74,
output: 3.84,
cacheRead: 0.145,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3-flash',
name: 'Gemini 3 Flash',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.5,
output: 3,
cacheRead: 0.05,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.1-pro',
name: 'Gemini 3.1 Pro Preview',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 2,
output: 12,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.5-flash',
name: 'Gemini 3.5 Flash',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 1.5,
output: 9,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.5-flash-lite',
name: 'Gemini 3.5 Flash Lite',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 0.3,
output: 2.5,
cacheRead: 0.03,
cacheWrite: 0,
},
},
},
{
modelId: 'gemini-3.6-flash',
name: 'Gemini 3.6 Flash',
config: {
api: 'google-generative-ai',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 65536,
cost: {
input: 1.5,
output: 7.5,
cacheRead: 0.15,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5',
name: 'GLM-5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 1,
output: 3.2,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.1',
name: 'GLM-5.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0.26,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.2',
name: 'GLM-5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0.26,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5',
name: 'GPT-5',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.07,
output: 8.5,
cacheRead: 0.107,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-codex',
name: 'GPT-5 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.07,
output: 8.5,
cacheRead: 0.107,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5-nano',
name: 'GPT-5 Nano',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.05,
output: 0.4,
cacheRead: 0.005,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1',
name: 'GPT-5.1',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.07,
output: 8.5,
cacheRead: 0.107,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex',
name: 'GPT-5.1 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.07,
output: 8.5,
cacheRead: 0.107,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex-max',
name: 'GPT-5.1 Codex Max',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.25,
output: 10,
cacheRead: 0.125,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.1-codex-mini',
name: 'GPT-5.1 Codex Mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.25,
output: 2,
cacheRead: 0.025,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2',
name: 'GPT-5.2',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.2-codex',
name: 'GPT-5.2 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.3-codex',
name: 'GPT-5.3 Codex',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4',
name: 'GPT-5.4',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 272000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4-mini',
name: 'GPT-5.4 Mini',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.75,
output: 4.5,
cacheRead: 0.075,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4-nano',
name: 'GPT-5.4 Nano',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 400000,
maxTokens: 128000,
cost: {
input: 0.2,
output: 1.25,
cacheRead: 0.02,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.4-pro',
name: 'GPT-5.4 Pro',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 30,
output: 180,
cacheRead: 30,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.5',
name: 'GPT-5.5',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.5-pro',
name: 'GPT-5.5 Pro',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 30,
output: 180,
cacheRead: 30,
cacheWrite: 0,
},
},
},
{
modelId: 'gpt-5.6-luna',
name: 'GPT-5.6 Luna',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 1,
output: 6,
cacheRead: 0.1,
cacheWrite: 1.25,
},
},
},
{
modelId: 'gpt-5.6-sol',
name: 'GPT-5.6 Sol',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 5,
output: 30,
cacheRead: 0.5,
cacheWrite: 6.25,
},
},
},
{
modelId: 'gpt-5.6-terra',
name: 'GPT-5.6 Terra',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1050000,
maxTokens: 128000,
cost: {
input: 2.5,
output: 15,
cacheRead: 0.25,
cacheWrite: 3.125,
},
},
},
{
modelId: 'grok-4.5',
name: 'Grok 4.5',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 500000,
maxTokens: 500000,
cost: {
input: 2,
output: 6,
cacheRead: 0.5,
cacheWrite: 0,
},
},
},
{
modelId: 'grok-build-0.1',
name: 'Grok Build 0.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 256000,
cost: {
input: 1,
output: 2,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.5',
name: 'Kimi K2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.6,
output: 3,
cacheRead: 0.08,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.7-code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.19,
cacheWrite: 0,
},
},
},
{
modelId: 'laguna-s-2.1-free',
name: 'Laguna S 2.1 Free',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 256000,
maxTokens: 32000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5-free',
name: 'MiMo V2.5 Free',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 32000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'minimax-m2.5',
name: 'MiniMax-M2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'minimax-m2.7',
name: 'MiniMax-M2.7',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'minimax-m3',
name: 'MiniMax-M3',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 512000,
maxTokens: 128000,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'nemotron-3-ultra-free',
name: 'Nemotron 3 Ultra Free',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 128000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'north-mini-code-free',
name: 'North Mini Code Free',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 256000,
maxTokens: 64000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.5-plus',
name: 'Qwen3.5 Plus',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.2,
output: 1.2,
cacheRead: 0.02,
cacheWrite: 0.25,
},
},
},
{
modelId: 'qwen3.6-plus',
name: 'Qwen3.6 Plus',
config: {
api: 'anthropic-messages',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.5,
output: 3,
cacheRead: 0.05,
cacheWrite: 0.625,
},
},
},
],
} as const
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,269 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'qwen-token-plan-cn'
export const providerConfig = {
name: 'qwen-token-plan-cn',
config: {
api: 'openai-completions',
baseUrl: 'https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1',
apiKey: '',
},
models: [
{
modelId: 'MiniMax-M2.5',
name: 'MiniMax-M2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 196608,
maxTokens: 24576,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v3.2',
name: 'DeepSeek V3.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 65536,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v4-flash',
name: 'DeepSeek V4 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v4-pro',
name: 'DeepSeek V4 Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5',
name: 'GLM-5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 202752,
maxTokens: 16384,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.1',
name: 'GLM-5.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 202752,
maxTokens: 128000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.2',
name: 'GLM-5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.5',
name: 'Kimi K2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 32768,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 16384,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.7-code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.6-flash',
name: 'Qwen3.6 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.6-plus',
name: 'Qwen3.6 Plus',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.7-max',
name: 'Qwen3.7 Max',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.7-plus',
name: 'Qwen3.7 Plus',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 64000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.8-max-preview',
name: 'Qwen3.8 Max Preview',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,269 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'qwen-token-plan'
export const providerConfig = {
name: 'qwen-token-plan',
config: {
api: 'openai-completions',
baseUrl: 'https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1',
apiKey: '',
},
models: [
{
modelId: 'MiniMax-M2.5',
name: 'MiniMax-M2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 196608,
maxTokens: 24576,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v3.2',
name: 'DeepSeek V3.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 65536,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v4-flash',
name: 'DeepSeek V4 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-v4-pro',
name: 'DeepSeek V4 Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 384000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5',
name: 'GLM-5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 202752,
maxTokens: 16384,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.1',
name: 'GLM-5.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 202752,
maxTokens: 128000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.2',
name: 'GLM-5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.5',
name: 'Kimi K2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 32768,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 16384,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'kimi-k2.7-code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 262144,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.6-flash',
name: 'Qwen3.6 Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.6-plus',
name: 'Qwen3.6 Plus',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.7-max',
name: 'Qwen3.7 Max',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 65536,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.7-plus',
name: 'Qwen3.7 Plus',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 64000,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'qwen3.8-max-preview',
name: 'Qwen3.8 Max Preview',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,286 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'together'
export const providerConfig = {
name: 'together',
config: {
api: 'openai-completions',
baseUrl: 'https://api.together.ai/v1',
apiKey: 'TOGETHER_API_KEY',
},
models: [
{
modelId: 'MiniMaxAI/MiniMax-M2.7',
name: 'MiniMax-M2.7',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 202752,
maxTokens: 131072,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'MiniMaxAI/MiniMax-M3',
name: 'MiniMax-M3',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 524288,
maxTokens: 250000,
cost: {
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen2.5-7B-Instruct-Turbo',
name: 'Qwen 2.5 7B Instruct Turbo',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 32768,
maxTokens: 32768,
cost: {
input: 0.3,
output: 0.3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.5-9B',
name: 'Qwen3.5 9B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.17,
output: 0.25,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.6-Plus',
name: 'Qwen3.6 Plus',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 500000,
cost: {
input: 0.5,
output: 3,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'Qwen/Qwen3.7-Max',
name: 'Qwen3.7 Max',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 1000000,
maxTokens: 500000,
cost: {
input: 1.25,
output: 3.75,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'deepseek-ai/DeepSeek-V4-Pro',
name: 'DeepSeek V4 Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 512000,
maxTokens: 384000,
cost: {
input: 1.74,
output: 3.48,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'google/gemma-4-31B-it',
name: 'Gemma 4 31B Instruct',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 131072,
cost: {
input: 0.39,
output: 0.97,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'meta-llama/Llama-3.3-70B-Instruct-Turbo',
name: 'Llama 3.3 70B',
config: {
api: 'openai-completions',
reasoning: false,
input: ['text'],
contextWindow: 131072,
maxTokens: 131072,
cost: {
input: 1.04,
output: 1.04,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'moonshotai/Kimi-K2.6',
name: 'Kimi K2.6',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 131000,
cost: {
input: 1.2,
output: 4.5,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'moonshotai/Kimi-K2.7-Code',
name: 'Kimi K2.7 Code',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 131072,
cost: {
input: 0.95,
output: 4,
cacheRead: 0.19,
cacheWrite: 0,
},
},
},
{
modelId: 'nvidia/nemotron-3-ultra-550b-a55b',
name: 'Nemotron 3 Ultra 550B A55B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 512300,
maxTokens: 512300,
cost: {
input: 0.6,
output: 3.6,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'openai/gpt-oss-120b',
name: 'GPT OSS 120B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 131072,
cost: {
input: 0.15,
output: 0.6,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'openai/gpt-oss-20b',
name: 'GPT OSS 20B',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 131072,
cost: {
input: 0.05,
output: 0.2,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'thinkingmachines/Inkling',
name: 'Inkling',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 524288,
maxTokens: 131072,
cost: {
input: 1,
output: 4.05,
cacheRead: 0.17,
cacheWrite: 0,
},
},
},
{
modelId: 'zai-org/GLM-5.2',
name: 'GLM-5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 164000,
cost: {
input: 1.4,
output: 4.4,
cacheRead: 0.26,
cacheWrite: 0,
},
},
},
],
} as const
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,65 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'xai'
export const providerConfig = {
name: 'xai',
config: {
api: 'openai-completions',
baseUrl: 'https://api.x.ai/v1',
apiKey: 'XAI_API_KEY',
},
models: [
{
modelId: 'grok-4.3',
name: 'Grok 4.3',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1000000,
maxTokens: 30000,
cost: {
input: 1.25,
output: 2.5,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
{
modelId: 'grok-4.5',
name: 'Grok 4.5',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text', 'image'],
contextWindow: 500000,
maxTokens: 500000,
cost: {
input: 2,
output: 6,
cacheRead: 0.3,
cacheWrite: 0,
},
},
},
{
modelId: 'grok-build-0.1',
name: 'Grok Build 0.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 256000,
maxTokens: 256000,
cost: {
input: 1,
output: 2,
cacheRead: 0.2,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,65 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'xiaomi-token-plan-ams'
export const providerConfig = {
name: 'xiaomi-token-plan-ams',
config: {
api: 'openai-completions',
baseUrl: 'https://token-plan-ams.xiaomimimo.com/v1',
apiKey: 'XIAOMI_TOKEN_PLAN_AMS_API_KEY',
},
models: [
{
modelId: 'mimo-v2-pro',
name: 'MiMo-V2-Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5',
name: 'MiMo-V2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5-pro',
name: 'MiMo-V2.5-Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,65 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'xiaomi-token-plan-cn'
export const providerConfig = {
name: 'xiaomi-token-plan-cn',
config: {
api: 'openai-completions',
baseUrl: 'https://token-plan-cn.xiaomimimo.com/v1',
apiKey: 'XIAOMI_TOKEN_PLAN_CN_API_KEY',
},
models: [
{
modelId: 'mimo-v2-pro',
name: 'MiMo-V2-Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5',
name: 'MiMo-V2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5-pro',
name: 'MiMo-V2.5-Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,65 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'xiaomi-token-plan-sgp'
export const providerConfig = {
name: 'xiaomi-token-plan-sgp',
config: {
api: 'openai-completions',
baseUrl: 'https://token-plan-sgp.xiaomimimo.com/v1',
apiKey: 'XIAOMI_TOKEN_PLAN_SGP_API_KEY',
},
models: [
{
modelId: 'mimo-v2-pro',
name: 'MiMo-V2-Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5',
name: 'MiMo-V2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5-pro',
name: 'MiMo-V2.5-Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,116 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'xiaomi'
export const providerConfig = {
name: 'xiaomi',
config: {
api: 'openai-completions',
baseUrl: 'https://api.xiaomimimo.com/v1',
apiKey: 'XIAOMI_API_KEY',
},
models: [
{
modelId: 'mimo-v2-flash',
name: 'MiMo-V2-Flash',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 262144,
maxTokens: 65536,
cost: {
input: 0.14,
output: 0.28,
cacheRead: 0.0028,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2-omni',
name: 'MiMo-V2-Omni',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 262144,
maxTokens: 131072,
cost: {
input: 0.14,
output: 0.28,
cacheRead: 0.0028,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2-pro',
name: 'MiMo-V2-Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0.435,
output: 0.87,
cacheRead: 0.0036,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5',
name: 'MiMo-V2.5',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0.14,
output: 0.28,
cacheRead: 0.0028,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5-pro',
name: 'MiMo-V2.5-Pro',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 0.435,
output: 0.87,
cacheRead: 0.0036,
cacheWrite: 0,
},
},
},
{
modelId: 'mimo-v2.5-pro-ultraspeed',
name: 'MiMo-V2.5-Pro-UltraSpeed',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1048576,
maxTokens: 131072,
cost: {
input: 1.305,
output: 2.61,
cacheRead: 0.0108,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,116 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'zai-coding-cn'
export const providerConfig = {
name: 'zai-coding-cn',
config: {
api: 'openai-completions',
baseUrl: 'https://open.bigmodel.cn/api/coding/paas/v4',
apiKey: '',
},
models: [
{
modelId: 'glm-4.5-air',
name: 'GLM-4.5-Air',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 98304,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-4.7',
name: 'GLM-4.7',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5-turbo',
name: 'GLM-5-Turbo',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.1',
name: 'GLM-5.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.2',
name: 'GLM-5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5v-turbo',
name: 'GLM-5V-Turbo',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -0,0 +1,116 @@
// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = 'zai'
export const providerConfig = {
name: 'zai',
config: {
api: 'openai-completions',
baseUrl: 'https://api.z.ai/api/coding/paas/v4',
apiKey: 'ZAI_API_KEY',
},
models: [
{
modelId: 'glm-4.5-air',
name: 'GLM-4.5-Air',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 131072,
maxTokens: 98304,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-4.7',
name: 'GLM-4.7',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 204800,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5-turbo',
name: 'GLM-5-Turbo',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.1',
name: 'GLM-5.1',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 200000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5.2',
name: 'GLM-5.2',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text'],
contextWindow: 1000000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
{
modelId: 'glm-5v-turbo',
name: 'GLM-5V-Turbo',
config: {
api: 'openai-completions',
reasoning: true,
input: ['text', 'image'],
contextWindow: 200000,
maxTokens: 131072,
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
},
},
],
} as const
@@ -1,5 +1,6 @@
import { setupTestDbHooks } from '@shumai/db/test'
import { teamService } from '@shumai/core/src/team/team'
import { agentService } from '@shumai/core/src/agent/agent'
import { providerService } from './provider'
import { describe, expect, it } from 'vitest'
import { ProviderConfigSerializable, providerModelSchema } from '@shumai/dtos'
@@ -148,4 +149,45 @@ describe('ProviderService', () => {
const afterDelete = await providerService.listByTeam(team.id)
expect(afterDelete.find((p) => p.id === provider.id)).toBeUndefined()
})
it('should preserve model IDs and linked agent modelId when updating provider config', async () => {
const team = await teamService.ensureDefaultTeam()
await providerService.initBuiltinProviders(team.id)
const providers = await providerService.listByTeam(team.id)
const googleProvider = providers.find((p) => p.name === 'google')
expect(googleProvider).toBeDefined()
const initialModels = await providerService.listModelsByProvider(team.id, googleProvider!.id)
expect(initialModels.length).toBeGreaterThan(0)
const initialModelId = initialModels[0].id
// Create an agent pointing to the google provider and first model
const agent = await agentService.createAgent({
teamId: team.id,
name: 'Google Agent',
type: 'chat',
enabled: true,
thinkingLevel: 'off',
providerId: googleProvider!.id,
modelId: initialModelId,
})
expect(agent?.modelId).toBe(initialModelId)
// Update provider config (e.g. API key) with the same model list
const newConfig: ProviderConfigSerializable = {
...googleProvider!.config,
apiKey: 'new-google-api-key',
}
await providerService.update(team.id, googleProvider!.id, newConfig, initialModels)
// Verify model IDs were preserved
const updatedModels = await providerService.listModelsByProvider(team.id, googleProvider!.id)
expect(updatedModels[0].id).toBe(initialModelId)
// Verify agent's modelId is still linked and not nulled out
const updatedAgents = await agentService.listAgents({ teamId: team.id })
const updatedAgent = updatedAgents.find((a) => a.id === agent!.id)
expect(updatedAgent?.modelId).toBe(initialModelId)
})
})
+38 -10
View File
@@ -111,23 +111,51 @@ export class ProviderService {
models: ProviderModel[],
) {
return this.prismaClient.$transaction(async (tx) => {
// Delete all existing models for this provider
await tx.model.deleteMany({
const existingModels = await tx.model.findMany({
where: { providerId: id },
})
// Update provider and recreate models
const existingByModelId = new Map(existingModels.map((m) => [m.modelId, m]))
const incomingModelIds = new Set(models.map((m) => m.modelId))
// Delete models that are no longer in the incoming list
const modelsToDelete = existingModels.filter((m) => !incomingModelIds.has(m.modelId))
if (modelsToDelete.length > 0) {
await tx.model.deleteMany({
where: {
id: { in: modelsToDelete.map((m) => m.id) },
},
})
}
// Update existing models or create new ones
for (const m of models) {
const existing = existingByModelId.get(m.modelId)
if (existing) {
await tx.model.update({
where: { id: existing.id },
data: {
name: m.name,
config: m.config,
},
})
} else {
await tx.model.create({
data: {
providerId: id,
modelId: m.modelId,
name: m.name,
config: m.config,
},
})
}
}
// Update provider config
return tx.provider.update({
where: { id, teamId },
data: {
config,
models: {
create: models.map((m) => ({
modelId: m.modelId,
name: m.name,
config: m.config,
})),
},
},
include: { models: true },
})
+10 -1
View File
@@ -1,4 +1,4 @@
import { prisma } from '@shumai/db'
import { prisma, type TeamMemberRole } from '@shumai/db'
import { SkillInfo, UpsertSkillRequest } from '@shumai/dtos'
import { s3Service } from '@shumai/core/src/s3/s3'
import AdmZip from 'adm-zip'
@@ -125,6 +125,14 @@ export class SkillService {
return this.toSkillInfo(skill)
}
async updateSkillPermission(id: string, permission: TeamMemberRole): Promise<SkillInfo> {
const skill = await this.prismaClient.skill.update({
where: { id },
data: { permission },
})
return this.toSkillInfo(skill)
}
async listSkills(teamId: string): Promise<SkillInfo[]> {
const skills = await this.prismaClient.skill.findMany({
where: { teamId },
@@ -276,6 +284,7 @@ export class SkillService {
config: s.config as PrismaJson.SkillConfig,
assetId: s.assetId,
hash: s.hash,
permission: s.permission || 'reviewer',
createdAt: s.createdAt.toISOString(),
updatedAt: s.updatedAt.toISOString(),
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/db",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"main": "./src/index.ts",
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "skills" ADD COLUMN "permission" "TeamMemberRole" NOT NULL DEFAULT 'reviewer';
+1
View File
@@ -262,6 +262,7 @@ model Skill {
config Json? @default("{}")
assetId String @map("asset_id")
hash String @map("hash")
permission TeamMemberRole @default(reviewer)
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
+14 -14
View File
@@ -223,13 +223,6 @@ export type EnumTeamMemberRoleFilter<$PrismaModel = never> = {
not?: Prisma.NestedEnumTeamMemberRoleFilter<$PrismaModel> | $Enums.TeamMemberRole
}
export type EnumTeamMemberScopeFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberScope | Prisma.EnumTeamMemberScopeFieldRefInput<$PrismaModel>
in?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
notIn?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumTeamMemberScopeFilter<$PrismaModel> | $Enums.TeamMemberScope
}
export type EnumTeamMemberRoleWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel>
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel>
@@ -240,6 +233,13 @@ export type EnumTeamMemberRoleWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedEnumTeamMemberRoleFilter<$PrismaModel>
}
export type EnumTeamMemberScopeFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberScope | Prisma.EnumTeamMemberScopeFieldRefInput<$PrismaModel>
in?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
notIn?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumTeamMemberScopeFilter<$PrismaModel> | $Enums.TeamMemberScope
}
export type EnumTeamMemberScopeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberScope | Prisma.EnumTeamMemberScopeFieldRefInput<$PrismaModel>
in?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
@@ -838,13 +838,6 @@ export type NestedEnumTeamMemberRoleFilter<$PrismaModel = never> = {
not?: Prisma.NestedEnumTeamMemberRoleFilter<$PrismaModel> | $Enums.TeamMemberRole
}
export type NestedEnumTeamMemberScopeFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberScope | Prisma.EnumTeamMemberScopeFieldRefInput<$PrismaModel>
in?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
notIn?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumTeamMemberScopeFilter<$PrismaModel> | $Enums.TeamMemberScope
}
export type NestedEnumTeamMemberRoleWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel>
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel>
@@ -855,6 +848,13 @@ export type NestedEnumTeamMemberRoleWithAggregatesFilter<$PrismaModel = never> =
_max?: Prisma.NestedEnumTeamMemberRoleFilter<$PrismaModel>
}
export type NestedEnumTeamMemberScopeFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberScope | Prisma.EnumTeamMemberScopeFieldRefInput<$PrismaModel>
in?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
notIn?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumTeamMemberScopeFilter<$PrismaModel> | $Enums.TeamMemberScope
}
export type NestedEnumTeamMemberScopeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberScope | Prisma.EnumTeamMemberScopeFieldRefInput<$PrismaModel>
in?: $Enums.TeamMemberScope[] | Prisma.ListEnumTeamMemberScopeFieldRefInput<$PrismaModel>
File diff suppressed because one or more lines are too long
@@ -3022,6 +3022,7 @@ export const SkillScalarFieldEnum = {
config: 'config',
assetId: 'assetId',
hash: 'hash',
permission: 'permission',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
teamId: 'teamId'
@@ -207,6 +207,7 @@ export const SkillScalarFieldEnum = {
config: 'config',
assetId: 'assetId',
hash: 'hash',
permission: 'permission',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
teamId: 'teamId'
+44 -1
View File
@@ -32,6 +32,7 @@ export type SkillMinAggregateOutputType = {
description: string | null
assetId: string | null
hash: string | null
permission: $Enums.TeamMemberRole | null
createdAt: Date | null
updatedAt: Date | null
teamId: string | null
@@ -43,6 +44,7 @@ export type SkillMaxAggregateOutputType = {
description: string | null
assetId: string | null
hash: string | null
permission: $Enums.TeamMemberRole | null
createdAt: Date | null
updatedAt: Date | null
teamId: string | null
@@ -55,6 +57,7 @@ export type SkillCountAggregateOutputType = {
config:PrismaJson.SkillConfig
assetId: number
hash: number
permission: number
createdAt: number
updatedAt: number
teamId: number
@@ -68,6 +71,7 @@ export type SkillMinAggregateInputType = {
description?: true
assetId?: true
hash?: true
permission?: true
createdAt?: true
updatedAt?: true
teamId?: true
@@ -79,6 +83,7 @@ export type SkillMaxAggregateInputType = {
description?: true
assetId?: true
hash?: true
permission?: true
createdAt?: true
updatedAt?: true
teamId?: true
@@ -91,6 +96,7 @@ export type SkillCountAggregateInputType = {
config?: true
assetId?: true
hash?: true
permission?: true
createdAt?: true
updatedAt?: true
teamId?: true
@@ -176,6 +182,7 @@ export type SkillGroupByOutputType = {
config:PrismaJson.SkillConfig | null
assetId: string
hash: string
permission: $Enums.TeamMemberRole
createdAt: Date
updatedAt: Date
teamId: string
@@ -209,6 +216,7 @@ export type SkillWhereInput = {
config?: Prisma.JsonNullableFilter<"Skill">
assetId?: Prisma.StringFilter<"Skill"> | string
hash?: Prisma.StringFilter<"Skill"> | string
permission?: Prisma.EnumTeamMemberRoleFilter<"Skill"> | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFilter<"Skill"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"Skill"> | Date | string
teamId?: Prisma.StringFilter<"Skill"> | string
@@ -223,6 +231,7 @@ export type SkillOrderByWithRelationInput = {
config?: Prisma.SortOrderInput | Prisma.SortOrder
assetId?: Prisma.SortOrder
hash?: Prisma.SortOrder
permission?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
teamId?: Prisma.SortOrder
@@ -241,6 +250,7 @@ export type SkillWhereUniqueInput = Prisma.AtLeast<{
config?: Prisma.JsonNullableFilter<"Skill">
assetId?: Prisma.StringFilter<"Skill"> | string
hash?: Prisma.StringFilter<"Skill"> | string
permission?: Prisma.EnumTeamMemberRoleFilter<"Skill"> | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFilter<"Skill"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"Skill"> | Date | string
teamId?: Prisma.StringFilter<"Skill"> | string
@@ -255,6 +265,7 @@ export type SkillOrderByWithAggregationInput = {
config?: Prisma.SortOrderInput | Prisma.SortOrder
assetId?: Prisma.SortOrder
hash?: Prisma.SortOrder
permission?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
teamId?: Prisma.SortOrder
@@ -273,6 +284,7 @@ export type SkillScalarWhereWithAggregatesInput = {
config?: Prisma.JsonNullableWithAggregatesFilter<"Skill">
assetId?: Prisma.StringWithAggregatesFilter<"Skill"> | string
hash?: Prisma.StringWithAggregatesFilter<"Skill"> | string
permission?: Prisma.EnumTeamMemberRoleWithAggregatesFilter<"Skill"> | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeWithAggregatesFilter<"Skill"> | Date | string
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Skill"> | Date | string
teamId?: Prisma.StringWithAggregatesFilter<"Skill"> | string
@@ -285,6 +297,7 @@ export type SkillCreateInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId: string
hash: string
permission?: $Enums.TeamMemberRole
createdAt?: Date | string
updatedAt?: Date | string
team: Prisma.TeamCreateNestedOneWithoutSkillsInput
@@ -298,6 +311,7 @@ export type SkillUncheckedCreateInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId: string
hash: string
permission?: $Enums.TeamMemberRole
createdAt?: Date | string
updatedAt?: Date | string
teamId: string
@@ -311,6 +325,7 @@ export type SkillUpdateInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId?: Prisma.StringFieldUpdateOperationsInput | string
hash?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
team?: Prisma.TeamUpdateOneRequiredWithoutSkillsNestedInput
@@ -324,6 +339,7 @@ export type SkillUncheckedUpdateInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId?: Prisma.StringFieldUpdateOperationsInput | string
hash?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
@@ -337,6 +353,7 @@ export type SkillCreateManyInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId: string
hash: string
permission?: $Enums.TeamMemberRole
createdAt?: Date | string
updatedAt?: Date | string
teamId: string
@@ -349,6 +366,7 @@ export type SkillUpdateManyMutationInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId?: Prisma.StringFieldUpdateOperationsInput | string
hash?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
}
@@ -360,6 +378,7 @@ export type SkillUncheckedUpdateManyInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId?: Prisma.StringFieldUpdateOperationsInput | string
hash?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
@@ -387,6 +406,7 @@ export type SkillCountOrderByAggregateInput = {
config?: Prisma.SortOrder
assetId?: Prisma.SortOrder
hash?: Prisma.SortOrder
permission?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
teamId?: Prisma.SortOrder
@@ -398,6 +418,7 @@ export type SkillMaxOrderByAggregateInput = {
description?: Prisma.SortOrder
assetId?: Prisma.SortOrder
hash?: Prisma.SortOrder
permission?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
teamId?: Prisma.SortOrder
@@ -409,6 +430,7 @@ export type SkillMinOrderByAggregateInput = {
description?: Prisma.SortOrder
assetId?: Prisma.SortOrder
hash?: Prisma.SortOrder
permission?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
teamId?: Prisma.SortOrder
@@ -461,6 +483,10 @@ export type SkillUncheckedUpdateManyWithoutTeamNestedInput = {
deleteMany?: Prisma.SkillScalarWhereInput | Prisma.SkillScalarWhereInput[]
}
export type EnumTeamMemberRoleFieldUpdateOperationsInput = {
set?: $Enums.TeamMemberRole
}
export type SkillCreateNestedOneWithoutAgentSkillsInput = {
create?: Prisma.XOR<Prisma.SkillCreateWithoutAgentSkillsInput, Prisma.SkillUncheckedCreateWithoutAgentSkillsInput>
connectOrCreate?: Prisma.SkillCreateOrConnectWithoutAgentSkillsInput
@@ -482,6 +508,7 @@ export type SkillCreateWithoutTeamInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId: string
hash: string
permission?: $Enums.TeamMemberRole
createdAt?: Date | string
updatedAt?: Date | string
agentSkills?: Prisma.AgentSkillCreateNestedManyWithoutSkillInput
@@ -494,6 +521,7 @@ export type SkillUncheckedCreateWithoutTeamInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId: string
hash: string
permission?: $Enums.TeamMemberRole
createdAt?: Date | string
updatedAt?: Date | string
agentSkills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutSkillInput
@@ -535,6 +563,7 @@ export type SkillScalarWhereInput = {
config?: Prisma.JsonNullableFilter<"Skill">
assetId?: Prisma.StringFilter<"Skill"> | string
hash?: Prisma.StringFilter<"Skill"> | string
permission?: Prisma.EnumTeamMemberRoleFilter<"Skill"> | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFilter<"Skill"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"Skill"> | Date | string
teamId?: Prisma.StringFilter<"Skill"> | string
@@ -547,6 +576,7 @@ export type SkillCreateWithoutAgentSkillsInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId: string
hash: string
permission?: $Enums.TeamMemberRole
createdAt?: Date | string
updatedAt?: Date | string
team: Prisma.TeamCreateNestedOneWithoutSkillsInput
@@ -559,6 +589,7 @@ export type SkillUncheckedCreateWithoutAgentSkillsInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId: string
hash: string
permission?: $Enums.TeamMemberRole
createdAt?: Date | string
updatedAt?: Date | string
teamId: string
@@ -587,6 +618,7 @@ export type SkillUpdateWithoutAgentSkillsInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId?: Prisma.StringFieldUpdateOperationsInput | string
hash?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
team?: Prisma.TeamUpdateOneRequiredWithoutSkillsNestedInput
@@ -599,6 +631,7 @@ export type SkillUncheckedUpdateWithoutAgentSkillsInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId?: Prisma.StringFieldUpdateOperationsInput | string
hash?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
@@ -611,6 +644,7 @@ export type SkillCreateManyTeamInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId: string
hash: string
permission?: $Enums.TeamMemberRole
createdAt?: Date | string
updatedAt?: Date | string
}
@@ -622,6 +656,7 @@ export type SkillUpdateWithoutTeamInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId?: Prisma.StringFieldUpdateOperationsInput | string
hash?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
agentSkills?: Prisma.AgentSkillUpdateManyWithoutSkillNestedInput
@@ -634,6 +669,7 @@ export type SkillUncheckedUpdateWithoutTeamInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId?: Prisma.StringFieldUpdateOperationsInput | string
hash?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
agentSkills?: Prisma.AgentSkillUncheckedUpdateManyWithoutSkillNestedInput
@@ -646,6 +682,7 @@ export type SkillUncheckedUpdateManyWithoutTeamInput = {
config?:PrismaJson.SkillConfig | Prisma.NullableJsonNullValueInput
assetId?: Prisma.StringFieldUpdateOperationsInput | string
hash?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
}
@@ -688,6 +725,7 @@ export type SkillSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs =
config?: boolean
assetId?: boolean
hash?: boolean
permission?: boolean
createdAt?: boolean
updatedAt?: boolean
teamId?: boolean
@@ -703,6 +741,7 @@ export type SkillSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensi
config?: boolean
assetId?: boolean
hash?: boolean
permission?: boolean
createdAt?: boolean
updatedAt?: boolean
teamId?: boolean
@@ -716,6 +755,7 @@ export type SkillSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensi
config?: boolean
assetId?: boolean
hash?: boolean
permission?: boolean
createdAt?: boolean
updatedAt?: boolean
teamId?: boolean
@@ -729,12 +769,13 @@ export type SkillSelectScalar = {
config?: boolean
assetId?: boolean
hash?: boolean
permission?: boolean
createdAt?: boolean
updatedAt?: boolean
teamId?: boolean
}
export type SkillOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "config" | "assetId" | "hash" | "createdAt" | "updatedAt" | "teamId", ExtArgs["result"]["skill"]>
export type SkillOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "config" | "assetId" | "hash" | "permission" | "createdAt" | "updatedAt" | "teamId", ExtArgs["result"]["skill"]>
export type SkillInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
team?: boolean | Prisma.TeamDefaultArgs<ExtArgs>
agentSkills?: boolean | Prisma.Skill$agentSkillsArgs<ExtArgs>
@@ -763,6 +804,7 @@ export type $SkillPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs
config:PrismaJson.SkillConfig | null
assetId: string
hash: string
permission: $Enums.TeamMemberRole
createdAt: Date
updatedAt: Date
teamId: string
@@ -1197,6 +1239,7 @@ export interface SkillFieldRefs {
readonly config: Prisma.FieldRef<"Skill", 'Json'>
readonly assetId: Prisma.FieldRef<"Skill", 'String'>
readonly hash: Prisma.FieldRef<"Skill", 'String'>
readonly permission: Prisma.FieldRef<"Skill", 'TeamMemberRole'>
readonly createdAt: Prisma.FieldRef<"Skill", 'DateTime'>
readonly updatedAt: Prisma.FieldRef<"Skill", 'DateTime'>
readonly teamId: Prisma.FieldRef<"Skill", 'String'>
-4
View File
@@ -452,10 +452,6 @@ export type TeamMemberUncheckedUpdateManyWithoutTeamNestedInput = {
deleteMany?: Prisma.TeamMemberScalarWhereInput | Prisma.TeamMemberScalarWhereInput[]
}
export type EnumTeamMemberRoleFieldUpdateOperationsInput = {
set?: $Enums.TeamMemberRole
}
export type EnumTeamMemberScopeFieldUpdateOperationsInput = {
set?: $Enums.TeamMemberScope
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/dtos",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"main": "./src/index.ts",
+7
View File
@@ -16,6 +16,7 @@ export interface SkillInfo {
config: SkillConfig | null
assetId: string
hash: string
permission: 'owner' | 'editor' | 'reviewer'
createdAt: string
updatedAt: string
}
@@ -41,6 +42,12 @@ export const updateSkillConfigRequestSchema = z.object({
export type UpdateSkillConfigRequest = z.infer<typeof updateSkillConfigRequestSchema>
export const updateSkillPermissionRequestSchema = z.object({
permission: z.enum(['owner', 'editor', 'reviewer']),
})
export type UpdateSkillPermissionRequest = z.infer<typeof updateSkillPermissionRequestSchema>
export interface ListSkillsResponse {
skills: SkillInfo[]
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/e2e",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/tableprinter",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"main": "./src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/transcode",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"main": "./src/index.ts",
@@ -34,6 +34,14 @@ import {
} from '@/ui/components/ui/alert-dialog'
import { SkillInfo } from '@shumai/dtos'
import { m } from '@/ui/paraglide/messages.js'
import { usePermissions } from '@/ui/hooks/use-permissions'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/ui/components/ui/select'
const Github = (props: React.SVGProps<SVGSVGElement>) => (
<svg
@@ -59,6 +67,7 @@ interface SkillsConfigCardProps {
export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) => {
const queryClient = useQueryClient()
const { canAdmin } = usePermissions()
const [isAddDialogOpen, setIsAddDialogOpen] = useState(false)
const [isConfigDialogOpen, setIsConfigDialogOpen] = useState(false)
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false)
@@ -88,6 +97,29 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
},
})
// Update Skill Permission
const updatePermissionMutation = useMutation({
mutationFn: async ({
id,
permission,
}: {
id: string
permission: 'owner' | 'editor' | 'reviewer'
}) => {
const res = await client.api.skills[':id'].permission.$patch({
param: { id },
json: { permission },
})
if (!res.ok) throw new Error(m.failed_to_update_permission())
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'skills'] })
},
onError: (err: Error) => {
alert(err.message || m.failed_to_update_permission())
},
})
const skills = data?.skills || []
return (
@@ -127,6 +159,7 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
<SkillItem
key={skill.id}
skill={skill}
canAdmin={canAdmin}
onDelete={() => {
setSelectedSkill(skill)
setIsDeleteDialogOpen(true)
@@ -135,6 +168,9 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
setSelectedSkill(skill)
setIsConfigDialogOpen(true)
}}
onPermissionChange={(permission) =>
updatePermissionMutation.mutate({ id: skill.id, permission })
}
/>
))}
</div>
@@ -194,12 +230,16 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
const SkillItem = ({
skill,
canAdmin,
onDelete,
onConfigure,
onPermissionChange,
}: {
skill: SkillInfo
canAdmin: boolean
onDelete: () => void
onConfigure: () => void
onPermissionChange: (permission: 'owner' | 'editor' | 'reviewer') => void
}) => {
return (
<div
@@ -232,11 +272,26 @@ const SkillItem = ({
{skill.description || m.no_description_provided()}
</p>
</div>
<div className="mt-4 flex items-center justify-between text-[10px] text-muted-foreground uppercase tracking-wider font-semibold">
<span>
<div className="mt-4 flex items-center justify-between gap-2 pt-2 border-t border-border/50 text-xs">
<span className="text-[10px] text-muted-foreground uppercase tracking-wider font-semibold">
{m.updated_date()} {new Date(skill.updatedAt).toLocaleDateString()}
</span>
<div className="px-2 py-0.5 rounded-full bg-primary/10 text-primary">{m.installed()}</div>
<div className="flex items-center gap-2" onClick={(e) => e.stopPropagation()}>
<Select
value={skill.permission || 'reviewer'}
onValueChange={(val) => onPermissionChange(val as 'owner' | 'editor' | 'reviewer')}
disabled={!canAdmin}
>
<SelectTrigger className="h-7 text-xs px-2 bg-background border-border w-[140px]">
<SelectValue placeholder={m.skill_permission()} />
</SelectTrigger>
<SelectContent align="end">
<SelectItem value="reviewer">{m.permission_all_users()}</SelectItem>
<SelectItem value="editor">{m.permission_owner_and_editor()}</SelectItem>
<SelectItem value="owner">{m.permission_owner_only()}</SelectItem>
</SelectContent>
</Select>
</div>
</div>
</div>
)
+5
View File
@@ -322,6 +322,11 @@
"skills_description": "Add, update and configure AI skills for the team.",
"skills_management": "Skills Management",
"skills_management_description": "Extend your chatbot's capabilities with custom skills.",
"skill_permission": "Permission",
"permission_all_users": "All Users",
"permission_owner_and_editor": "Owner & Editor",
"permission_owner_only": "Owner Only",
"failed_to_update_permission": "Failed to update permission",
"add_skill": "Add Skill",
"no_skills_installed": "No skills installed",
"add_skill_to_get_started": "Add a skill via GitHub URL or upload a ZIP file to get started.",
+5
View File
@@ -322,6 +322,11 @@
"skills_description": "为团队添加、更新和配置 AI 技能。",
"skills_management": "技能管理",
"skills_management_description": "使用自定义技能扩展聊天机器人的功能。",
"skill_permission": "权限",
"permission_all_users": "所有成员",
"permission_owner_and_editor": "管理员与编辑",
"permission_owner_only": "仅管理员",
"failed_to_update_permission": "更新权限失败",
"add_skill": "添加技能",
"no_skills_installed": "暂无已安装的技能",
"add_skill_to_get_started": "通过 GitHub URL 添加技能或上传 ZIP 文件以开始使用。",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/webui",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"main": "./index.html",
+5
View File
@@ -305,6 +305,11 @@ export * from "./skills.js";
export * from "./skills_description.js";
export * from "./skills_management.js";
export * from "./skills_management_description.js";
export * from "./skill_permission.js";
export * from "./permission_all_users.js";
export * from "./permission_owner_and_editor.js";
export * from "./permission_owner_only.js";
export * from "./failed_to_update_permission.js";
export * from "./add_skill.js";
export * from "./no_skills_installed.js";
export * from "./add_skill_to_get_started.js";
+5
View File
@@ -307,6 +307,11 @@ export * from './skills.js'
export * from './skills_description.js'
export * from './skills_management.js'
export * from './skills_management_description.js'
export * from './skill_permission.js'
export * from './permission_all_users.js'
export * from './permission_owner_and_editor.js'
export * from './permission_owner_only.js'
export * from './failed_to_update_permission.js'
export * from './add_skill.js'
export * from './no_skills_installed.js'
export * from './add_skill_to_get_started.js'
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Failed to update permission" |
*
* @param {Failed_To_Update_PermissionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const failed_to_update_permission: ((inputs?: Failed_To_Update_PermissionInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Failed_To_Update_PermissionInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Failed_To_Update_PermissionInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Failed_To_Update_PermissionInputs */
const en_failed_to_update_permission = /** @type {(inputs: Failed_To_Update_PermissionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Failed to update permission`)
};
const zh_failed_to_update_permission = /** @type {(inputs: Failed_To_Update_PermissionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`更新权限失败`)
};
/**
* | output |
* | --- |
* | "Failed to update permission" |
*
* @param {Failed_To_Update_PermissionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const failed_to_update_permission = /** @type {((inputs?: Failed_To_Update_PermissionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Failed_To_Update_PermissionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_failed_to_update_permission(inputs)
return zh_failed_to_update_permission(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "All Users" |
*
* @param {Permission_All_UsersInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const permission_all_users: ((inputs?: Permission_All_UsersInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Permission_All_UsersInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Permission_All_UsersInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Permission_All_UsersInputs */
const en_permission_all_users = /** @type {(inputs: Permission_All_UsersInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`All Users`)
};
const zh_permission_all_users = /** @type {(inputs: Permission_All_UsersInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`所有成员`)
};
/**
* | output |
* | --- |
* | "All Users" |
*
* @param {Permission_All_UsersInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const permission_all_users = /** @type {((inputs?: Permission_All_UsersInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Permission_All_UsersInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_permission_all_users(inputs)
return zh_permission_all_users(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Owner & Editor" |
*
* @param {Permission_Owner_And_EditorInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const permission_owner_and_editor: ((inputs?: Permission_Owner_And_EditorInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Permission_Owner_And_EditorInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Permission_Owner_And_EditorInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Permission_Owner_And_EditorInputs */
const en_permission_owner_and_editor = /** @type {(inputs: Permission_Owner_And_EditorInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Owner & Editor`)
};
const zh_permission_owner_and_editor = /** @type {(inputs: Permission_Owner_And_EditorInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`管理员与编辑`)
};
/**
* | output |
* | --- |
* | "Owner & Editor" |
*
* @param {Permission_Owner_And_EditorInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const permission_owner_and_editor = /** @type {((inputs?: Permission_Owner_And_EditorInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Permission_Owner_And_EditorInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_permission_owner_and_editor(inputs)
return zh_permission_owner_and_editor(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Owner Only" |
*
* @param {Permission_Owner_OnlyInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const permission_owner_only: ((inputs?: Permission_Owner_OnlyInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Permission_Owner_OnlyInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Permission_Owner_OnlyInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Permission_Owner_OnlyInputs */
const en_permission_owner_only = /** @type {(inputs: Permission_Owner_OnlyInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Owner Only`)
};
const zh_permission_owner_only = /** @type {(inputs: Permission_Owner_OnlyInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`仅管理员`)
};
/**
* | output |
* | --- |
* | "Owner Only" |
*
* @param {Permission_Owner_OnlyInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const permission_owner_only = /** @type {((inputs?: Permission_Owner_OnlyInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Permission_Owner_OnlyInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_permission_owner_only(inputs)
return zh_permission_owner_only(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Permission" |
*
* @param {Skill_PermissionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const skill_permission: ((inputs?: Skill_PermissionInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Skill_PermissionInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Skill_PermissionInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Skill_PermissionInputs */
const en_skill_permission = /** @type {(inputs: Skill_PermissionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Permission`)
};
const zh_skill_permission = /** @type {(inputs: Skill_PermissionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`权限`)
};
/**
* | output |
* | --- |
* | "Permission" |
*
* @param {Skill_PermissionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const skill_permission = /** @type {((inputs?: Skill_PermissionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Skill_PermissionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_skill_permission(inputs)
return zh_skill_permission(inputs)
});
+1 -1
View File
@@ -1 +1 @@
export const APP_VERSION = '0.2.0'
export const APP_VERSION = '0.2.1'
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/workflow-core",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"main": "./src/index.ts",
+145 -80
View File
@@ -57,85 +57,150 @@ export function sortProviders(entries: [string, unknown][]): [string, unknown][]
})
}
async function sync() {
console.log('Fetching pi models from GitHub...')
const res = await fetch(
'https://raw.githubusercontent.com/earendil-works/pi/refs/heads/main/packages/ai/src/models.generated.ts',
)
if (!res.ok) {
throw new Error(`Failed to fetch pi models: ${res.statusText}`)
}
let text = await res.text()
console.log('Parsing models...')
// Remove imports
text = text.replace(/import\s+.*?from\s+['"].*?['"];?/g, '')
// Remove 'satisfies Model<...>'
text = text.replace(/satisfies\s+Model<[^>]+>/g, '')
// Write to a temporary file to import it
const tmpPath = path.join(process.cwd(), 'scripts', 'tmp-models.ts')
fs.writeFileSync(tmpPath, text)
try {
const { MODELS } = await import(tmpPath)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const providers: Record<string, any> = {}
const sortedEntries = sortProviders(Object.entries(MODELS))
for (const [providerName, models] of sortedEntries) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const modelList = Object.values(models as Record<string, any>)
if (modelList.length === 0) continue
const firstModel = modelList[0]
providers[providerName] = {
name: providerName,
config: {
api: firstModel.api,
baseUrl: firstModel.baseUrl,
apiKey: envMap[providerName] || '',
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
models: modelList.map((m: any) => ({
modelId: m.id,
name: m.name,
config: {
api: m.api,
reasoning: m.reasoning,
input: m.input,
contextWindow: m.contextWindow,
maxTokens: m.maxTokens,
cost: m.cost,
},
})),
}
}
const generatedDir = path.join(process.cwd(), 'packages', 'core', 'src', 'generated')
if (!fs.existsSync(generatedDir)) {
fs.mkdirSync(generatedDir, { recursive: true })
}
const outPath = path.join(generatedDir, 'providers.generated.ts')
const outContent = `// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const builtinProviders: Record<string, any> = ${JSON.stringify(providers, null, 2)} as unknown as Record<string, any>
`
fs.writeFileSync(outPath, outContent)
console.log(`Successfully generated builtin providers: ${outPath}`)
} finally {
if (fs.existsSync(tmpPath)) {
fs.unlinkSync(tmpPath)
}
}
function toIdentifier(name: string): string {
const camel = name.replace(/-([a-z0-9])/g, (_, g) => g.toUpperCase())
return camel.replace(/[^a-zA-Z0-9_$]/g, '_')
}
sync().catch((err) => {
console.error(err)
process.exit(1)
})
async function loadModelData(): Promise<Record<string, unknown>> {
// Check local pi-mono data directory first
const piMonoDataDir = path.resolve(
process.cwd(),
'..',
'pi-mono',
'packages',
'ai',
'src',
'providers',
'data',
)
if (fs.existsSync(piMonoDataDir)) {
console.log(`Loading model data from local pi-mono workspace: ${piMonoDataDir}`)
const files = fs
.readdirSync(piMonoDataDir)
.filter((f) => f.endsWith('.json') && !f.startsWith('.'))
const rawProviders: Record<string, unknown> = {}
for (const file of files) {
const providerName = path.basename(file, '.json')
const filePath = path.join(piMonoDataDir, file)
const content = JSON.parse(fs.readFileSync(filePath, 'utf8'))
rawProviders[providerName] = content
}
return rawProviders
}
console.log('Local pi-mono data directory not found, fetching from models.dev API...')
const res = await fetch('https://models.dev/api/v1/models')
if (!res.ok) {
throw new Error(`Failed to fetch models from models.dev: ${res.statusText}`)
}
const data = (await res.json()) as Record<string, unknown>
return data
}
async function sync() {
console.log('Loading pi model data...')
const rawModels = await loadModelData()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const providers: Record<string, any> = {}
const sortedEntries = sortProviders(Object.entries(rawModels))
for (const [providerName, models] of sortedEntries) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const modelList = Object.values(models as Record<string, any>)
if (modelList.length === 0) continue
const firstModel = modelList[0]
providers[providerName] = {
name: providerName,
config: {
api: firstModel.api,
baseUrl: firstModel.baseUrl,
apiKey: envMap[providerName] || '',
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
models: modelList.map((m: any) => ({
modelId: m.id,
name: m.name,
config: {
api: m.api,
reasoning: m.reasoning,
input: m.input,
contextWindow: m.contextWindow,
maxTokens: m.maxTokens,
cost: m.cost,
},
})),
}
}
const generatedDir = path.join(process.cwd(), 'packages', 'core', 'src', 'generated')
const providersSubdir = path.join(generatedDir, 'providers')
if (!fs.existsSync(providersSubdir)) {
fs.mkdirSync(providersSubdir, { recursive: true })
}
// Clean existing files in providers directory
const existingSubFiles = fs.readdirSync(providersSubdir)
for (const file of existingSubFiles) {
if (file.endsWith('.ts')) {
fs.unlinkSync(path.join(providersSubdir, file))
}
}
// Write individual provider files
const importStatements: string[] = []
const providerEntries: string[] = []
for (const [providerName, providerData] of Object.entries(providers)) {
const filePath = path.join(providersSubdir, `${providerName}.ts`)
const fileContent = `// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
export const providerName = ${JSON.stringify(providerName)}
export const providerConfig = ${JSON.stringify(providerData, null, 2)} as const
`
fs.writeFileSync(filePath, fileContent)
const identifier = toIdentifier(providerName)
importStatements.push(
`import { providerConfig as ${identifier} } from './providers/${providerName}'`,
)
if (identifier === providerName) {
providerEntries.push(` ${identifier},`)
} else {
providerEntries.push(` ${JSON.stringify(providerName)}: ${identifier},`)
}
}
console.log(`Generated ${Object.keys(providers).length} provider files in ${providersSubdir}`)
// Write main aggregator providers.generated.ts
const outPath = path.join(generatedDir, 'providers.generated.ts')
const outContent = `// This file is auto-generated by scripts/generate-builtin-providers.ts
// Do not edit manually - run 'bun run generate-providers' to update
${importStatements.join('\n')}
export const builtinProviders: Record<string, any> = {
${providerEntries.join('\n')}
} as unknown as Record<string, any>
`
fs.writeFileSync(outPath, outContent)
console.log(`Successfully generated aggregator: ${outPath}`)
}
const isEntryScript =
import.meta.main ||
(process.argv[1] &&
process.argv[1].endsWith('generate-builtin-providers.ts') &&
!process.argv[1].includes('.test.'))
if (isEntryScript) {
sync().catch((err) => {
console.error(err)
process.exit(1)
})
}