@gedatou/cadenza-ai 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/anthropic-DdrANeO1.mjs +236 -0
- package/dist/bedrock-534H9yfk.mjs +75 -0
- package/dist/catalog-CvvS2JaW.mjs +32 -0
- package/dist/deepseek-C1b74T2F.mjs +55 -0
- package/dist/gemini-DcJ5Kr3h.mjs +229 -0
- package/dist/grok-CffQuBd6.mjs +77 -0
- package/dist/groq-Ba6TTYLp.mjs +98 -0
- package/dist/index.d.mts +1056 -0
- package/dist/index.mjs +2809 -0
- package/dist/llmgateway-Pt5CS6aQ.mjs +211 -0
- package/dist/mistral-BGMwwbU9.mjs +107 -0
- package/dist/mock/index.d.mts +168 -0
- package/dist/mock/index.mjs +467 -0
- package/dist/ollama-BBJs-3mK.mjs +80 -0
- package/dist/openai--FIeahIH.mjs +153 -0
- package/dist/openrouter-q-lx-2Cb.mjs +167 -0
- package/dist/preset-CEyIPxfS.mjs +157 -0
- package/dist/preset-DRT0T14q.d.mts +19 -0
- package/dist/providers/anthropic.d.mts +6 -0
- package/dist/providers/anthropic.mjs +11 -0
- package/dist/providers/bedrock.d.mts +6 -0
- package/dist/providers/bedrock.mjs +11 -0
- package/dist/providers/byteplus.d.mts +6 -0
- package/dist/providers/byteplus.mjs +21 -0
- package/dist/providers/deepseek.d.mts +35 -0
- package/dist/providers/deepseek.mjs +283 -0
- package/dist/providers/gemini.d.mts +6 -0
- package/dist/providers/gemini.mjs +11 -0
- package/dist/providers/grok.d.mts +6 -0
- package/dist/providers/grok.mjs +11 -0
- package/dist/providers/groq.d.mts +6 -0
- package/dist/providers/groq.mjs +11 -0
- package/dist/providers/llmgateway.d.mts +6 -0
- package/dist/providers/llmgateway.mjs +11 -0
- package/dist/providers/mistral.d.mts +6 -0
- package/dist/providers/mistral.mjs +11 -0
- package/dist/providers/ollama.d.mts +9 -0
- package/dist/providers/ollama.mjs +28 -0
- package/dist/providers/openai-compatible.d.mts +32 -0
- package/dist/providers/openai-compatible.mjs +45 -0
- package/dist/providers/openai.d.mts +6 -0
- package/dist/providers/openai.mjs +11 -0
- package/dist/providers/openrouter.d.mts +6 -0
- package/dist/providers/openrouter.mjs +11 -0
- package/dist/providers/vercel-gateway.d.mts +6 -0
- package/dist/providers/vercel-gateway.mjs +11 -0
- package/dist/providers/vertex.d.mts +6 -0
- package/dist/providers/vertex.mjs +11 -0
- package/dist/server/index.d.mts +173 -0
- package/dist/server/index.mjs +440 -0
- package/dist/thinking-CH2uL1dr.mjs +26 -0
- package/dist/types-56Hn7Qq2.d.mts +46 -0
- package/dist/vercel-gateway-DW3Z0Os1.mjs +109 -0
- package/dist/vertex-hg4Dt54O.mjs +20 -0
- package/package.json +114 -0
- package/styles.css +3 -0
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @gedatou/cadenza-ai
|
|
2
|
+
|
|
3
|
+
TanStack AI 的薄门面:`useChat` 等 React API 原样可用,provider 接入、思考强度、会话列表、
|
|
4
|
+
用量、附件与会话视图(基于 `@gedatou/cadenza-ui`)作为包默认提供。
|
|
5
|
+
|
|
6
|
+
**文档与交互 demo:<https://cadenza-ui-docs.vercel.app/docs/ai/conversation>**
|
|
7
|
+
|
|
8
|
+
## 用法
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add @gedatou/cadenza-ai @gedatou/cadenza-ui
|
|
12
|
+
pnpm add @tanstack/ai-openai # 用到哪家装哪家;adapter 都是 optional peer
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
// 客户端
|
|
17
|
+
import { fetchServerSentEvents, useChat } from '@gedatou/cadenza-ai'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// 服务端 route handler
|
|
22
|
+
import { openai } from '@gedatou/cadenza-ai/providers/openai'
|
|
23
|
+
import { createChatHandler } from '@gedatou/cadenza-ai/server'
|
|
24
|
+
|
|
25
|
+
export const { POST, GET } = createChatHandler({ providers: [openai] })
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
preset 一家一个子路径(只 import 自家 adapter):`openai` / `anthropic` / `gemini` / `openrouter` /
|
|
29
|
+
`grok` / `groq` / `mistral` / `vercel-gateway` / `llmgateway` / `bedrock` / `vertex` / `ollama` / `deepseek`;
|
|
30
|
+
`providers/openai-compatible` 的 `openaiCompatiblePreset(config)` 接任何 OpenAI 兼容端点;
|
|
31
|
+
`byteplus` 是占位。
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
// 无密钥的假流(demo / 测试)
|
|
35
|
+
import { useChat } from '@gedatou/cadenza-ai'
|
|
36
|
+
import { scripted, text } from '@gedatou/cadenza-ai/mock'
|
|
37
|
+
|
|
38
|
+
function Demo() {
|
|
39
|
+
const chat = useChat({ fetcher: scripted(() => [text('Hello')]) })
|
|
40
|
+
return <pre>{JSON.stringify(chat.messages)}</pre>
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
入口 CSS(streamdown 的样式与 KaTeX 都在里面;再让 Tailwind 扫到 streamdown 的产物):
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
@import "@gedatou/cadenza-ai/styles.css";
|
|
48
|
+
@source "../node_modules/streamdown/dist/*.js";
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 文档
|
|
52
|
+
|
|
53
|
+
- [会话](https://cadenza-ui-docs.vercel.app/docs/ai/conversation) — `useChat` 接线与 Transcript 家族
|
|
54
|
+
- [消息部件](https://cadenza-ui-docs.vercel.app/docs/ai/parts) — Markdown、推理、工具、审批、附件、来源、结构化输出
|
|
55
|
+
- [输入区](https://cadenza-ui-docs.vercel.app/docs/ai/composer) — 输入、附件、模型与思考强度、建议、排队、听写
|
|
56
|
+
- [会话列表](https://cadenza-ui-docs.vercel.app/docs/ai/threads) — 线程索引与本地持久化
|
|
57
|
+
- [接入提供者](https://cadenza-ui-docs.vercel.app/docs/ai/providers) — 目录、thinking 映射、BYOK、route handler
|
|
58
|
+
- [脚本化传输](https://cadenza-ui-docs.vercel.app/docs/ai/scripted) — `./mock` 的步骤 DSL
|
|
59
|
+
- [试玩](https://cadenza-ui-docs.vercel.app/docs/ai/playground) — 用自己的 key 跑真模型
|
|
60
|
+
|
|
61
|
+
## 与官方 API 的差异
|
|
62
|
+
|
|
63
|
+
- 根入口 `export * from '@tanstack/ai-react'`,不覆盖任何上游导出;本包新增的导出不与上游同名。
|
|
64
|
+
- 密钥走官方 BYOK relay 形态(浏览器 `x-byok-<id>` 头 → 你的 route handler),不做浏览器直连。
|
|
65
|
+
- 思考强度统一为七级 `ThinkingLevel`(`off | minimal | low | medium | high | xhigh | max`),
|
|
66
|
+
由各 provider preset 翻译成自己的 `modelOptions`。
|
|
67
|
+
- 服务端只从 `forwardedProps` 读 `provider` / `model` / `thinking` 三个键。
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
[MIT](../../LICENSE.md)
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { defineByokProvider } from "@tanstack/ai/byok";
|
|
2
|
+
//#region src/catalog/providers/anthropic.ts
|
|
3
|
+
const anthropic = {
|
|
4
|
+
id: "anthropic",
|
|
5
|
+
label: "Anthropic",
|
|
6
|
+
byok: defineByokProvider({
|
|
7
|
+
id: "anthropic",
|
|
8
|
+
label: "Anthropic",
|
|
9
|
+
env: "ANTHROPIC_API_KEY"
|
|
10
|
+
}),
|
|
11
|
+
keyRequired: true,
|
|
12
|
+
runtime: "node",
|
|
13
|
+
models: [
|
|
14
|
+
{
|
|
15
|
+
id: "claude-opus-5",
|
|
16
|
+
name: "Claude Opus 5",
|
|
17
|
+
provider: "anthropic",
|
|
18
|
+
input: [
|
|
19
|
+
"text",
|
|
20
|
+
"image",
|
|
21
|
+
"document"
|
|
22
|
+
],
|
|
23
|
+
reasoning: true,
|
|
24
|
+
contextWindow: 1e6,
|
|
25
|
+
maxOutputTokens: 128e3,
|
|
26
|
+
cost: {
|
|
27
|
+
input: 5,
|
|
28
|
+
output: 25,
|
|
29
|
+
cacheRead: .5
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "claude-opus-5-fast",
|
|
34
|
+
name: "Claude Opus 5 Fast",
|
|
35
|
+
provider: "anthropic",
|
|
36
|
+
input: [
|
|
37
|
+
"text",
|
|
38
|
+
"image",
|
|
39
|
+
"document"
|
|
40
|
+
],
|
|
41
|
+
reasoning: true,
|
|
42
|
+
contextWindow: 1e6,
|
|
43
|
+
maxOutputTokens: 128e3,
|
|
44
|
+
cost: {
|
|
45
|
+
input: 10,
|
|
46
|
+
output: 50,
|
|
47
|
+
cacheRead: 1
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "claude-sonnet-5",
|
|
52
|
+
name: "Claude Sonnet 5",
|
|
53
|
+
provider: "anthropic",
|
|
54
|
+
input: [
|
|
55
|
+
"text",
|
|
56
|
+
"image",
|
|
57
|
+
"document"
|
|
58
|
+
],
|
|
59
|
+
reasoning: true,
|
|
60
|
+
contextWindow: 1e6,
|
|
61
|
+
maxOutputTokens: 128e3,
|
|
62
|
+
cost: {
|
|
63
|
+
input: 3,
|
|
64
|
+
output: 15,
|
|
65
|
+
cacheRead: .3
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "claude-fable-5",
|
|
70
|
+
name: "Claude Fable 5",
|
|
71
|
+
provider: "anthropic",
|
|
72
|
+
input: [
|
|
73
|
+
"text",
|
|
74
|
+
"image",
|
|
75
|
+
"document"
|
|
76
|
+
],
|
|
77
|
+
reasoning: true,
|
|
78
|
+
contextWindow: 1e6,
|
|
79
|
+
maxOutputTokens: 128e3,
|
|
80
|
+
cost: {
|
|
81
|
+
input: 10,
|
|
82
|
+
output: 50,
|
|
83
|
+
cacheRead: 1
|
|
84
|
+
},
|
|
85
|
+
thinkingLevels: [
|
|
86
|
+
"low",
|
|
87
|
+
"medium",
|
|
88
|
+
"high",
|
|
89
|
+
"xhigh",
|
|
90
|
+
"max"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: "claude-opus-4-8",
|
|
95
|
+
name: "Claude Opus 4.8",
|
|
96
|
+
provider: "anthropic",
|
|
97
|
+
input: [
|
|
98
|
+
"text",
|
|
99
|
+
"image",
|
|
100
|
+
"document"
|
|
101
|
+
],
|
|
102
|
+
reasoning: true,
|
|
103
|
+
contextWindow: 1e6,
|
|
104
|
+
maxOutputTokens: 128e3,
|
|
105
|
+
cost: {
|
|
106
|
+
input: 5,
|
|
107
|
+
output: 25,
|
|
108
|
+
cacheRead: .5
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "claude-opus-4-7",
|
|
113
|
+
name: "Claude Opus 4.7",
|
|
114
|
+
provider: "anthropic",
|
|
115
|
+
input: [
|
|
116
|
+
"text",
|
|
117
|
+
"image",
|
|
118
|
+
"document"
|
|
119
|
+
],
|
|
120
|
+
reasoning: true,
|
|
121
|
+
contextWindow: 1e6,
|
|
122
|
+
maxOutputTokens: 128e3,
|
|
123
|
+
cost: {
|
|
124
|
+
input: 5,
|
|
125
|
+
output: 25,
|
|
126
|
+
cacheRead: .5
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: "claude-opus-4-6",
|
|
131
|
+
name: "Claude Opus 4.6",
|
|
132
|
+
provider: "anthropic",
|
|
133
|
+
input: [
|
|
134
|
+
"text",
|
|
135
|
+
"image",
|
|
136
|
+
"document"
|
|
137
|
+
],
|
|
138
|
+
reasoning: true,
|
|
139
|
+
contextWindow: 2e5,
|
|
140
|
+
maxOutputTokens: 128e3,
|
|
141
|
+
cost: {
|
|
142
|
+
input: 5,
|
|
143
|
+
output: 25
|
|
144
|
+
},
|
|
145
|
+
thinkingLevels: ["off", "medium"]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "claude-sonnet-4-6",
|
|
149
|
+
name: "Claude Sonnet 4.6",
|
|
150
|
+
provider: "anthropic",
|
|
151
|
+
input: [
|
|
152
|
+
"text",
|
|
153
|
+
"image",
|
|
154
|
+
"document"
|
|
155
|
+
],
|
|
156
|
+
reasoning: true,
|
|
157
|
+
contextWindow: 1e6,
|
|
158
|
+
maxOutputTokens: 64e3,
|
|
159
|
+
cost: {
|
|
160
|
+
input: 3,
|
|
161
|
+
output: 15
|
|
162
|
+
},
|
|
163
|
+
thinkingLevels: ["off", "medium"]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "claude-opus-4-5",
|
|
167
|
+
name: "Claude Opus 4.5",
|
|
168
|
+
provider: "anthropic",
|
|
169
|
+
input: [
|
|
170
|
+
"text",
|
|
171
|
+
"image",
|
|
172
|
+
"document"
|
|
173
|
+
],
|
|
174
|
+
reasoning: true,
|
|
175
|
+
contextWindow: 2e5,
|
|
176
|
+
maxOutputTokens: 32e3,
|
|
177
|
+
cost: {
|
|
178
|
+
input: 15,
|
|
179
|
+
output: 75
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: "claude-sonnet-4-5",
|
|
184
|
+
name: "Claude Sonnet 4.5",
|
|
185
|
+
provider: "anthropic",
|
|
186
|
+
input: [
|
|
187
|
+
"text",
|
|
188
|
+
"image",
|
|
189
|
+
"document"
|
|
190
|
+
],
|
|
191
|
+
reasoning: true,
|
|
192
|
+
contextWindow: 2e5,
|
|
193
|
+
maxOutputTokens: 64e3,
|
|
194
|
+
cost: {
|
|
195
|
+
input: 3,
|
|
196
|
+
output: 15
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "claude-haiku-4-5",
|
|
201
|
+
name: "Claude Haiku 4.5",
|
|
202
|
+
provider: "anthropic",
|
|
203
|
+
input: [
|
|
204
|
+
"text",
|
|
205
|
+
"image",
|
|
206
|
+
"document"
|
|
207
|
+
],
|
|
208
|
+
reasoning: true,
|
|
209
|
+
contextWindow: 2e5,
|
|
210
|
+
maxOutputTokens: 64e3,
|
|
211
|
+
cost: {
|
|
212
|
+
input: 1,
|
|
213
|
+
output: 5
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: "claude-opus-4-1",
|
|
218
|
+
name: "Claude Opus 4.1",
|
|
219
|
+
provider: "anthropic",
|
|
220
|
+
input: [
|
|
221
|
+
"text",
|
|
222
|
+
"image",
|
|
223
|
+
"document"
|
|
224
|
+
],
|
|
225
|
+
reasoning: true,
|
|
226
|
+
contextWindow: 2e5,
|
|
227
|
+
maxOutputTokens: 64e3,
|
|
228
|
+
cost: {
|
|
229
|
+
input: 15,
|
|
230
|
+
output: 75
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
};
|
|
235
|
+
//#endregion
|
|
236
|
+
export { anthropic as t };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { defineByokProvider } from "@tanstack/ai/byok";
|
|
2
|
+
//#region src/catalog/providers/bedrock.ts
|
|
3
|
+
const bedrock = {
|
|
4
|
+
id: "bedrock",
|
|
5
|
+
label: "Amazon Bedrock",
|
|
6
|
+
byok: defineByokProvider({
|
|
7
|
+
id: "bedrock",
|
|
8
|
+
label: "Amazon Bedrock",
|
|
9
|
+
env: ["BEDROCK_API_KEY", "AWS_BEARER_TOKEN_BEDROCK"]
|
|
10
|
+
}),
|
|
11
|
+
keyRequired: true,
|
|
12
|
+
runtime: "node",
|
|
13
|
+
models: [
|
|
14
|
+
{
|
|
15
|
+
id: "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
16
|
+
name: "Claude Sonnet 4.5",
|
|
17
|
+
provider: "bedrock",
|
|
18
|
+
input: [
|
|
19
|
+
"text",
|
|
20
|
+
"image",
|
|
21
|
+
"document"
|
|
22
|
+
],
|
|
23
|
+
reasoning: false
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "us.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
27
|
+
name: "Claude Haiku 4.5",
|
|
28
|
+
provider: "bedrock",
|
|
29
|
+
input: [
|
|
30
|
+
"text",
|
|
31
|
+
"image",
|
|
32
|
+
"document"
|
|
33
|
+
],
|
|
34
|
+
reasoning: false
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "us.amazon.nova-pro-v1:0",
|
|
38
|
+
name: "Amazon Nova Pro",
|
|
39
|
+
provider: "bedrock",
|
|
40
|
+
input: [
|
|
41
|
+
"text",
|
|
42
|
+
"image",
|
|
43
|
+
"document"
|
|
44
|
+
],
|
|
45
|
+
reasoning: false
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "us.amazon.nova-lite-v1:0",
|
|
49
|
+
name: "Amazon Nova Lite",
|
|
50
|
+
provider: "bedrock",
|
|
51
|
+
input: [
|
|
52
|
+
"text",
|
|
53
|
+
"image",
|
|
54
|
+
"document"
|
|
55
|
+
],
|
|
56
|
+
reasoning: false
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "us.meta.llama4-maverick-17b-instruct-v1:0",
|
|
60
|
+
name: "Llama 4 Maverick 17B",
|
|
61
|
+
provider: "bedrock",
|
|
62
|
+
input: ["text", "image"],
|
|
63
|
+
reasoning: false
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "us.deepseek.r1-v1:0",
|
|
67
|
+
name: "DeepSeek R1",
|
|
68
|
+
provider: "bedrock",
|
|
69
|
+
input: ["text"],
|
|
70
|
+
reasoning: false
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { bedrock as t };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/catalog/catalog.ts
|
|
2
|
+
function modelRef(model) {
|
|
3
|
+
return `${model.provider}/${model.id}`;
|
|
4
|
+
}
|
|
5
|
+
/** 只切第一个斜杠:OpenRouter / Vercel Gateway 的模型 id 自带 `vendor/model`。 */
|
|
6
|
+
function parseModelRef(ref) {
|
|
7
|
+
const slash = ref.indexOf("/");
|
|
8
|
+
if (slash === -1) return {
|
|
9
|
+
provider: ref,
|
|
10
|
+
id: ""
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
provider: ref.slice(0, slash),
|
|
14
|
+
id: ref.slice(slash + 1)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function createCatalog(providers) {
|
|
18
|
+
const byId = new Map(providers.map((p) => [p.id, p]));
|
|
19
|
+
return {
|
|
20
|
+
providers,
|
|
21
|
+
models: providers.flatMap((p) => p.models),
|
|
22
|
+
getProvider: (id) => byId.get(id),
|
|
23
|
+
getModel: (ref) => {
|
|
24
|
+
const { provider, id } = parseModelRef(ref);
|
|
25
|
+
return byId.get(provider)?.models.find((m) => m.id === id);
|
|
26
|
+
},
|
|
27
|
+
withProvider: (p) => createCatalog([...providers.filter((x) => x.id !== p.id), p]),
|
|
28
|
+
withoutProvider: (id) => createCatalog(providers.filter((x) => x.id !== id))
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { modelRef as n, parseModelRef as r, createCatalog as t };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineByokProvider } from "@tanstack/ai/byok";
|
|
2
|
+
//#region src/catalog/providers/deepseek.ts
|
|
3
|
+
const deepseek = {
|
|
4
|
+
id: "deepseek",
|
|
5
|
+
label: "DeepSeek",
|
|
6
|
+
byok: defineByokProvider({
|
|
7
|
+
id: "deepseek",
|
|
8
|
+
label: "DeepSeek",
|
|
9
|
+
env: "DEEPSEEK_API_KEY"
|
|
10
|
+
}),
|
|
11
|
+
keyRequired: true,
|
|
12
|
+
runtime: "node",
|
|
13
|
+
models: [{
|
|
14
|
+
id: "deepseek-v4-flash",
|
|
15
|
+
name: "DeepSeek V4 Flash",
|
|
16
|
+
provider: "deepseek",
|
|
17
|
+
input: ["text"],
|
|
18
|
+
reasoning: true,
|
|
19
|
+
contextWindow: 1e6,
|
|
20
|
+
maxOutputTokens: 384e3,
|
|
21
|
+
cost: {
|
|
22
|
+
input: .14,
|
|
23
|
+
output: .28,
|
|
24
|
+
cacheRead: .0028
|
|
25
|
+
},
|
|
26
|
+
thinkingLevels: [
|
|
27
|
+
"off",
|
|
28
|
+
"low",
|
|
29
|
+
"high",
|
|
30
|
+
"max"
|
|
31
|
+
],
|
|
32
|
+
search: true
|
|
33
|
+
}, {
|
|
34
|
+
id: "deepseek-v4-pro",
|
|
35
|
+
name: "DeepSeek V4 Pro",
|
|
36
|
+
provider: "deepseek",
|
|
37
|
+
input: ["text"],
|
|
38
|
+
reasoning: true,
|
|
39
|
+
contextWindow: 1e6,
|
|
40
|
+
maxOutputTokens: 384e3,
|
|
41
|
+
cost: {
|
|
42
|
+
input: .435,
|
|
43
|
+
output: .87,
|
|
44
|
+
cacheRead: .003625
|
|
45
|
+
},
|
|
46
|
+
thinkingLevels: [
|
|
47
|
+
"off",
|
|
48
|
+
"high",
|
|
49
|
+
"max"
|
|
50
|
+
],
|
|
51
|
+
search: true
|
|
52
|
+
}]
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { deepseek as t };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { defineByokProvider } from "@tanstack/ai/byok";
|
|
2
|
+
//#region src/catalog/providers/gemini.ts
|
|
3
|
+
const gemini = {
|
|
4
|
+
id: "gemini",
|
|
5
|
+
label: "Google Gemini",
|
|
6
|
+
byok: defineByokProvider({
|
|
7
|
+
id: "gemini",
|
|
8
|
+
label: "Google Gemini",
|
|
9
|
+
env: ["GOOGLE_API_KEY", "GEMINI_API_KEY"]
|
|
10
|
+
}),
|
|
11
|
+
keyRequired: true,
|
|
12
|
+
runtime: "node",
|
|
13
|
+
models: [
|
|
14
|
+
{
|
|
15
|
+
id: "gemini-3.7-flash",
|
|
16
|
+
name: "Gemini 3.7 Flash",
|
|
17
|
+
provider: "gemini",
|
|
18
|
+
input: [
|
|
19
|
+
"text",
|
|
20
|
+
"image",
|
|
21
|
+
"video",
|
|
22
|
+
"audio",
|
|
23
|
+
"document"
|
|
24
|
+
],
|
|
25
|
+
reasoning: true,
|
|
26
|
+
contextWindow: 1048576,
|
|
27
|
+
maxOutputTokens: 65536,
|
|
28
|
+
cost: {
|
|
29
|
+
input: .75,
|
|
30
|
+
output: 3.75,
|
|
31
|
+
cacheRead: .075
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "gemini-3.6-flash",
|
|
36
|
+
name: "Gemini 3.6 Flash",
|
|
37
|
+
provider: "gemini",
|
|
38
|
+
input: [
|
|
39
|
+
"text",
|
|
40
|
+
"image",
|
|
41
|
+
"video",
|
|
42
|
+
"audio",
|
|
43
|
+
"document"
|
|
44
|
+
],
|
|
45
|
+
reasoning: true,
|
|
46
|
+
contextWindow: 1048576,
|
|
47
|
+
maxOutputTokens: 65536,
|
|
48
|
+
cost: {
|
|
49
|
+
input: 1.5,
|
|
50
|
+
output: 7.5,
|
|
51
|
+
cacheRead: .15
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "gemini-3.5-flash",
|
|
56
|
+
name: "Gemini 3.5 Flash",
|
|
57
|
+
provider: "gemini",
|
|
58
|
+
input: [
|
|
59
|
+
"text",
|
|
60
|
+
"image",
|
|
61
|
+
"video",
|
|
62
|
+
"document",
|
|
63
|
+
"audio"
|
|
64
|
+
],
|
|
65
|
+
reasoning: true,
|
|
66
|
+
contextWindow: 1048576,
|
|
67
|
+
maxOutputTokens: 65536,
|
|
68
|
+
cost: {
|
|
69
|
+
input: 1.5,
|
|
70
|
+
output: 9,
|
|
71
|
+
cacheRead: .15
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "gemini-3.5-flash-lite",
|
|
76
|
+
name: "Gemini 3.5 Flash Lite",
|
|
77
|
+
provider: "gemini",
|
|
78
|
+
input: [
|
|
79
|
+
"text",
|
|
80
|
+
"image",
|
|
81
|
+
"video",
|
|
82
|
+
"audio",
|
|
83
|
+
"document"
|
|
84
|
+
],
|
|
85
|
+
reasoning: true,
|
|
86
|
+
contextWindow: 1048576,
|
|
87
|
+
maxOutputTokens: 65536,
|
|
88
|
+
cost: {
|
|
89
|
+
input: .3,
|
|
90
|
+
output: 2.5,
|
|
91
|
+
cacheRead: .03
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "gemini-3.1-pro-preview",
|
|
96
|
+
name: "Gemini 3.1 Pro Preview",
|
|
97
|
+
provider: "gemini",
|
|
98
|
+
input: [
|
|
99
|
+
"text",
|
|
100
|
+
"image",
|
|
101
|
+
"audio",
|
|
102
|
+
"video",
|
|
103
|
+
"document"
|
|
104
|
+
],
|
|
105
|
+
reasoning: true,
|
|
106
|
+
contextWindow: 1048576,
|
|
107
|
+
maxOutputTokens: 65536,
|
|
108
|
+
cost: {
|
|
109
|
+
input: 2.5,
|
|
110
|
+
output: 15
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "gemini-3-flash-preview",
|
|
115
|
+
name: "Gemini 3 Flash Preview",
|
|
116
|
+
provider: "gemini",
|
|
117
|
+
input: [
|
|
118
|
+
"text",
|
|
119
|
+
"image",
|
|
120
|
+
"audio",
|
|
121
|
+
"video",
|
|
122
|
+
"document"
|
|
123
|
+
],
|
|
124
|
+
reasoning: true,
|
|
125
|
+
contextWindow: 1048576,
|
|
126
|
+
maxOutputTokens: 65536,
|
|
127
|
+
cost: {
|
|
128
|
+
input: .5,
|
|
129
|
+
output: 3
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: "gemini-3.1-flash-lite",
|
|
134
|
+
name: "Gemini 3.1 Flash Lite",
|
|
135
|
+
provider: "gemini",
|
|
136
|
+
input: [
|
|
137
|
+
"text",
|
|
138
|
+
"image",
|
|
139
|
+
"audio",
|
|
140
|
+
"video",
|
|
141
|
+
"document"
|
|
142
|
+
],
|
|
143
|
+
reasoning: true,
|
|
144
|
+
contextWindow: 1048576,
|
|
145
|
+
maxOutputTokens: 65536,
|
|
146
|
+
cost: {
|
|
147
|
+
input: .25,
|
|
148
|
+
output: 1.5
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "gemini-3.1-flash-lite-preview",
|
|
153
|
+
name: "Gemini 3.1 Flash Lite Preview",
|
|
154
|
+
provider: "gemini",
|
|
155
|
+
input: [
|
|
156
|
+
"text",
|
|
157
|
+
"image",
|
|
158
|
+
"audio",
|
|
159
|
+
"video",
|
|
160
|
+
"document"
|
|
161
|
+
],
|
|
162
|
+
reasoning: true,
|
|
163
|
+
contextWindow: 1048576,
|
|
164
|
+
maxOutputTokens: 65536,
|
|
165
|
+
cost: {
|
|
166
|
+
input: .25,
|
|
167
|
+
output: 1.5
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: "gemini-2.5-pro",
|
|
172
|
+
name: "Gemini 2.5 Pro",
|
|
173
|
+
provider: "gemini",
|
|
174
|
+
input: [
|
|
175
|
+
"text",
|
|
176
|
+
"image",
|
|
177
|
+
"audio",
|
|
178
|
+
"video",
|
|
179
|
+
"document"
|
|
180
|
+
],
|
|
181
|
+
reasoning: true,
|
|
182
|
+
contextWindow: 1048576,
|
|
183
|
+
maxOutputTokens: 65536,
|
|
184
|
+
cost: {
|
|
185
|
+
input: 2.5,
|
|
186
|
+
output: 15
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "gemini-2.5-flash",
|
|
191
|
+
name: "Gemini 2.5 Flash",
|
|
192
|
+
provider: "gemini",
|
|
193
|
+
input: [
|
|
194
|
+
"text",
|
|
195
|
+
"image",
|
|
196
|
+
"audio",
|
|
197
|
+
"video"
|
|
198
|
+
],
|
|
199
|
+
reasoning: true,
|
|
200
|
+
contextWindow: 1048576,
|
|
201
|
+
maxOutputTokens: 65536,
|
|
202
|
+
cost: {
|
|
203
|
+
input: 1,
|
|
204
|
+
output: 2.5
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: "gemini-2.5-flash-lite",
|
|
209
|
+
name: "Gemini 2.5 Flash Lite",
|
|
210
|
+
provider: "gemini",
|
|
211
|
+
input: [
|
|
212
|
+
"text",
|
|
213
|
+
"image",
|
|
214
|
+
"audio",
|
|
215
|
+
"video",
|
|
216
|
+
"document"
|
|
217
|
+
],
|
|
218
|
+
reasoning: true,
|
|
219
|
+
contextWindow: 1048576,
|
|
220
|
+
maxOutputTokens: 65536,
|
|
221
|
+
cost: {
|
|
222
|
+
input: .1,
|
|
223
|
+
output: .4
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
};
|
|
228
|
+
//#endregion
|
|
229
|
+
export { gemini as t };
|