Compare commits

..
32 Commits
Author SHA1 Message Date
yiling dc8c898dae Release v0.2.2 2026-07-23 20:35:22 +08:00
Yiling-J ecc382af61 Merge pull request #218 from shumaiOne/fix/upload-task-completion-status
fix(webui): invalidate upload tasks query when upload task starts and completes
2026-07-23 20:25:44 +08:00
yiling 78dec7626b fix(webui): invalidate upload tasks query when upload task starts and completes 2026-07-23 20:18:37 +08:00
Yiling-J f87033bd3d Merge pull request #217 from shumaiOne/feat/psd-imagemagick-support
feat(transcode): add PSD support via ImageMagick and enforce sRGB conversion
2026-07-23 17:02:11 +08:00
yiling d1b0f3b64f docs: update Windows system requirements in README to include ImageMagick 2026-07-23 16:48:34 +08:00
yiling 8cdbc403db test(e2e): add PSD transcode workflow E2E test 2026-07-23 16:44:56 +08:00
yiling 90adc496dd fix(transcode): update APT package name from imagemagick-7.q16 to imagemagick 2026-07-23 16:34:01 +08:00
yiling 8d1c51abca feat(transcode): add PSD support via ImageMagick and enforce sRGB conversion 2026-07-23 16:19:25 +08:00
Yiling-J 21de21902e Merge pull request #215 from shumaiOne/feat/ai-token-usage-tracking
feat(ai-usage): add team and member token usage tracking and APIs
2026-07-23 15:26:32 +08:00
Yiling-J 330a0b99a9 Merge pull request #216 from shumaiOne/feat/webui-ai-token-usage
feat(webui): integrate AI usage API into dashboard page
2026-07-23 15:10:58 +08:00
yiling df013aa4bb feat(webui): add AI usage dashboard for team and member token tracking 2026-07-23 15:03:09 +08:00
yiling 2c04c97a02 refactor(ai-usage): use Prisma.PrismaClientKnownRequestError for P2002 handling 2026-07-23 11:35:18 +08:00
yiling f6c0a41151 fix(ai-usage): resolve code review feedback for concurrency upsert and timeframe window 2026-07-23 11:29:11 +08:00
yiling f93c8ea524 refactor(agent): invoke harness.subscribe directly without typeof check 2026-07-23 11:11:48 +08:00
yiling 783daa6d3f fix(ai-usage): align since date with top-of-hour bucket boundaries 2026-07-23 11:08:35 +08:00
yiling 1c44e5aff7 feat(ai-usage): add team and member token usage tracking and APIs 2026-07-23 11:02:54 +08:00
Yiling-J 2552d68b98 Merge pull request #214 from shumaiOne/fix/search-result-row-overflow
fix(webui): prevent horizontal overflow in search dialog result rows
2026-07-22 21:18:06 +08:00
yiling 1f714af366 fix(webui): prevent horizontal overflow in search dialog result rows 2026-07-22 21:12:45 +08:00
Yiling-J f0ca7c180b Merge pull request #213 from shumaiOne/fix/sql-query-builder-bugs
fix(search): fix buildSqlCondition date range, numeric metadata, and string parsing bugs
2026-07-22 20:43:26 +08:00
yiling 8aadaa70bf fix(search): fix buildSqlCondition date range, numeric metadata, and string parsing bugs 2026-07-22 20:33:33 +08:00
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
163 changed files with 25647 additions and 17658 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils imagemagick
- name: Lint
run: bun run lint
@@ -157,7 +157,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils imagemagick
- name: Run Workflow E2E Tests
run: bun run test:e2e:workflow
+1 -1
View File
@@ -48,7 +48,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev fd-find
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils imagemagick libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev fd-find
- name: Install dependencies
run: bun install
+1
View File
@@ -11,6 +11,7 @@ data/
*.db
*.diff
*.orig
.agents
# Playwright
/playwright-report/
+1
View File
@@ -50,6 +50,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
bubblewrap \
gosu \
poppler-utils \
imagemagick \
fonts-noto-cjk \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
+10 -7
View File
@@ -126,23 +126,24 @@ Shumai requires the following system packages on Linux:
- **`ffmpeg`** – Used for media transcoding and metadata extraction.
- **`poppler`** (`poppler-utils`) – Used for PDF page image extraction and PDF sprite preview generation (`pdftoppm`).
- **`imagemagick`** – Used for PSD format transcoding and color profile conversion to sRGB.
- **`bubblewrap`**, **`socat`**, and **`ripgrep`** – Required by the AI agent sandbox (`anthropic-experimental/sandbox-runtime`) for process isolation, networking, and workspace search.
Install all required packages with one command:
> Ubuntu/Debian
```bash
sudo apt install -y ffmpeg poppler-utils bubblewrap socat ripgrep
sudo apt install -y ffmpeg poppler-utils imagemagick bubblewrap socat ripgrep
```
> Fedora
```bash
sudo dnf install -y ffmpeg poppler-utils bubblewrap socat ripgrep
sudo dnf install -y ffmpeg poppler-utils ImageMagick bubblewrap socat ripgrep
```
> Arch Linux
```bash
sudo pacman -S --noconfirm ffmpeg poppler bubblewrap socat ripgrep
sudo pacman -S --noconfirm ffmpeg poppler imagemagick bubblewrap socat ripgrep
```
> [!NOTE]
@@ -164,12 +165,13 @@ Shumai requires:
- **`ffmpeg`** – Used for media transcoding and metadata extraction.
- **`poppler`** – Used for PDF page image extraction and PDF sprite preview generation (`pdftoppm`).
- **`imagemagick`** – Used for PSD format transcoding and color profile conversion to sRGB.
- **`ripgrep`** – Required by the AI agent sandbox (`anthropic-experimental/sandbox-runtime`).
Install the required packages with Homebrew:
```bash
brew install ffmpeg poppler ripgrep
brew install ffmpeg poppler imagemagick ripgrep
```
---
@@ -190,17 +192,18 @@ brew install ffmpeg poppler ripgrep
Shumai requires:
- **`ffmpeg`** – Used for media transcoding and metadata extraction.
- **`imagemagick`** – Used for PSD format transcoding and color profile conversion to sRGB.
Install `ffmpeg` using your preferred package manager:
Install required packages using your preferred package manager:
**winget**
```powershell
winget install Gyan.FFmpeg
winget install Gyan.FFmpeg ImageMagick.ImageMagick
```
**Chocolatey**
```powershell
choco install ffmpeg
choco install ffmpeg imagemagick
```
#### Step 4: Install Shumai globally
+10 -7
View File
@@ -140,23 +140,24 @@ mkdir shumai && cd shumai
- **`ffmpeg`** —— 用于媒体转码和元数据提取。
- **`poppler`** (`poppler-utils`) —— 用于 PDF 页面图像提取和 PDF 雪碧图预览生成 (`pdftoppm`)。
- **`imagemagick`** —— 用于 PSD 格式图像转码和 sRGB 色彩空间转换。
- **`bubblewrap`**、**`socat`** 和 **`ripgrep`** —— AI Agent 沙箱(`anthropic-experimental/sandbox-runtime`)所需,用于进程隔离、网络通信和工作区搜索。
可以使用以下命令一次性安装所有依赖:
> Ubuntu/Debian
```bash
sudo apt install -y ffmpeg poppler-utils bubblewrap socat ripgrep
sudo apt install -y ffmpeg poppler-utils imagemagick bubblewrap socat ripgrep
```
> Fedora
```bash
sudo dnf install -y ffmpeg poppler-utils bubblewrap socat ripgrep
sudo dnf install -y ffmpeg poppler-utils ImageMagick bubblewrap socat ripgrep
```
> Arch Linux
```bash
sudo pacman -S --noconfirm ffmpeg poppler bubblewrap socat ripgrep
sudo pacman -S --noconfirm ffmpeg poppler imagemagick bubblewrap socat ripgrep
```
> [!NOTE]
@@ -178,12 +179,13 @@ sudo pacman -S --noconfirm ffmpeg poppler bubblewrap socat ripgrep
- **`ffmpeg`** —— 用于媒体转码和元数据提取。
- **`poppler`** —— 用于 PDF 页面图像提取和 PDF 雪碧图预览生成 (`pdftoppm`)。
- **`imagemagick`** —— 用于 PSD 格式图像转码和 sRGB 色彩空间转换。
- **`ripgrep`** —— AI Agent 沙箱(`anthropic-experimental/sandbox-runtime`)所需。
使用 Homebrew 安装所需依赖:
```bash
brew install ffmpeg poppler ripgrep
brew install ffmpeg poppler imagemagick ripgrep
```
---
@@ -204,17 +206,18 @@ brew install ffmpeg poppler ripgrep
在 Windows 上运行 Shumai 需要:
- **`ffmpeg`** —— 用于媒体转码和元数据提取。
- **`imagemagick`** —— 用于 PSD 格式图像转码和 sRGB 色彩空间转换。
使用你偏好的包管理器安装 `ffmpeg`:
使用你偏好的包管理器安装所需依赖:
**winget**
```powershell
winget install Gyan.FFmpeg
winget install Gyan.FFmpeg ImageMagick.ImageMagick
```
**Chocolatey**
```powershell
choco install ffmpeg
choco install ffmpeg imagemagick
```
#### 第四步:全局安装 Shumai
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/agent-app",
"version": "0.2.0",
"version": "0.2.2",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/cli",
"version": "0.2.0",
"version": "0.2.2",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/transcode-app",
"version": "0.2.0",
"version": "0.2.2",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/web-app",
"version": "0.2.0",
"version": "0.2.2",
"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.2",
"private": true,
"type": "module",
"repository": {
+11 -11
View File
@@ -1,27 +1,27 @@
{
"name": "@shumai/agent",
"version": "0.2.0",
"version": "0.2.2",
"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"
@@ -56,6 +56,7 @@ describe('Agent Activities', () => {
it('should call agentChatActivity and prompt the harness', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: 'AI response' }],
usage: { input: 10, output: 20 },
@@ -95,6 +96,84 @@ describe('Agent Activities', () => {
expect(piAgent.createAgentSession).toHaveBeenCalled()
})
it('should subscribe to harness events and record usage for assistant message_end events', async () => {
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
const spyRecordUsage = vi.spyOn(aiUsageService, 'recordUsage').mockResolvedValue()
let subscribeListener!: (event: unknown) => Promise<void>
const mockHarness = {
subscribe: vi.fn().mockImplementation((listener) => {
subscribeListener = listener
}),
prompt: vi.fn().mockImplementation(async () => {
// Trigger assistant message end event during turn
if (subscribeListener) {
await subscribeListener({
type: 'message_end',
message: {
role: 'assistant',
usage: {
input: 150,
output: 75,
cacheRead: 25,
totalTokens: 225,
cost: { total: 0.0015 },
},
},
})
}
return {
content: [{ type: 'text', text: 'Subscribed response' }],
usage: { input: 150, output: 75 },
}
}),
}
const mockSession = {
getEntries: vi.fn().mockResolvedValue([]),
getStorage: vi.fn().mockReturnValue({ sessionId: 'mock-session-id' }),
}
vi.mocked(piAgent.createAgentSession).mockResolvedValue({
session: mockSession as unknown as Session<DatabaseSessionMetadata>,
harness: mockHarness as unknown as AgentHarness,
})
const context = {
agent: { id: 'b1', provider: { name: 'google' }, modelRef: { modelId: 'gemini' } },
dbProviders: [],
teamSkills: [],
allowedDomains: [],
} as unknown as AgentExecutionContext
const res = await agentChatActivity({
teamId: 'team123',
agentId: 'b1',
message: 'Hi',
imageUrls: [],
projectId: 'p1',
folderId: 'f1',
sessionId: 'mock-session-id',
userId: 'user123',
context,
})
expect(res.text).toBe('Subscribed response')
expect(res.usage.inputTokens).toBe(150)
expect(res.usage.outputTokens).toBe(75)
expect(res.usage.cacheReadTokens).toBe(25)
expect(res.usage.cost).toBe(0.0015)
expect(spyRecordUsage).toHaveBeenCalledWith({
teamId: 'team123',
userId: 'user123',
inputTokens: 150,
outputTokens: 75,
cacheReadTokens: 25,
totalTokens: 225,
cost: 0.0015,
})
})
it('should register local cancellation handler and call harness.abort when cancelled in local mode', async () => {
let resolvePrompt!: (value: {
content: Array<{ type: string; text: string } | { type: string }>
@@ -107,6 +186,7 @@ describe('Agent Activities', () => {
})
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockReturnValue(promptPromise),
abort: vi.fn(),
}
@@ -174,6 +254,7 @@ describe('Agent Activities', () => {
})
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockReturnValue(promptPromise),
abort: vi.fn(),
}
@@ -234,6 +315,7 @@ describe('Agent Activities', () => {
it('should include error message in text when stopReason is error', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [],
usage: { input: 0, output: 0 },
@@ -274,6 +356,7 @@ describe('Agent Activities', () => {
it('should pass thinkingLevel from agent config to createAgentSession', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [],
usage: { input: 0, output: 0 },
@@ -322,6 +405,7 @@ describe('Agent Activities', () => {
it('should call autofillAiActivity and run autofill tool', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: 'Captured' }],
usage: { input: 5, output: 5 },
@@ -962,6 +1046,7 @@ describe('Agent Database Activities Integration', () => {
})
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: ' "Summarized Chat Title" ' }],
}),
+57 -2
View File
@@ -25,11 +25,15 @@ import {
type DbProviderInfo,
} from '../index'
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
import { UpdateAssetMetadataRequest } from '@shumai/dtos'
export interface Usage {
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
model: string
}
@@ -209,8 +213,56 @@ If you need to create files in the local filesystem (for example, a temporary fi
} as unknown as SessionTreeEntry)
}
let totalInputTokens = 0
let totalOutputTokens = 0
let totalCacheReadTokens = 0
let grandTotalTokens = 0
let totalCost = 0
harness.subscribe(async (event) => {
if (event.type === 'message_end' && event.message.role === 'assistant') {
const assistantMsg = event.message
const u = assistantMsg.usage
if (u) {
const inputTokens = u.input || 0
const outputTokens = u.output || 0
const cacheReadTokens = u.cacheRead || 0
const totalTokens = u.totalTokens || inputTokens + outputTokens
const cost = u.cost?.total || 0
totalInputTokens += inputTokens
totalOutputTokens += outputTokens
totalCacheReadTokens += cacheReadTokens
grandTotalTokens += totalTokens
totalCost += cost
try {
await aiUsageService.recordUsage({
teamId: params.teamId,
userId: params.userId,
inputTokens,
outputTokens,
cacheReadTokens,
totalTokens,
cost,
})
} catch (err) {
logger.error({ err }, 'Failed to record AI usage')
}
}
}
})
const assistantMessage = await harness.prompt(params.prompt, { images: imagesToPass })
if (totalInputTokens === 0 && totalOutputTokens === 0 && assistantMessage.usage) {
totalInputTokens = assistantMessage.usage.input || 0
totalOutputTokens = assistantMessage.usage.output || 0
totalCacheReadTokens = assistantMessage.usage.cacheRead || 0
grandTotalTokens = assistantMessage.usage.totalTokens || totalInputTokens + totalOutputTokens
totalCost = assistantMessage.usage.cost?.total || 0
}
const sessionEntries = await session.getEntries()
sessionEntries.forEach((entry) => {
if (entry.type === 'message') {
@@ -243,8 +295,11 @@ If you need to create files in the local filesystem (for example, a temporary fi
const usage: Usage = {
model: modelId,
inputTokens: assistantMessage.usage?.input || 0,
outputTokens: assistantMessage.usage?.output || 0,
inputTokens: totalInputTokens,
outputTokens: totalOutputTokens,
cacheReadTokens: totalCacheReadTokens,
totalTokens: grandTotalTokens,
cost: totalCost,
}
const storage = session.getStorage()
+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')
})
})
+24 -20
View File
@@ -6,22 +6,22 @@ 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 { agentService } from '@shumai/core/src/agent/agent'
import { prisma } from '@shumai/db'
import { Type, type TSchema } from '@sinclair/typebox'
import * as fs from 'fs'
import * as path from 'path'
import { prisma } from '@shumai/db'
import { agentService } from '@shumai/core/src/agent/agent'
import { DatabaseSessionStorage } from './database-session-storage'
import { createAnalyzeImageTool } from './tools/analyze-image'
import { createScreenshotTool } from './tools/screenshot'
import { createReadPdfPagesTool } from './tools/read-pdf-pages'
import { createCreateFileTool } from './tools/create-file'
import { createCreateFolderTool } from './tools/create-folder'
import { createCreateVersionTool } from './tools/create-version'
import { createListAssetsTool } from './tools/list-assets'
import { createReadPdfPagesTool } from './tools/read-pdf-pages'
import { createReadSkillTool } from './tools/read-skill'
import { createSandboxedBashTool } from './tools/sandboxed-bash'
import { createScreenshotTool } from './tools/screenshot'
export interface DbModelInfo {
modelId: string
@@ -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) {
@@ -376,15 +380,15 @@ export function formatSkillsForPrompt(
return lines.join('\n')
}
import { registerWorkflow, registerActivities } from '@shumai/workflow-core'
import { WorkflowTaskType } from '@shumai/db'
import { agentEmbeddingMedia } from './workflows/agent-embedding'
import { queryEmbeddingForSearch } from './workflows/query-embedding-for-search'
import { agentAutofillMedia } from './workflows/agent-autofill'
import { agentChat } from './workflows/agent-chat'
import { agentToolCall } from './workflows/agent-tool-call'
import { registerActivities, registerWorkflow } from '@shumai/workflow-core'
import * as agentActivities from './activities/agent'
import * as aiActivities from './activities/ai'
import { agentAutofillMedia } from './workflows/agent-autofill'
import { agentChat } from './workflows/agent-chat'
import { agentEmbeddingMedia } from './workflows/agent-embedding'
import { agentToolCall } from './workflows/agent-tool-call'
import { queryEmbeddingForSearch } from './workflows/query-embedding-for-search'
export function initAgentWorkflows() {
registerWorkflow(WorkflowTaskType.ai_embedding, agentEmbeddingMedia)
@@ -397,19 +401,19 @@ export function initAgentWorkflows() {
registerActivities(aiActivities)
}
export * from './database-session-storage'
export * from './activities/agent'
export {
extractAiMetadataActivity,
generateEmbeddingActivity,
generateImageEmbeddingActivity,
generateTextEmbeddingActivity,
generateVideoChunkEmbeddingActivity,
type ExtractAiMetadataParams,
type GeneratedEmbedding,
type GenerateEmbeddingParams,
generateEmbeddingActivity,
type GenerateTextEmbeddingParams,
generateTextEmbeddingActivity,
type ExtractAiMetadataParams,
extractAiMetadataActivity,
generateImageEmbeddingActivity,
generateVideoChunkEmbeddingActivity,
} from './activities/ai'
export * from './database-session-storage'
export * from './workflows/agent-autofill'
export * from './workflows/agent-chat'
export * from './workflows/agent-embedding'
+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.2",
"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
+68
View File
@@ -37,6 +37,13 @@ vi.mock('@shumai/core/src/user/api-token', () => ({
},
}))
vi.mock('@shumai/core/src/ai-usage/ai-usage', () => ({
aiUsageService: {
recordUsage: vi.fn(),
getTeamUsageStats: vi.fn(),
},
}))
describe('team api', () => {
const app = new Hono().use('*', authMiddleware).route('/', teamRoute)
let mockCreateTeam: any // eslint-disable-line @typescript-eslint/no-explicit-any
@@ -403,5 +410,66 @@ describe('team api', () => {
expect(data).toEqual({ success: true })
expect(apiTokenService.deleteToken).toHaveBeenCalledWith('user1', 'token1')
})
it('GET /teams/:teamId/ai-usage returns team usage stats for owner', async () => {
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
vi.mocked(aiUsageService.getTeamUsageStats).mockResolvedValue({
timeframe: '30d',
team: {
inputTokens: 1000,
outputTokens: 500,
cacheReadTokens: 200,
totalTokens: 1500,
cost: 0.005,
},
})
const res = await app.request('/teams/t1/ai-usage?timeframe=30d')
expect(res.status).toBe(200)
const data = await res.json()
expect(data.team.totalTokens).toBe(1500)
expect(authzService.hasPermission).toHaveBeenCalledWith(
expect.objectContaining({
permission: Permission.Admin,
type: ResourceType.Team,
id: 't1',
}),
)
expect(aiUsageService.getTeamUsageStats).toHaveBeenCalledWith({
teamId: 't1',
timeframe: '30d',
userId: undefined,
})
})
it('GET /teams/:teamId/ai-usage?userId=user1 returns specific member usage stats', async () => {
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
vi.mocked(aiUsageService.getTeamUsageStats).mockResolvedValue({
timeframe: '7d',
member: {
userId: 'user1',
userName: 'Test User',
userEmail: 'user1@example.com',
role: 'owner',
inputTokens: 400,
outputTokens: 200,
cacheReadTokens: 50,
totalTokens: 600,
cost: 0.002,
},
})
const res = await app.request('/teams/t1/ai-usage?timeframe=7d&userId=user1')
expect(res.status).toBe(200)
const data = await res.json()
expect(data.member.userId).toBe('user1')
expect(aiUsageService.getTeamUsageStats).toHaveBeenCalledWith({
teamId: 't1',
timeframe: '7d',
userId: 'user1',
})
})
})
})
+22 -1
View File
@@ -15,8 +15,9 @@ import {
updateTeamMemberRoleRequestSchema,
createApiTokenRequestSchema,
} from '@shumai/dtos'
import { updateUserMetadataRequestSchema } from '@shumai/dtos'
import { updateUserMetadataRequestSchema, getTeamAiUsageQuerySchema } from '@shumai/dtos'
import { apiTokenService } from '@shumai/core/src/user/api-token'
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
import type { Prisma } from '@shumai/db'
type User = Prisma.UserGetPayload<Record<string, never>>
@@ -313,5 +314,25 @@ const route = new Hono<{ Variables: { user: User } }>()
await apiTokenService.deleteToken(user.id, tokenId)
return c.json({ success: true })
})
.get('/teams/:teamId/ai-usage', zValidator('query', getTeamAiUsageQuerySchema), async (c) => {
const user = c.get('user')
const teamId = c.req.param('teamId')
const { timeframe, userId } = c.req.valid('query')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Team,
id: teamId,
})
const stats = await aiUsageService.getTeamUsageStats({
teamId,
timeframe,
userId,
})
return c.json(stats)
})
export default route
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/core",
"version": "0.2.0",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",
+313
View File
@@ -0,0 +1,313 @@
import { describe, expect, it, vi } from 'vitest'
import { prisma } from '@shumai/db'
import { setupTestDbHooks } from '@shumai/db/test'
import { aiUsageService } from './ai-usage'
import { HTTPException } from 'hono/http-exception'
describe('AiUsageService', () => {
setupTestDbHooks()
async function createTestTeamAndUser() {
const user = await prisma.user.create({
data: {
name: 'Usage Test User',
email: `usage-test-${Date.now()}-${Math.random()}@example.com`,
},
})
const team = await prisma.team.create({
data: {
name: 'Usage Test Team',
},
})
const teamMember = await prisma.teamMember.create({
data: {
teamId: team.id,
userId: user.id,
role: 'owner',
},
})
return { user, team, teamMember }
}
it('records usage for both team total and specific member', async () => {
const { team, user } = await createTestTeamAndUser()
const now = new Date()
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 20,
totalTokens: 150,
cost: 0.001,
timestamp: now,
})
// Verify database rows
const records = await prisma.aiUsage.findMany({
where: { teamId: team.id },
})
expect(records).toHaveLength(2)
const teamRecord = records.find((r) => r.userId === null)
expect(teamRecord).toBeDefined()
expect(teamRecord?.inputTokens).toBe(100)
expect(teamRecord?.outputTokens).toBe(50)
expect(teamRecord?.cacheReadTokens).toBe(20)
expect(teamRecord?.totalTokens).toBe(150)
expect(teamRecord?.cost).toBeCloseTo(0.001)
const memberRecord = records.find((r) => r.userId === user.id)
expect(memberRecord).toBeDefined()
expect(memberRecord?.inputTokens).toBe(100)
expect(memberRecord?.outputTokens).toBe(50)
expect(memberRecord?.cacheReadTokens).toBe(20)
expect(memberRecord?.totalTokens).toBe(150)
expect(memberRecord?.cost).toBeCloseTo(0.001)
})
it('increments existing hourly buckets for team and member', async () => {
const { team, user } = await createTestTeamAndUser()
const now = new Date()
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 10,
totalTokens: 150,
cost: 0.001,
timestamp: now,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 200,
outputTokens: 100,
cacheReadTokens: 30,
totalTokens: 300,
cost: 0.002,
timestamp: now,
})
const teamStats = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(teamStats.team).toBeDefined()
expect(teamStats.team?.inputTokens).toBe(300)
expect(teamStats.team?.outputTokens).toBe(150)
expect(teamStats.team?.cacheReadTokens).toBe(40)
expect(teamStats.team?.totalTokens).toBe(450)
expect(teamStats.team?.cost).toBeCloseTo(0.003)
const memberStats = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
userId: user.id,
})
expect(memberStats.member).toBeDefined()
expect(memberStats.member?.userId).toBe(user.id)
expect(memberStats.member?.inputTokens).toBe(300)
expect(memberStats.member?.outputTokens).toBe(150)
expect(memberStats.member?.cacheReadTokens).toBe(40)
expect(memberStats.member?.totalTokens).toBe(450)
expect(memberStats.member?.cost).toBeCloseTo(0.003)
})
it('handles background system tasks with no userId', async () => {
const { team } = await createTestTeamAndUser()
await aiUsageService.recordUsage({
teamId: team.id,
userId: null,
inputTokens: 50,
outputTokens: 25,
cacheReadTokens: 5,
totalTokens: 75,
cost: 0.0005,
})
const records = await prisma.aiUsage.findMany({
where: { teamId: team.id },
})
expect(records).toHaveLength(1)
expect(records[0].userId).toBeNull()
expect(records[0].inputTokens).toBe(50)
})
it('filters statistics correctly by timeframe', async () => {
vi.useFakeTimers()
const now = new Date('2026-07-23T15:30:00Z')
vi.setSystemTime(now)
try {
const { team, user } = await createTestTeamAndUser()
// 5 minutes ago (within current 1h bucket)
const recent = new Date(now.getTime() - 5 * 60 * 1000)
// 2 hours ago (within 24h, outside 1h)
const twoHoursAgo = new Date(now.getTime() - 2 * 60 * 60 * 1000)
// 3 days ago (within 7d, outside 24h)
const threeDaysAgo = new Date(now.getTime() - 3 * 24 * 60 * 60 * 1000)
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 10,
totalTokens: 150,
cost: 0.001,
timestamp: recent,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 200,
outputTokens: 100,
cacheReadTokens: 20,
totalTokens: 300,
cost: 0.002,
timestamp: twoHoursAgo,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 400,
outputTokens: 200,
cacheReadTokens: 40,
totalTokens: 600,
cost: 0.004,
timestamp: threeDaysAgo,
})
// 1h timeframe should only include recent
const stats1h = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(stats1h.team?.inputTokens).toBe(100)
// 24h timeframe should include recent + 2 hours ago
const stats24h = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '24h',
})
expect(stats24h.team?.inputTokens).toBe(300)
// 7d timeframe should include all 3
const stats7d = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '7d',
})
expect(stats7d.team?.inputTokens).toBe(700)
} finally {
vi.useRealTimers()
}
})
it('throws 404 when querying non-existent team member', async () => {
const { team } = await createTestTeamAndUser()
await expect(
aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '30d',
userId: 'non-existent-user-id',
}),
).rejects.toThrow(HTTPException)
})
it('targets only current hour bucket for 1h timeframe instead of including previous hour bucket', async () => {
const { team, user } = await createTestTeamAndUser()
// 10:15 AM (previous hour)
const prevHour = new Date('2026-07-23T10:15:00Z')
// 11:10 AM (current hour)
const currHour = new Date('2026-07-23T11:10:00Z')
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 0,
cacheReadTokens: 0,
totalTokens: 100,
cost: 0.001,
timestamp: prevHour,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 50,
outputTokens: 0,
cacheReadTokens: 0,
totalTokens: 50,
cost: 0.0005,
timestamp: currHour,
})
vi.useFakeTimers()
vi.setSystemTime(new Date('2026-07-23T11:15:00Z'))
try {
const stats1h = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(stats1h.team?.inputTokens).toBe(50)
} finally {
vi.useRealTimers()
}
})
it('handles concurrent recordUsage calls for the same team and user without duplication or race errors', async () => {
const { team, user } = await createTestTeamAndUser()
const now = new Date()
await Promise.all([
aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 10,
totalTokens: 150,
cost: 0.001,
timestamp: now,
}),
aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 200,
outputTokens: 100,
cacheReadTokens: 20,
totalTokens: 300,
cost: 0.002,
timestamp: now,
}),
])
const stats = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(stats.team?.inputTokens).toBe(300)
expect(stats.team?.outputTokens).toBe(150)
})
})
+263
View File
@@ -0,0 +1,263 @@
import { prisma, Prisma } from '@shumai/db'
import type { TeamUsageStatsResponse, Timeframe } from '@shumai/dtos'
import { HTTPException } from 'hono/http-exception'
export interface RecordUsageParams {
teamId: string
userId?: string | null
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
timestamp?: Date
}
export interface GetTeamUsageStatsParams {
teamId: string
timeframe: Timeframe
userId?: string
}
export class AiUsageService {
private async incrementBucket(params: {
teamId: string
userId: string | null
periodStart: Date
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
}): Promise<void> {
if (params.userId !== null) {
await prisma.aiUsage.upsert({
where: {
// eslint-disable-next-line @typescript-eslint/naming-convention
teamId_userId_periodStart: {
teamId: params.teamId,
userId: params.userId,
periodStart: params.periodStart,
},
},
update: {
inputTokens: { increment: params.inputTokens },
outputTokens: { increment: params.outputTokens },
cacheReadTokens: { increment: params.cacheReadTokens },
totalTokens: { increment: params.totalTokens },
cost: { increment: params.cost },
},
create: {
teamId: params.teamId,
userId: params.userId,
periodStart: params.periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
},
})
} else {
const existing = await prisma.aiUsage.findFirst({
where: {
teamId: params.teamId,
userId: null,
periodStart: params.periodStart,
},
})
if (existing) {
await prisma.aiUsage.update({
where: { id: existing.id },
data: {
inputTokens: { increment: params.inputTokens },
outputTokens: { increment: params.outputTokens },
cacheReadTokens: { increment: params.cacheReadTokens },
totalTokens: { increment: params.totalTokens },
cost: { increment: params.cost },
},
})
} else {
try {
await prisma.aiUsage.create({
data: {
teamId: params.teamId,
userId: null,
periodStart: params.periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
},
})
} catch (err) {
if (err instanceof Prisma.PrismaClientKnownRequestError && err.code === 'P2002') {
await prisma.aiUsage.updateMany({
where: {
teamId: params.teamId,
userId: null,
periodStart: params.periodStart,
},
data: {
inputTokens: { increment: params.inputTokens },
outputTokens: { increment: params.outputTokens },
cacheReadTokens: { increment: params.cacheReadTokens },
totalTokens: { increment: params.totalTokens },
cost: { increment: params.cost },
},
})
} else {
throw err
}
}
}
}
}
async recordUsage(params: RecordUsageParams): Promise<void> {
const timestamp = params.timestamp ?? new Date()
const periodStart = new Date(timestamp)
periodStart.setMinutes(0, 0, 0)
// 1. Update/create Team Total record (userId = null)
await this.incrementBucket({
teamId: params.teamId,
userId: null,
periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
})
// 2. If triggered by a team member, update/create Member Usage record (userId = params.userId)
if (params.userId) {
await this.incrementBucket({
teamId: params.teamId,
userId: params.userId,
periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
})
}
}
async getTeamUsageStats(params: GetTeamUsageStatsParams): Promise<TeamUsageStatsResponse> {
const now = new Date()
const since = new Date(now)
switch (params.timeframe) {
case '1h':
// For 1h, target the current 1h bucket floored to start of current hour
since.setMinutes(0, 0, 0)
break
case '24h':
since.setDate(since.getDate() - 1)
since.setMinutes(0, 0, 0)
break
case '7d':
since.setDate(since.getDate() - 7)
since.setMinutes(0, 0, 0)
break
case '30d':
since.setDate(since.getDate() - 30)
since.setMinutes(0, 0, 0)
break
}
if (!params.userId) {
// Return Team-Level Usage (userId = null)
const teamRecords = await prisma.aiUsage.findMany({
where: {
teamId: params.teamId,
userId: null,
periodStart: { gte: since },
},
})
let inputTokens = 0
let outputTokens = 0
let cacheReadTokens = 0
let totalTokens = 0
let cost = 0
for (const r of teamRecords) {
inputTokens += r.inputTokens
outputTokens += r.outputTokens
cacheReadTokens += r.cacheReadTokens
totalTokens += r.totalTokens
cost += r.cost
}
return {
timeframe: params.timeframe,
team: {
inputTokens,
outputTokens,
cacheReadTokens,
totalTokens,
cost: Math.round((cost + Number.EPSILON) * 1000000) / 1000000,
},
}
} else {
// Return Specific Member Usage
const teamMember = await prisma.teamMember.findFirst({
where: {
teamId: params.teamId,
userId: params.userId,
},
include: { user: true },
})
if (!teamMember) {
throw new HTTPException(404, { message: 'Team member not found' })
}
const memberRecords = await prisma.aiUsage.findMany({
where: {
teamId: params.teamId,
userId: params.userId,
periodStart: { gte: since },
},
})
let inputTokens = 0
let outputTokens = 0
let cacheReadTokens = 0
let totalTokens = 0
let cost = 0
for (const r of memberRecords) {
inputTokens += r.inputTokens
outputTokens += r.outputTokens
cacheReadTokens += r.cacheReadTokens
totalTokens += r.totalTokens
cost += r.cost
}
return {
timeframe: params.timeframe,
member: {
userId: teamMember.user.id,
userName: teamMember.user.name,
userEmail: teamMember.user.email,
userImage: teamMember.user.image,
role: teamMember.role,
inputTokens,
outputTokens,
cacheReadTokens,
totalTokens,
cost: Math.round((cost + Number.EPSILON) * 1000000) / 1000000,
},
}
}
}
}
export const aiUsageService = new AiUsageService()
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
View File
@@ -21,3 +21,4 @@ export * from './versionStack/versionStack'
export * from './hyrumtoken'
export * from './pagination'
export * from './chat/chat'
export * from './ai-usage/ai-usage'
@@ -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 },
})
+54
View File
@@ -127,6 +127,7 @@ describe('SearchService', () => {
// String fields
await createWithMeta('str-apple', { text: 'apple' })
await createWithMeta('str-banana', { text: 'banana' })
await createWithMeta('sku-1-2', { sku: '1-2' })
// Number fields
await createWithMeta('num-10', { num: 10 })
@@ -181,6 +182,7 @@ describe('SearchService', () => {
val: 'str-apple',
expected: [
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -200,6 +202,7 @@ describe('SearchService', () => {
val: 'apple',
expected: [
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -220,6 +223,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -235,12 +239,14 @@ describe('SearchService', () => {
// String Metadata
{ field: 'text', op: 'eq', val: 'apple', expected: ['str-apple'] },
{ field: 'sku', op: 'eq', val: '1-2', expected: ['sku-1-2'] },
{
field: 'text',
op: 'neq',
val: 'apple',
expected: [
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -258,6 +264,7 @@ describe('SearchService', () => {
op: 'isEmpty',
val: null,
expected: [
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -281,6 +288,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-20',
'bool-true',
'bool-false',
@@ -293,6 +301,7 @@ describe('SearchService', () => {
],
},
{ field: 'num', op: 'gt', val: 15, expected: ['num-20'] },
{ field: 'num', op: 'gt', val: 100, expected: [] },
{ field: 'num', op: 'lt', val: 15, expected: ['num-10'] },
{ field: 'num', op: 'gte', val: 20, expected: ['num-20'] },
{ field: 'num', op: 'lte', val: 10, expected: ['num-10'] },
@@ -314,6 +323,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -332,6 +342,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -346,6 +357,7 @@ describe('SearchService', () => {
// Date Metadata
{ field: 'date', op: 'eq', val: 'today', expected: ['date-today'] },
{ field: 'date', op: 'lte', val: 'today', expected: ['date-today', 'date-yesterday'] },
{ field: 'date', op: 'isWithin', val: 'today', expected: ['date-today'] },
{ field: 'date', op: 'lt', val: 'today', expected: ['date-yesterday'] },
{ field: 'date', op: 'gt', val: 'yesterday', expected: ['date-today'] },
@@ -358,6 +370,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -378,6 +391,47 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
'bool-false',
'multi-a-b',
'multi-b-c',
'date-today',
'date-yesterday',
'name-contains-test',
'nothing',
],
},
{
field: 'createdAt',
op: 'eq',
val: 'today',
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
'bool-false',
'multi-a-b',
'multi-b-c',
'date-today',
'date-yesterday',
'name-contains-test',
'nothing',
],
},
{
field: 'createdAt',
op: 'lte',
val: 'today',
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -35,4 +35,76 @@ describe('SqlQueryBuilder', () => {
const builder = new SqlQueryBuilder().select(Prisma.sql`id`)
expect(() => builder.build()).toThrow('FROM clause is required')
})
describe('Bug Reproduction Tests for buildSqlCondition', () => {
it('Bug 1: createdAt eq date should match full day range (>= startOfDay AND <= endOfDay)', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [{ field: 'createdAt', operator: 'eq', value: '2026-07-22' }])
const query = builder.build()
expect(query.text).toBe(
'SELECT * FROM assets a WHERE (a."created_at" >= $1 AND a."created_at" <= $2)',
)
const startVal = query.values[0] as Date
const endVal = query.values[1] as Date
expect(startVal.getHours()).toBe(0)
expect(startVal.getMinutes()).toBe(0)
expect(startVal.getSeconds()).toBe(0)
expect(endVal.getHours()).toBe(23)
expect(endVal.getMinutes()).toBe(59)
expect(endVal.getSeconds()).toBe(59)
})
it('Bug 2: createdAt lte date should use end-of-day timestamp (23:59:59.999)', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [{ field: 'createdAt', operator: 'lte', value: '2026-07-22' }])
const query = builder.build()
expect(query.text).toBe('SELECT * FROM assets a WHERE (a."created_at" <= $1)')
const endVal = query.values[0] as Date
expect(endVal.getHours()).toBe(23)
expect(endVal.getMinutes()).toBe(59)
expect(endVal.getSeconds()).toBe(59)
})
it('Bug 3: custom metadata numeric query should ONLY query number_value', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [{ field: 'rating', operator: 'gt', value: 100 }])
const query = builder.build()
expect(query.text).toBe(
'SELECT * FROM assets a WHERE (a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = $1 AND number_value > $2))',
)
expect(query.values).toEqual(['rating', 100])
})
it('Bug 4: isDate should not misclassify dash-separated non-date string values like "1-2"', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [{ field: 'sku', operator: 'eq', value: '1-2' }])
const query = builder.build()
expect(query.text).toBe(
'SELECT * FROM assets a WHERE (a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = $1 AND string_value = $2))',
)
expect(query.values).toEqual(['sku', '1-2'])
})
it('Bug 5: custom field names with special characters are safely parameterized', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [
{ field: 'custom_field"test', operator: 'eq', value: 'hello' },
])
const query = builder.build()
expect(query.text).toBe(
'SELECT * FROM assets a WHERE (a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = $1 AND string_value = $2))',
)
expect(query.values).toEqual(['custom_field"test', 'hello'])
})
})
})
+61 -33
View File
@@ -101,7 +101,7 @@ export class SqlQueryBuilder {
private isDate(value: unknown): boolean {
if (value instanceof Date) return true
if (typeof value !== 'string') return false
const valStr = value.toLowerCase()
const valStr = value.trim().toLowerCase()
const relativeKeywords = [
'today',
'yesterday',
@@ -111,11 +111,14 @@ export class SqlQueryBuilder {
'one month ago',
'one month from now',
]
if (relativeKeywords.includes(valStr) || valStr.match(/\d+\s+days?\s+(ago|from\s+now)/)) {
if (relativeKeywords.includes(valStr) || valStr.match(/^\d+\s+days?\s+(ago|from\s+now)$/)) {
return true
}
if (!valStr.match(/^\d{4}-\d{2}-\d{2}/)) {
return false
}
const d = new Date(value)
return !isNaN(d.getTime()) && value.includes('-')
return !isNaN(d.getTime())
}
private toDate(value: unknown): Date {
@@ -123,12 +126,8 @@ export class SqlQueryBuilder {
}
private toDateBound(value: unknown, bound: 'start' | 'end'): Date {
const d = this.parseRelativeDate(value)
if (d instanceof Date) return d
if (d && 'gte' in d && 'lte' in d) {
return bound === 'start' ? d.gte! : d.lte!
}
return new Date(value as string)
const range = this.parseDateRange(value)
return bound === 'start' ? range.start : range.end
}
private parseDateRange(value: unknown): { start: Date; end: Date } {
@@ -137,6 +136,11 @@ export class SqlQueryBuilder {
return { start: d.gte!, end: d.lte! }
}
const date = d instanceof Date ? d : new Date(value as string)
const valStr = typeof value === 'string' ? value : ''
const hasTime = valStr.includes('T') || valStr.includes(':')
if (hasTime) {
return { start: date, end: date }
}
const start = new Date(date)
start.setHours(0, 0, 0, 0)
const end = new Date(date)
@@ -239,18 +243,8 @@ export class SqlQueryBuilder {
}
private buildSqlCondition(field: string, operator: string, value: unknown): Prisma.Sql | null {
const colName =
field === 'sizeByte' || field === 'size_byte'
? 'size_byte'
: field === 'createdAt' || field === 'created_at'
? 'created_at'
: field === 'updatedAt' || field === 'updated_at'
? 'updated_at'
: field
const dbCol = Prisma.raw(`a."${colName}"`)
if (field === 'name') {
const dbCol = Prisma.raw(`a."name"`)
const valStr = String(value)
switch (operator) {
case 'eq':
@@ -271,6 +265,7 @@ export class SqlQueryBuilder {
}
if (field === 'sizeByte' || field === 'size_byte') {
const dbCol = Prisma.raw(`a."size_byte"`)
const valNum = Number(value)
switch (operator) {
case 'eq':
@@ -296,12 +291,17 @@ export class SqlQueryBuilder {
field === 'created_at' ||
field === 'updated_at'
) {
const valDate = this.toDate(value)
const colName = field === 'createdAt' || field === 'created_at' ? 'created_at' : 'updated_at'
const dbCol = Prisma.raw(`a."${colName}"`)
switch (operator) {
case 'eq':
return Prisma.sql`${dbCol} = ${valDate}`
case 'neq':
return Prisma.sql`${dbCol} != ${valDate}`
case 'eq': {
const range = this.parseDateRange(value)
return Prisma.sql`${dbCol} >= ${range.start} AND ${dbCol} <= ${range.end}`
}
case 'neq': {
const range = this.parseDateRange(value)
return Prisma.sql`(${dbCol} < ${range.start} OR ${dbCol} > ${range.end})`
}
case 'gt':
return Prisma.sql`${dbCol} > ${this.toDateBound(value, 'end')}`
case 'gte':
@@ -333,14 +333,42 @@ export class SqlQueryBuilder {
const matchSql = this.buildEavValueMatch(value)
return Prisma.sql`a.id NOT IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field}) OR a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND NOT (${matchSql}))`
}
case 'gt':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND (number_value > ${Number(value)} OR date_value > ${this.toDateBound(value, 'end')}))`
case 'gte':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND (number_value >= ${Number(value)} OR date_value >= ${this.toDateBound(value, 'start')}))`
case 'lt':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND (number_value < ${Number(value)} OR date_value < ${this.toDateBound(value, 'start')}))`
case 'lte':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND (number_value <= ${Number(value)} OR date_value <= ${this.toDateBound(value, 'end')}))`
case 'gt': {
if (
typeof value === 'number' ||
(typeof value === 'string' && !isNaN(Number(value)) && !this.isDate(value))
) {
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND number_value > ${Number(value)})`
}
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND date_value > ${this.toDateBound(value, 'end')})`
}
case 'gte': {
if (
typeof value === 'number' ||
(typeof value === 'string' && !isNaN(Number(value)) && !this.isDate(value))
) {
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND number_value >= ${Number(value)})`
}
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND date_value >= ${this.toDateBound(value, 'start')})`
}
case 'lt': {
if (
typeof value === 'number' ||
(typeof value === 'string' && !isNaN(Number(value)) && !this.isDate(value))
) {
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND number_value < ${Number(value)})`
}
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND date_value < ${this.toDateBound(value, 'start')})`
}
case 'lte': {
if (
typeof value === 'number' ||
(typeof value === 'string' && !isNaN(Number(value)) && !this.isDate(value))
) {
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND number_value <= ${Number(value)})`
}
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND date_value <= ${this.toDateBound(value, 'end')})`
}
case 'contains':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND string_value ILIKE ${'%' + String(value) + '%'})`
case 'notContains':
+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(),
}
+49 -1
View File
@@ -3,6 +3,7 @@ import { transcodeService } from './transcode'
import { s3Service } from '@shumai/core/src/s3/s3'
import * as path from 'path'
import * as child_process from 'child_process'
import { execFile } from 'child_process'
import * as fs from 'fs'
import { WorkflowTask } from '@shumai/db'
import { setupTestDbHooks } from '@shumai/db/test'
@@ -24,6 +25,7 @@ vi.mock('child_process', () => ({
vi.mock('sharp', () => {
const mockSharp = {
resize: vi.fn().mockReturnThis(),
toColorspace: vi.fn().mockReturnThis(),
webp: vi.fn().mockReturnThis(),
composite: vi.fn().mockReturnThis(),
toBuffer: vi.fn().mockResolvedValue(Buffer.from('fake-webp-buffer')),
@@ -182,17 +184,62 @@ describe('TranscodeService', () => {
)
})
it('should use sharp for image transcoding', async () => {
it('should use sharp for image transcoding with sRGB conversion', async () => {
const outputFile = path.join(tempDir, 'output.webp')
await transcodeService.transcodeImage('input.png', outputFile, 480, 80)
expect(sharp).toHaveBeenCalledWith('input.png', { limitInputPixels: false })
const mockSharp = vi.mocked(sharp).mock.results[0].value
expect(mockSharp.toColorspace).toHaveBeenCalledWith('srgb')
expect(mockSharp.resize).toHaveBeenCalledWith(480, 7680, expect.any(Object))
expect(mockSharp.webp).toHaveBeenCalledWith({ quality: 80 })
expect(mockSharp.toFile).toHaveBeenCalledWith(outputFile)
})
it('should use ImageMagick for PSD image transcoding', async () => {
const outputFile = path.join(tempDir, 'output_psd.webp')
const psdBuffer = Buffer.from('8BPS-fake-psd-content')
await transcodeService.transcodeImage(psdBuffer, outputFile, 480, 80)
expect(execFile).toHaveBeenCalledWith(
'magick',
expect.arrayContaining([
'-colorspace',
'sRGB',
expect.stringContaining('[0]'),
'-quality',
'80',
]),
expect.any(Function),
)
})
it('should get PSD image info using ImageMagick identify', async () => {
const mockExecFile = vi.mocked(execFile)
mockExecFile.mockImplementation((cmd: unknown, args: unknown, callback: unknown) => {
const cb = callback as (
err: Error | null,
result: { stdout: string; stderr: string },
extra: string,
) => void
const argsArr = args as string[] | undefined
if (cmd === 'magick' && argsArr && argsArr[0] === 'identify') {
cb(null, { stdout: '1920 1080\n', stderr: '' }, '')
} else if (typeof cb === 'function') {
cb(null, { stdout: '', stderr: '' }, '')
}
return {} as ReturnType<typeof execFile>
})
const psdPath = path.join(tempDir, 'sample.psd')
fs.writeFileSync(psdPath, '8BPS-sample')
const info = await transcodeService.getImageInfo(psdPath)
expect(info.originalWidth).toBe(1920)
expect(info.originalHeight).toBe(1080)
expect(info.mimeType).toBe('psd')
})
it('should fetch image if input is a URL', async () => {
const mockBuffer = Buffer.from('fake-image-data')
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -215,6 +262,7 @@ describe('TranscodeService', () => {
expect(sharp).toHaveBeenCalledWith(inputBuffer, { limitInputPixels: false })
const mockSharp = vi.mocked(sharp).mock.results[vi.mocked(sharp).mock.results.length - 1].value
expect(mockSharp.toColorspace).toHaveBeenCalledWith('srgb')
expect(mockSharp.resize).toHaveBeenCalledWith(480, 7680, expect.any(Object))
expect(mockSharp.webp).toHaveBeenCalledWith({ quality: 80 })
expect(mockSharp.toFile).toHaveBeenCalledWith(outputFile)
+135 -3
View File
@@ -120,9 +120,69 @@ export interface ExtractVideoFramesParams {
isImage: boolean
}
export function isPsdInput(input: string | Buffer): boolean {
if (typeof input === 'string') {
if (input.toLowerCase().endsWith('.psd')) return true
if (fs.existsSync(input)) {
try {
const fd = fs.openSync(input, 'r')
const buf = Buffer.alloc(4)
fs.readSync(fd, buf, 0, 4, 0)
fs.closeSync(fd)
return buf.toString('ascii') === '8BPS'
} catch {
return false
}
}
return false
}
return (
input.length >= 4 &&
input[0] === 0x38 &&
input[1] === 0x42 &&
input[2] === 0x50 &&
input[3] === 0x53
)
}
export class TranscodeService {
constructor(private readonly prismaClient: typeof prisma = prisma) {}
private async execImageMagick(args: string[]): Promise<{ stdout: string; stderr: string }> {
try {
return await execFileAsync('magick', args)
} catch (err: unknown) {
const code = (err as Record<string, unknown>)?.code
if (code === 'ENOENT') {
return await execFileAsync('convert', args)
}
throw err
}
}
private async execImageMagickIdentify(
filePath: string,
): Promise<{ width: number; height: number }> {
const fileArg = `${filePath}[0]`
let stdout: string
try {
const res = await execFileAsync('magick', ['identify', '-format', '%w %h', fileArg])
stdout = res.stdout
} catch (err: unknown) {
const code = (err as Record<string, unknown>)?.code
if (code === 'ENOENT') {
const res = await execFileAsync('identify', ['-format', '%w %h', fileArg])
stdout = res.stdout
} else {
throw err
}
}
const parts = stdout.trim().split(/\s+/)
const width = parseInt(parts[0], 10) || 0
const height = parseInt(parts[1], 10) || 0
return { width, height }
}
private resolveCodecName(stream: {
/* eslint-disable @typescript-eslint/naming-convention */
codec_name?: string
@@ -222,6 +282,8 @@ export class TranscodeService {
async getImageInfo(inputFile: string): Promise<MediaMetadata> {
let input: string | Buffer = inputFile
let tempDirToCleanup: string | null = null
if (inputFile.startsWith('http')) {
const resp = await fetch(inputFile)
if (!resp.ok) {
@@ -230,6 +292,38 @@ export class TranscodeService {
input = Buffer.from(await resp.arrayBuffer())
}
if (isPsdInput(input)) {
let psdPath: string
if (typeof input === 'string') {
psdPath = input
} else {
tempDirToCleanup = this.createTempDir('psd-info-')
psdPath = path.join(tempDirToCleanup, 'input.psd')
fs.writeFileSync(psdPath, input)
}
try {
const { width, height } = await this.execImageMagickIdentify(psdPath)
return {
originalWidth: width,
originalHeight: height,
duration: 0,
bitRate: 0,
frameRate: 0,
totalFrames: 0,
startTimecode: undefined,
hasAudio: false,
mimeType: 'psd',
}
} catch (err) {
console.warn('ImageMagick identify failed for PSD, falling back to sharp:', err)
} finally {
if (tempDirToCleanup) {
this.removeDir(tempDirToCleanup)
}
}
}
const metadata = await sharp(input, { limitInputPixels: false }).metadata()
return {
originalWidth: metadata.width || 0,
@@ -309,13 +403,48 @@ export class TranscodeService {
input = Buffer.from(await resp.arrayBuffer())
}
const sharpInstance = sharp(input, { limitInputPixels: false })
const WEBP_MAX_DIMENSION = 7680
const targetW = width > 0 ? Math.min(width, WEBP_MAX_DIMENSION) : WEBP_MAX_DIMENSION
const targetH = height && height > 0 ? Math.min(height, WEBP_MAX_DIMENSION) : WEBP_MAX_DIMENSION
sharpInstance.resize(targetW, targetH, {
if (isPsdInput(input)) {
let psdPath: string
let tempDirToCleanup: string | null = null
if (typeof input === 'string') {
psdPath = input
} else {
tempDirToCleanup = this.createTempDir('psd-transcode-')
psdPath = path.join(tempDirToCleanup, 'input.psd')
fs.writeFileSync(psdPath, input)
}
try {
const resizeGeometry =
targetH < WEBP_MAX_DIMENSION
? `${targetW}x${targetH}>`
: `${targetW}x${WEBP_MAX_DIMENSION}>`
await this.execImageMagick([
`${psdPath}[0]`,
'-colorspace',
'sRGB',
'-resize',
resizeGeometry,
'-quality',
quality.toString(),
outputFile,
])
return
} finally {
if (tempDirToCleanup) {
this.removeDir(tempDirToCleanup)
}
}
}
const sharpInstance = sharp(input, { limitInputPixels: false })
sharpInstance.toColorspace('srgb').resize(targetW, targetH, {
withoutEnlargement: true,
fit: 'inside',
})
@@ -430,6 +559,7 @@ export class TranscodeService {
await execFileAsync('ffmpeg', ['-y', '-loglevel', 'warning', ...spriteArgs])
await sharp(firstPagePath, { limitInputPixels: false })
.toColorspace('srgb')
.resize(480, null, { withoutEnlargement: true, fit: 'inside' })
.webp({ quality: 75 })
.toFile(outputPoster)
@@ -926,6 +1056,7 @@ export class TranscodeService {
const webpName = `${stem}-page-${pageNum}-${ulid()}.webp`
let webpBuffer = await sharp(localPngPath, { limitInputPixels: false })
.toColorspace('srgb')
.resize(1920, 1080, { fit: 'inside', withoutEnlargement: false })
.webp({ quality: 85 })
.toBuffer()
@@ -973,6 +1104,7 @@ export class TranscodeService {
const svgStr = renderAnnotationsToSvg(width, height, annotations)
return await sharp(imageBuffer, { limitInputPixels: false })
.composite([{ input: Buffer.from(svgStr), top: 0, left: 0 }])
.toColorspace('srgb')
.resize(16383, 16383, { fit: 'inside', withoutEnlargement: true })
.webp({ quality: 85 })
.toBuffer()
+7
View File
@@ -27,6 +27,11 @@ describe('detectSupportedMimeType', () => {
expect(detectSupportedMimeType(buffer)).toBe('image/webp')
})
it('should detect PSD', () => {
const buffer = new Uint8Array([0x38, 0x42, 0x50, 0x53, 0x00, 0x01])
expect(detectSupportedMimeType(buffer)).toBe('image/vnd.adobe.photoshop')
})
it('should detect MP4', () => {
const buffer = new Uint8Array([
0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x69, 0x73, 0x6f, 0x6d,
@@ -44,6 +49,8 @@ describe('getProxyType', () => {
it('should detect image proxyType', () => {
expect(getProxyType('image/png', 'test.png')).toBe('image')
expect(getProxyType('image/jpeg', 'photo.jpg')).toBe('image')
expect(getProxyType('image/vnd.adobe.photoshop', 'design.psd')).toBe('image')
expect(getProxyType(null, 'design.psd')).toBe('image')
})
it('should detect video proxyType', () => {
+4 -1
View File
@@ -7,7 +7,7 @@ export function getProxyType(
const lowerMediaType = mediaType?.toLowerCase() || ''
const lowerFilename = filename?.toLowerCase() || ''
if (lowerMediaType.startsWith('image/')) return 'image'
if (lowerMediaType.startsWith('image/') || lowerFilename.endsWith('.psd')) return 'image'
if (lowerMediaType.startsWith('video/')) return 'video'
if (lowerMediaType.startsWith('audio/')) return 'audio'
@@ -32,6 +32,9 @@ export function getProxyType(
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]
export function detectSupportedMimeType(buffer: Uint8Array): string | null {
if (startsWithAscii(buffer, 0, '8BPS')) {
return 'image/vnd.adobe.photoshop'
}
if (startsWith(buffer, [0xff, 0xd8, 0xff])) {
return buffer[3] === 0xf7 ? null : 'image/jpeg'
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/db",
"version": "0.2.0",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "skills" ADD COLUMN "permission" "TeamMemberRole" NOT NULL DEFAULT 'reviewer';
@@ -0,0 +1,28 @@
-- CreateTable
CREATE TABLE "ai_usages" (
"id" TEXT NOT NULL,
"team_id" TEXT NOT NULL,
"user_id" TEXT,
"period_start" TIMESTAMP(3) NOT NULL,
"input_tokens" INTEGER NOT NULL DEFAULT 0,
"output_tokens" INTEGER NOT NULL DEFAULT 0,
"cache_read_tokens" INTEGER NOT NULL DEFAULT 0,
"total_tokens" INTEGER NOT NULL DEFAULT 0,
"cost" DOUBLE PRECISION NOT NULL DEFAULT 0,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ai_usages_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "ai_usages_team_id_period_start_idx" ON "ai_usages"("team_id", "period_start");
-- CreateIndex
CREATE INDEX "ai_usages_team_id_user_id_period_start_idx" ON "ai_usages"("team_id", "user_id", "period_start");
-- AddForeignKey
ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[team_id,user_id,period_start]` on the table `ai_usages` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "ai_usages_team_id_user_id_period_start_key" ON "ai_usages"("team_id", "user_id", "period_start");
+26
View File
@@ -155,6 +155,7 @@ model User {
collections Collection[] @relation("UserToCollection")
shareLinks ShareLink[] @relation("UserToShareLink")
apiTokens ApiToken[] @relation("UserToApiToken")
aiUsages AiUsage[] @relation("UserToAiUsage")
@@map("users")
}
@@ -237,6 +238,7 @@ model Team {
skills Skill[] @relation("TeamToSkill")
sandbox Sandbox? @relation("TeamToSandbox")
agents Agent[] @relation("TeamToAgent")
aiUsages AiUsage[] @relation("TeamToAiUsage")
@@map("teams")
}
@@ -262,6 +264,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")
@@ -813,3 +816,26 @@ model ApiToken {
@@map("api_tokens")
}
model AiUsage {
id String @id @default(ulid())
teamId String @map("team_id")
userId String? @map("user_id")
periodStart DateTime @map("period_start")
inputTokens Int @default(0) @map("input_tokens")
outputTokens Int @default(0) @map("output_tokens")
cacheReadTokens Int @default(0) @map("cache_read_tokens")
totalTokens Int @default(0) @map("total_tokens")
cost Float @default(0) @map("cost")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
team Team @relation("TeamToAiUsage", fields: [teamId], references: [id], onDelete: Cascade)
user User? @relation("UserToAiUsage", fields: [userId], references: [id], onDelete: SetNull)
@@map("ai_usages")
@@unique([teamId, userId, periodStart])
@@index([teamId, periodStart])
@@index([teamId, userId, periodStart])
}
+5
View File
@@ -182,3 +182,8 @@ export type Collection = Prisma.CollectionModel
*
*/
export type ApiToken = Prisma.ApiTokenModel
/**
* Model AiUsage
*
*/
export type AiUsage = Prisma.AiUsageModel
+5
View File
@@ -206,3 +206,8 @@ export type Collection = Prisma.CollectionModel
*
*/
export type ApiToken = Prisma.ApiTokenModel
/**
* Model AiUsage
*
*/
export type AiUsage = Prisma.AiUsageModel
+57 -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>
@@ -643,6 +643,33 @@ export type EnumAgentSessionTypeWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedEnumAgentSessionTypeFilter<$PrismaModel>
}
export type FloatFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
not?: Prisma.NestedFloatFilter<$PrismaModel> | number
}
export type FloatWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
not?: Prisma.NestedFloatWithAggregatesFilter<$PrismaModel> | number
_count?: Prisma.NestedIntFilter<$PrismaModel>
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
_sum?: Prisma.NestedFloatFilter<$PrismaModel>
_min?: Prisma.NestedFloatFilter<$PrismaModel>
_max?: Prisma.NestedFloatFilter<$PrismaModel>
}
export type NestedStringFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
@@ -838,13 +865,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 +875,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>
@@ -1218,4 +1245,20 @@ export type NestedEnumAgentSessionTypeWithAggregatesFilter<$PrismaModel = never>
_max?: Prisma.NestedEnumAgentSessionTypeFilter<$PrismaModel>
}
export type NestedFloatWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
not?: Prisma.NestedFloatWithAggregatesFilter<$PrismaModel> | number
_count?: Prisma.NestedIntFilter<$PrismaModel>
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
_sum?: Prisma.NestedFloatFilter<$PrismaModel>
_min?: Prisma.NestedFloatFilter<$PrismaModel>
_max?: Prisma.NestedFloatFilter<$PrismaModel>
}
File diff suppressed because one or more lines are too long
+96 -2
View File
@@ -416,7 +416,8 @@ export const ModelName = {
Model: 'Model',
Provider: 'Provider',
Collection: 'Collection',
ApiToken: 'ApiToken'
ApiToken: 'ApiToken',
AiUsage: 'AiUsage'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -432,7 +433,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
omit: GlobalOmitOptions
}
meta: {
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "asset" | "storageKey" | "assetMetadataValue" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken"
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "asset" | "storageKey" | "assetMetadataValue" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage"
txIsolationLevel: TransactionIsolationLevel
}
model: {
@@ -2878,6 +2879,80 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
AiUsage: {
payload: Prisma.$AiUsagePayload<ExtArgs>
fields: Prisma.AiUsageFieldRefs
operations: {
findUnique: {
args: Prisma.AiUsageFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload> | null
}
findUniqueOrThrow: {
args: Prisma.AiUsageFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
findFirst: {
args: Prisma.AiUsageFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload> | null
}
findFirstOrThrow: {
args: Prisma.AiUsageFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
findMany: {
args: Prisma.AiUsageFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
}
create: {
args: Prisma.AiUsageCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
createMany: {
args: Prisma.AiUsageCreateManyArgs<ExtArgs>
result: BatchPayload
}
createManyAndReturn: {
args: Prisma.AiUsageCreateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
}
delete: {
args: Prisma.AiUsageDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
update: {
args: Prisma.AiUsageUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
deleteMany: {
args: Prisma.AiUsageDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.AiUsageUpdateManyArgs<ExtArgs>
result: BatchPayload
}
updateManyAndReturn: {
args: Prisma.AiUsageUpdateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
}
upsert: {
args: Prisma.AiUsageUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
aggregate: {
args: Prisma.AiUsageAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateAiUsage>
}
groupBy: {
args: Prisma.AiUsageGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AiUsageGroupByOutputType>[]
}
count: {
args: Prisma.AiUsageCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AiUsageCountAggregateOutputType> | number
}
}
}
}
} & {
other: {
@@ -3022,6 +3097,7 @@ export const SkillScalarFieldEnum = {
config: 'config',
assetId: 'assetId',
hash: 'hash',
permission: 'permission',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
teamId: 'teamId'
@@ -3391,6 +3467,23 @@ export const ApiTokenScalarFieldEnum = {
export type ApiTokenScalarFieldEnum = (typeof ApiTokenScalarFieldEnum)[keyof typeof ApiTokenScalarFieldEnum]
export const AiUsageScalarFieldEnum = {
id: 'id',
teamId: 'teamId',
userId: 'userId',
periodStart: 'periodStart',
inputTokens: 'inputTokens',
outputTokens: 'outputTokens',
cacheReadTokens: 'cacheReadTokens',
totalTokens: 'totalTokens',
cost: 'cost',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
@@ -3888,6 +3981,7 @@ export type GlobalOmitConfig = {
provider?: Prisma.ProviderOmit
collection?: Prisma.CollectionOmit
apiToken?: Prisma.ApiTokenOmit
aiUsage?: Prisma.AiUsageOmit
}
/* Types for Logging */
@@ -83,7 +83,8 @@ export const ModelName = {
Model: 'Model',
Provider: 'Provider',
Collection: 'Collection',
ApiToken: 'ApiToken'
ApiToken: 'ApiToken',
AiUsage: 'AiUsage'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -207,6 +208,7 @@ export const SkillScalarFieldEnum = {
config: 'config',
assetId: 'assetId',
hash: 'hash',
permission: 'permission',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
teamId: 'teamId'
@@ -576,6 +578,23 @@ export const ApiTokenScalarFieldEnum = {
export type ApiTokenScalarFieldEnum = (typeof ApiTokenScalarFieldEnum)[keyof typeof ApiTokenScalarFieldEnum]
export const AiUsageScalarFieldEnum = {
id: 'id',
teamId: 'teamId',
userId: 'userId',
periodStart: 'periodStart',
inputTokens: 'inputTokens',
outputTokens: 'outputTokens',
cacheReadTokens: 'cacheReadTokens',
totalTokens: 'totalTokens',
cost: 'cost',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
+1
View File
@@ -41,4 +41,5 @@ export type * from './models/Model.ts'
export type * from './models/Provider.ts'
export type * from './models/Collection.ts'
export type * from './models/ApiToken.ts'
export type * from './models/AiUsage.ts'
export type * from './commonInputTypes.ts'
File diff suppressed because it is too large Load Diff
+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'>
+194
View File
@@ -199,6 +199,7 @@ export type TeamWhereInput = {
skills?: Prisma.SkillListRelationFilter
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
agents?: Prisma.AgentListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}
export type TeamOrderByWithRelationInput = {
@@ -219,6 +220,7 @@ export type TeamOrderByWithRelationInput = {
skills?: Prisma.SkillOrderByRelationAggregateInput
sandbox?: Prisma.SandboxOrderByWithRelationInput
agents?: Prisma.AgentOrderByRelationAggregateInput
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
}
export type TeamWhereUniqueInput = Prisma.AtLeast<{
@@ -242,6 +244,7 @@ export type TeamWhereUniqueInput = Prisma.AtLeast<{
skills?: Prisma.SkillListRelationFilter
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
agents?: Prisma.AgentListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}, "id" | "rootFolderId">
export type TeamOrderByWithAggregationInput = {
@@ -285,6 +288,7 @@ export type TeamCreateInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateInput = {
@@ -304,6 +308,7 @@ export type TeamUncheckedCreateInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamUpdateInput = {
@@ -323,6 +328,7 @@ export type TeamUpdateInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateInput = {
@@ -342,6 +348,7 @@ export type TeamUncheckedUpdateInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateManyInput = {
@@ -579,6 +586,20 @@ export type TeamUpdateOneRequiredWithoutProvidersNestedInput = {
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutProvidersInput, Prisma.TeamUpdateWithoutProvidersInput>, Prisma.TeamUncheckedUpdateWithoutProvidersInput>
}
export type TeamCreateNestedOneWithoutAiUsagesInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAiUsagesInput
connect?: Prisma.TeamWhereUniqueInput
}
export type TeamUpdateOneRequiredWithoutAiUsagesNestedInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAiUsagesInput
upsert?: Prisma.TeamUpsertWithoutAiUsagesInput
connect?: Prisma.TeamWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutAiUsagesInput, Prisma.TeamUpdateWithoutAiUsagesInput>, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
}
export type TeamCreateWithoutSandboxInput = {
id?: string
name: string
@@ -595,6 +616,7 @@ export type TeamCreateWithoutSandboxInput = {
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutSandboxInput = {
@@ -613,6 +635,7 @@ export type TeamUncheckedCreateWithoutSandboxInput = {
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutSandboxInput = {
@@ -647,6 +670,7 @@ export type TeamUpdateWithoutSandboxInput = {
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutSandboxInput = {
@@ -665,6 +689,7 @@ export type TeamUncheckedUpdateWithoutSandboxInput = {
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutSkillsInput = {
@@ -683,6 +708,7 @@ export type TeamCreateWithoutSkillsInput = {
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutSkillsInput = {
@@ -701,6 +727,7 @@ export type TeamUncheckedCreateWithoutSkillsInput = {
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutSkillsInput = {
@@ -735,6 +762,7 @@ export type TeamUpdateWithoutSkillsInput = {
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutSkillsInput = {
@@ -753,6 +781,7 @@ export type TeamUncheckedUpdateWithoutSkillsInput = {
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutMembersInput = {
@@ -771,6 +800,7 @@ export type TeamCreateWithoutMembersInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutMembersInput = {
@@ -789,6 +819,7 @@ export type TeamUncheckedCreateWithoutMembersInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutMembersInput = {
@@ -823,6 +854,7 @@ export type TeamUpdateWithoutMembersInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutMembersInput = {
@@ -841,6 +873,7 @@ export type TeamUncheckedUpdateWithoutMembersInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutProjectsInput = {
@@ -859,6 +892,7 @@ export type TeamCreateWithoutProjectsInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutProjectsInput = {
@@ -877,6 +911,7 @@ export type TeamUncheckedCreateWithoutProjectsInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutProjectsInput = {
@@ -911,6 +946,7 @@ export type TeamUpdateWithoutProjectsInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutProjectsInput = {
@@ -929,6 +965,7 @@ export type TeamUncheckedUpdateWithoutProjectsInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutRootFolderInput = {
@@ -947,6 +984,7 @@ export type TeamCreateWithoutRootFolderInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutRootFolderInput = {
@@ -965,6 +1003,7 @@ export type TeamUncheckedCreateWithoutRootFolderInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutRootFolderInput = {
@@ -999,6 +1038,7 @@ export type TeamUpdateWithoutRootFolderInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutRootFolderInput = {
@@ -1017,6 +1057,7 @@ export type TeamUncheckedUpdateWithoutRootFolderInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutInvitesInput = {
@@ -1035,6 +1076,7 @@ export type TeamCreateWithoutInvitesInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutInvitesInput = {
@@ -1053,6 +1095,7 @@ export type TeamUncheckedCreateWithoutInvitesInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutInvitesInput = {
@@ -1087,6 +1130,7 @@ export type TeamUpdateWithoutInvitesInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutInvitesInput = {
@@ -1105,6 +1149,7 @@ export type TeamUncheckedUpdateWithoutInvitesInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutMetadataFieldsInput = {
@@ -1123,6 +1168,7 @@ export type TeamCreateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
@@ -1141,6 +1187,7 @@ export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutMetadataFieldsInput = {
@@ -1175,6 +1222,7 @@ export type TeamUpdateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
@@ -1193,6 +1241,7 @@ export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutNotificationsInput = {
@@ -1211,6 +1260,7 @@ export type TeamCreateWithoutNotificationsInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutNotificationsInput = {
@@ -1229,6 +1279,7 @@ export type TeamUncheckedCreateWithoutNotificationsInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutNotificationsInput = {
@@ -1263,6 +1314,7 @@ export type TeamUpdateWithoutNotificationsInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutNotificationsInput = {
@@ -1281,6 +1333,7 @@ export type TeamUncheckedUpdateWithoutNotificationsInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutAgentsInput = {
@@ -1299,6 +1352,7 @@ export type TeamCreateWithoutAgentsInput = {
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutAgentsInput = {
@@ -1317,6 +1371,7 @@ export type TeamUncheckedCreateWithoutAgentsInput = {
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutAgentsInput = {
@@ -1351,6 +1406,7 @@ export type TeamUpdateWithoutAgentsInput = {
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutAgentsInput = {
@@ -1369,6 +1425,7 @@ export type TeamUncheckedUpdateWithoutAgentsInput = {
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutUserMetadataInput = {
@@ -1387,6 +1444,7 @@ export type TeamCreateWithoutUserMetadataInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutUserMetadataInput = {
@@ -1405,6 +1463,7 @@ export type TeamUncheckedCreateWithoutUserMetadataInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutUserMetadataInput = {
@@ -1439,6 +1498,7 @@ export type TeamUpdateWithoutUserMetadataInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutUserMetadataInput = {
@@ -1457,6 +1517,7 @@ export type TeamUncheckedUpdateWithoutUserMetadataInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutProvidersInput = {
@@ -1475,6 +1536,7 @@ export type TeamCreateWithoutProvidersInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutProvidersInput = {
@@ -1493,6 +1555,7 @@ export type TeamUncheckedCreateWithoutProvidersInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutProvidersInput = {
@@ -1527,6 +1590,7 @@ export type TeamUpdateWithoutProvidersInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutProvidersInput = {
@@ -1545,6 +1609,99 @@ export type TeamUncheckedUpdateWithoutProvidersInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutAiUsagesInput = {
id?: string
name: string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Date | string
updatedAt?: Date | string
rootFolder?: Prisma.AssetCreateNestedOneWithoutTeamRootFolderInput
members?: Prisma.TeamMemberCreateNestedManyWithoutTeamInput
projects?: Prisma.ProjectCreateNestedManyWithoutTeamInput
metadataFields?: Prisma.MetadataFieldCreateNestedManyWithoutTeamInput
invites?: Prisma.InviteCreateNestedManyWithoutTeamInput
notifications?: Prisma.NotificationCreateNestedManyWithoutTeamInput
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutTeamInput
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutAiUsagesInput = {
id?: string
name: string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Date | string
updatedAt?: Date | string
rootFolderId?: string | null
members?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutTeamInput
projects?: Prisma.ProjectUncheckedCreateNestedManyWithoutTeamInput
metadataFields?: Prisma.MetadataFieldUncheckedCreateNestedManyWithoutTeamInput
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutTeamInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutTeamInput
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutTeamInput
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutAiUsagesInput = {
where: Prisma.TeamWhereUniqueInput
create: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
}
export type TeamUpsertWithoutAiUsagesInput = {
update: Prisma.XOR<Prisma.TeamUpdateWithoutAiUsagesInput, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
create: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
where?: Prisma.TeamWhereInput
}
export type TeamUpdateToOneWithWhereWithoutAiUsagesInput = {
where?: Prisma.TeamWhereInput
data: Prisma.XOR<Prisma.TeamUpdateWithoutAiUsagesInput, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
}
export type TeamUpdateWithoutAiUsagesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
name?: Prisma.StringFieldUpdateOperationsInput | string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
rootFolder?: Prisma.AssetUpdateOneWithoutTeamRootFolderNestedInput
members?: Prisma.TeamMemberUpdateManyWithoutTeamNestedInput
projects?: Prisma.ProjectUpdateManyWithoutTeamNestedInput
metadataFields?: Prisma.MetadataFieldUpdateManyWithoutTeamNestedInput
invites?: Prisma.InviteUpdateManyWithoutTeamNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutTeamNestedInput
userMetadata?: Prisma.UserMetadataUpdateManyWithoutTeamNestedInput
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutAiUsagesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
name?: Prisma.StringFieldUpdateOperationsInput | string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
rootFolderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
members?: Prisma.TeamMemberUncheckedUpdateManyWithoutTeamNestedInput
projects?: Prisma.ProjectUncheckedUpdateManyWithoutTeamNestedInput
metadataFields?: Prisma.MetadataFieldUncheckedUpdateManyWithoutTeamNestedInput
invites?: Prisma.InviteUncheckedUpdateManyWithoutTeamNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutTeamNestedInput
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutTeamNestedInput
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
}
@@ -1562,6 +1719,7 @@ export type TeamCountOutputType = {
providers: number
skills: number
agents: number
aiUsages: number
}
export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -1574,6 +1732,7 @@ export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
providers?: boolean | TeamCountOutputTypeCountProvidersArgs
skills?: boolean | TeamCountOutputTypeCountSkillsArgs
agents?: boolean | TeamCountOutputTypeCountAgentsArgs
aiUsages?: boolean | TeamCountOutputTypeCountAiUsagesArgs
}
/**
@@ -1649,6 +1808,13 @@ export type TeamCountOutputTypeCountAgentsArgs<ExtArgs extends runtime.Types.Ext
where?: Prisma.AgentWhereInput
}
/**
* TeamCountOutputType without action
*/
export type TeamCountOutputTypeCountAiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.AiUsageWhereInput
}
export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -1668,6 +1834,7 @@ export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
skills?: boolean | Prisma.Team$skillsArgs<ExtArgs>
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["team"]>
@@ -1713,6 +1880,7 @@ export type TeamInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
skills?: boolean | Prisma.Team$skillsArgs<ExtArgs>
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
}
export type TeamIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -1736,6 +1904,7 @@ export type $TeamPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
skills: Prisma.$SkillPayload<ExtArgs>[]
sandbox: Prisma.$SandboxPayload<ExtArgs> | null
agents: Prisma.$AgentPayload<ExtArgs>[]
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -2152,6 +2321,7 @@ export interface Prisma__TeamClient<T, Null = never, ExtArgs extends runtime.Typ
skills<T extends Prisma.Team$skillsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$skillsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SkillPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
sandbox<T extends Prisma.Team$sandboxArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$sandboxArgs<ExtArgs>>): Prisma.Prisma__SandboxClient<runtime.Types.Result.GetResult<Prisma.$SandboxPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
agents<T extends Prisma.Team$agentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$agentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AgentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
aiUsages<T extends Prisma.Team$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -2841,6 +3011,30 @@ export type Team$agentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArg
distinct?: Prisma.AgentScalarFieldEnum | Prisma.AgentScalarFieldEnum[]
}
/**
* Team.aiUsages
*/
export type Team$aiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the AiUsage
*/
select?: Prisma.AiUsageSelect<ExtArgs> | null
/**
* Omit specific fields from the AiUsage
*/
omit?: Prisma.AiUsageOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.AiUsageInclude<ExtArgs> | null
where?: Prisma.AiUsageWhereInput
orderBy?: Prisma.AiUsageOrderByWithRelationInput | Prisma.AiUsageOrderByWithRelationInput[]
cursor?: Prisma.AiUsageWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.AiUsageScalarFieldEnum | Prisma.AiUsageScalarFieldEnum[]
}
/**
* Team without action
*/
-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
}

Some files were not shown because too many files have changed in this diff Show More