@tanstack/ai-llmgateway 0.0.0
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/LICENSE +21 -0
- package/README.md +94 -0
- package/dist/esm/adapters/summarize.d.ts +51 -0
- package/dist/esm/adapters/summarize.js +55 -0
- package/dist/esm/adapters/summarize.js.map +1 -0
- package/dist/esm/adapters/text.d.ts +64 -0
- package/dist/esm/adapters/text.js +67 -0
- package/dist/esm/adapters/text.js.map +1 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/message-types.d.ts +116 -0
- package/dist/esm/model-meta.d.ts +374 -0
- package/dist/esm/model-meta.js +363 -0
- package/dist/esm/model-meta.js.map +1 -0
- package/dist/esm/text/text-provider-options.d.ts +97 -0
- package/dist/esm/utils/client.d.ts +16 -0
- package/dist/esm/utils/client.js +29 -0
- package/dist/esm/utils/client.js.map +1 -0
- package/package.json +74 -0
- package/src/adapters/summarize.ts +79 -0
- package/src/adapters/text.ts +119 -0
- package/src/index.ts +52 -0
- package/src/message-types.ts +130 -0
- package/src/model-meta.ts +516 -0
- package/src/text/text-provider-options.ts +128 -0
- package/src/utils/client.ts +36 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { LLMGatewayTextProviderOptions } from './text/text-provider-options.js';
|
|
2
|
+
declare const GPT_5_6_TERRA: {
|
|
3
|
+
readonly name: "gpt-5.6-terra";
|
|
4
|
+
readonly context_window: 1050000;
|
|
5
|
+
readonly max_completion_tokens: 128000;
|
|
6
|
+
readonly pricing: {
|
|
7
|
+
readonly input: {
|
|
8
|
+
readonly normal: 2.5;
|
|
9
|
+
readonly cached: 0.25;
|
|
10
|
+
};
|
|
11
|
+
readonly output: {
|
|
12
|
+
readonly normal: 15;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
readonly supports: {
|
|
16
|
+
readonly input: ["text", "image"];
|
|
17
|
+
readonly output: ["text"];
|
|
18
|
+
readonly endpoints: ["chat"];
|
|
19
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning", "vision"];
|
|
20
|
+
readonly tools: readonly [];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
declare const GPT_5_5: {
|
|
24
|
+
readonly name: "gpt-5.5";
|
|
25
|
+
readonly context_window: 1050000;
|
|
26
|
+
readonly max_completion_tokens: 128000;
|
|
27
|
+
readonly pricing: {
|
|
28
|
+
readonly input: {
|
|
29
|
+
readonly normal: 5;
|
|
30
|
+
readonly cached: 0.5;
|
|
31
|
+
};
|
|
32
|
+
readonly output: {
|
|
33
|
+
readonly normal: 30;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly supports: {
|
|
37
|
+
readonly input: ["text", "image"];
|
|
38
|
+
readonly output: ["text"];
|
|
39
|
+
readonly endpoints: ["chat"];
|
|
40
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning", "vision"];
|
|
41
|
+
readonly tools: readonly [];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
declare const GPT_5_4_MINI: {
|
|
45
|
+
readonly name: "gpt-5.4-mini";
|
|
46
|
+
readonly context_window: 400000;
|
|
47
|
+
readonly max_completion_tokens: 128000;
|
|
48
|
+
readonly pricing: {
|
|
49
|
+
readonly input: {
|
|
50
|
+
readonly normal: 0.75;
|
|
51
|
+
readonly cached: 0.075;
|
|
52
|
+
};
|
|
53
|
+
readonly output: {
|
|
54
|
+
readonly normal: 4.5;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly supports: {
|
|
58
|
+
readonly input: ["text", "image"];
|
|
59
|
+
readonly output: ["text"];
|
|
60
|
+
readonly endpoints: ["chat"];
|
|
61
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning", "vision"];
|
|
62
|
+
readonly tools: readonly [];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
declare const CLAUDE_OPUS_5: {
|
|
66
|
+
readonly name: "claude-opus-5";
|
|
67
|
+
readonly context_window: 1000000;
|
|
68
|
+
readonly max_completion_tokens: 128000;
|
|
69
|
+
readonly pricing: {
|
|
70
|
+
readonly input: {
|
|
71
|
+
readonly normal: 5;
|
|
72
|
+
readonly cached: 0.5;
|
|
73
|
+
};
|
|
74
|
+
readonly output: {
|
|
75
|
+
readonly normal: 25;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
readonly supports: {
|
|
79
|
+
readonly input: ["text", "image"];
|
|
80
|
+
readonly output: ["text"];
|
|
81
|
+
readonly endpoints: ["chat"];
|
|
82
|
+
readonly features: ["streaming", "tools", "reasoning", "vision"];
|
|
83
|
+
readonly tools: readonly [];
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
declare const CLAUDE_SONNET_5: {
|
|
87
|
+
readonly name: "claude-sonnet-5";
|
|
88
|
+
readonly context_window: 1000000;
|
|
89
|
+
readonly max_completion_tokens: 128000;
|
|
90
|
+
readonly pricing: {
|
|
91
|
+
readonly input: {
|
|
92
|
+
readonly normal: 2;
|
|
93
|
+
readonly cached: 0.2;
|
|
94
|
+
};
|
|
95
|
+
readonly output: {
|
|
96
|
+
readonly normal: 10;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
readonly supports: {
|
|
100
|
+
readonly input: ["text", "image"];
|
|
101
|
+
readonly output: ["text"];
|
|
102
|
+
readonly endpoints: ["chat"];
|
|
103
|
+
readonly features: ["streaming", "tools", "reasoning", "vision"];
|
|
104
|
+
readonly tools: readonly [];
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
declare const CLAUDE_HAIKU_4_5: {
|
|
108
|
+
readonly name: "claude-haiku-4-5";
|
|
109
|
+
readonly context_window: 200000;
|
|
110
|
+
readonly max_completion_tokens: 64000;
|
|
111
|
+
readonly pricing: {
|
|
112
|
+
readonly input: {
|
|
113
|
+
readonly normal: 1;
|
|
114
|
+
readonly cached: 0.1;
|
|
115
|
+
};
|
|
116
|
+
readonly output: {
|
|
117
|
+
readonly normal: 5;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
readonly supports: {
|
|
121
|
+
readonly input: ["text", "image"];
|
|
122
|
+
readonly output: ["text"];
|
|
123
|
+
readonly endpoints: ["chat"];
|
|
124
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning", "vision"];
|
|
125
|
+
readonly tools: readonly [];
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
declare const GEMINI_PRO_LATEST: {
|
|
129
|
+
readonly name: "gemini-pro-latest";
|
|
130
|
+
readonly context_window: 1048576;
|
|
131
|
+
readonly max_completion_tokens: 65536;
|
|
132
|
+
readonly pricing: {
|
|
133
|
+
readonly input: {
|
|
134
|
+
readonly normal: 2;
|
|
135
|
+
readonly cached: 0.2;
|
|
136
|
+
};
|
|
137
|
+
readonly output: {
|
|
138
|
+
readonly normal: 12;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
readonly supports: {
|
|
142
|
+
readonly input: ["text", "image"];
|
|
143
|
+
readonly output: ["text"];
|
|
144
|
+
readonly endpoints: ["chat"];
|
|
145
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning", "vision"];
|
|
146
|
+
readonly tools: readonly [];
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
declare const GEMINI_3_6_FLASH: {
|
|
150
|
+
readonly name: "gemini-3.6-flash";
|
|
151
|
+
readonly context_window: 1048576;
|
|
152
|
+
readonly max_completion_tokens: 65536;
|
|
153
|
+
readonly pricing: {
|
|
154
|
+
readonly input: {
|
|
155
|
+
readonly normal: 1.5;
|
|
156
|
+
readonly cached: 0.15;
|
|
157
|
+
};
|
|
158
|
+
readonly output: {
|
|
159
|
+
readonly normal: 7.5;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
readonly supports: {
|
|
163
|
+
readonly input: ["text", "image"];
|
|
164
|
+
readonly output: ["text"];
|
|
165
|
+
readonly endpoints: ["chat"];
|
|
166
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning", "vision"];
|
|
167
|
+
readonly tools: readonly [];
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
declare const KIMI_K3: {
|
|
171
|
+
readonly name: "kimi-k3";
|
|
172
|
+
readonly context_window: 1048576;
|
|
173
|
+
readonly max_completion_tokens: 1048576;
|
|
174
|
+
readonly pricing: {
|
|
175
|
+
readonly input: {
|
|
176
|
+
readonly normal: 3;
|
|
177
|
+
readonly cached: 0.3;
|
|
178
|
+
};
|
|
179
|
+
readonly output: {
|
|
180
|
+
readonly normal: 15;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
readonly supports: {
|
|
184
|
+
readonly input: ["text", "image"];
|
|
185
|
+
readonly output: ["text"];
|
|
186
|
+
readonly endpoints: ["chat"];
|
|
187
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning", "vision"];
|
|
188
|
+
readonly tools: readonly [];
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
declare const GLM_5_2: {
|
|
192
|
+
readonly name: "glm-5.2";
|
|
193
|
+
readonly context_window: 1000000;
|
|
194
|
+
readonly max_completion_tokens: 128000;
|
|
195
|
+
readonly pricing: {
|
|
196
|
+
readonly input: {
|
|
197
|
+
readonly normal: 1.4;
|
|
198
|
+
readonly cached: 0.26;
|
|
199
|
+
};
|
|
200
|
+
readonly output: {
|
|
201
|
+
readonly normal: 4.4;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
readonly supports: {
|
|
205
|
+
readonly input: ["text"];
|
|
206
|
+
readonly output: ["text"];
|
|
207
|
+
readonly endpoints: ["chat"];
|
|
208
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning"];
|
|
209
|
+
readonly tools: readonly [];
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
declare const DEEPSEEK_V4_PRO: {
|
|
213
|
+
readonly name: "deepseek-v4-pro";
|
|
214
|
+
readonly context_window: 1050000;
|
|
215
|
+
readonly max_completion_tokens: 393216;
|
|
216
|
+
readonly pricing: {
|
|
217
|
+
readonly input: {
|
|
218
|
+
readonly normal: 0.435;
|
|
219
|
+
};
|
|
220
|
+
readonly output: {
|
|
221
|
+
readonly normal: 0.87;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
readonly supports: {
|
|
225
|
+
readonly input: ["text"];
|
|
226
|
+
readonly output: ["text"];
|
|
227
|
+
readonly endpoints: ["chat"];
|
|
228
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning"];
|
|
229
|
+
readonly tools: readonly [];
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
declare const QWEN_3_7_MAX: {
|
|
233
|
+
readonly name: "qwen3.7-max";
|
|
234
|
+
readonly context_window: 1000000;
|
|
235
|
+
readonly max_completion_tokens: 65536;
|
|
236
|
+
readonly pricing: {
|
|
237
|
+
readonly input: {
|
|
238
|
+
readonly normal: 2.5;
|
|
239
|
+
readonly cached: 0.5;
|
|
240
|
+
};
|
|
241
|
+
readonly output: {
|
|
242
|
+
readonly normal: 7.5;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
readonly supports: {
|
|
246
|
+
readonly input: ["text"];
|
|
247
|
+
readonly output: ["text"];
|
|
248
|
+
readonly endpoints: ["chat"];
|
|
249
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning"];
|
|
250
|
+
readonly tools: readonly [];
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
declare const MINIMAX_M2_5: {
|
|
254
|
+
readonly name: "minimax-m2.5";
|
|
255
|
+
readonly context_window: 204800;
|
|
256
|
+
readonly max_completion_tokens: 131100;
|
|
257
|
+
readonly pricing: {
|
|
258
|
+
readonly input: {
|
|
259
|
+
readonly normal: 0.3;
|
|
260
|
+
readonly cached: 0.03;
|
|
261
|
+
};
|
|
262
|
+
readonly output: {
|
|
263
|
+
readonly normal: 1.2;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
readonly supports: {
|
|
267
|
+
readonly input: ["text"];
|
|
268
|
+
readonly output: ["text"];
|
|
269
|
+
readonly endpoints: ["chat"];
|
|
270
|
+
readonly features: ["streaming", "tools", "reasoning"];
|
|
271
|
+
readonly tools: readonly [];
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
declare const GROK_4_5: {
|
|
275
|
+
readonly name: "grok-4-5";
|
|
276
|
+
readonly context_window: 500000;
|
|
277
|
+
readonly pricing: {
|
|
278
|
+
readonly input: {
|
|
279
|
+
readonly normal: 2;
|
|
280
|
+
readonly cached: 0.5;
|
|
281
|
+
};
|
|
282
|
+
readonly output: {
|
|
283
|
+
readonly normal: 6;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
readonly supports: {
|
|
287
|
+
readonly input: ["text", "image"];
|
|
288
|
+
readonly output: ["text"];
|
|
289
|
+
readonly endpoints: ["chat"];
|
|
290
|
+
readonly features: ["streaming", "tools", "json_object", "json_schema", "reasoning", "vision"];
|
|
291
|
+
readonly tools: readonly [];
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Curated LLM Gateway chat model identifiers.
|
|
296
|
+
*
|
|
297
|
+
* Any model on https://llmgateway.io/models works at runtime; these curated
|
|
298
|
+
* entries carry per-model type metadata (input modalities, provider
|
|
299
|
+
* options).
|
|
300
|
+
*/
|
|
301
|
+
export declare const LLMGATEWAY_CHAT_MODELS: readonly ["gpt-5.6-terra", "gpt-5.5", "gpt-5.4-mini", "claude-opus-5", "claude-sonnet-5", "claude-haiku-4-5", "gemini-pro-latest", "gemini-3.6-flash", "kimi-k3", "glm-5.2", "deepseek-v4-pro", "qwen3.7-max", "minimax-m2.5", "grok-4-5"];
|
|
302
|
+
/**
|
|
303
|
+
* Union type of all curated LLM Gateway chat model names.
|
|
304
|
+
*/
|
|
305
|
+
export type LLMGatewayChatModels = (typeof LLMGATEWAY_CHAT_MODELS)[number];
|
|
306
|
+
/**
|
|
307
|
+
* Model id accepted by the LLM Gateway adapters: a curated model name (with
|
|
308
|
+
* autocomplete and per-model type metadata) or any other model id from
|
|
309
|
+
* https://llmgateway.io/models, optionally prefixed with `provider/` to pin
|
|
310
|
+
* routing to a specific provider. Uncurated ids fall back to text-only
|
|
311
|
+
* input and the generic provider options.
|
|
312
|
+
*/
|
|
313
|
+
export type LLMGatewayModelId = LLMGatewayChatModels | (string & {});
|
|
314
|
+
/**
|
|
315
|
+
* Type-only map from LLM Gateway chat model name to its supported input
|
|
316
|
+
* modalities.
|
|
317
|
+
*/
|
|
318
|
+
export type LLMGatewayModelInputModalitiesByName = {
|
|
319
|
+
[GPT_5_6_TERRA.name]: typeof GPT_5_6_TERRA.supports.input;
|
|
320
|
+
[GPT_5_5.name]: typeof GPT_5_5.supports.input;
|
|
321
|
+
[GPT_5_4_MINI.name]: typeof GPT_5_4_MINI.supports.input;
|
|
322
|
+
[CLAUDE_OPUS_5.name]: typeof CLAUDE_OPUS_5.supports.input;
|
|
323
|
+
[CLAUDE_SONNET_5.name]: typeof CLAUDE_SONNET_5.supports.input;
|
|
324
|
+
[CLAUDE_HAIKU_4_5.name]: typeof CLAUDE_HAIKU_4_5.supports.input;
|
|
325
|
+
[GEMINI_PRO_LATEST.name]: typeof GEMINI_PRO_LATEST.supports.input;
|
|
326
|
+
[GEMINI_3_6_FLASH.name]: typeof GEMINI_3_6_FLASH.supports.input;
|
|
327
|
+
[KIMI_K3.name]: typeof KIMI_K3.supports.input;
|
|
328
|
+
[GLM_5_2.name]: typeof GLM_5_2.supports.input;
|
|
329
|
+
[DEEPSEEK_V4_PRO.name]: typeof DEEPSEEK_V4_PRO.supports.input;
|
|
330
|
+
[QWEN_3_7_MAX.name]: typeof QWEN_3_7_MAX.supports.input;
|
|
331
|
+
[MINIMAX_M2_5.name]: typeof MINIMAX_M2_5.supports.input;
|
|
332
|
+
[GROK_4_5.name]: typeof GROK_4_5.supports.input;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Type-only map from LLM Gateway chat model name to its provider options
|
|
336
|
+
* type.
|
|
337
|
+
*/
|
|
338
|
+
export type LLMGatewayChatModelProviderOptionsByName = {
|
|
339
|
+
[K in (typeof LLMGATEWAY_CHAT_MODELS)[number]]: LLMGatewayTextProviderOptions;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Type-only map from LLM Gateway chat model name to its supported provider
|
|
343
|
+
* tools. LLM Gateway exposes no provider-specific tool factories, so every
|
|
344
|
+
* model gets an empty tuple. This ensures that passing an Anthropic/OpenAI
|
|
345
|
+
* ProviderTool to an LLM Gateway adapter produces a compile-time type error.
|
|
346
|
+
*/
|
|
347
|
+
export type LLMGatewayChatModelToolCapabilitiesByName = {
|
|
348
|
+
[GPT_5_6_TERRA.name]: typeof GPT_5_6_TERRA.supports.tools;
|
|
349
|
+
[GPT_5_5.name]: typeof GPT_5_5.supports.tools;
|
|
350
|
+
[GPT_5_4_MINI.name]: typeof GPT_5_4_MINI.supports.tools;
|
|
351
|
+
[CLAUDE_OPUS_5.name]: typeof CLAUDE_OPUS_5.supports.tools;
|
|
352
|
+
[CLAUDE_SONNET_5.name]: typeof CLAUDE_SONNET_5.supports.tools;
|
|
353
|
+
[CLAUDE_HAIKU_4_5.name]: typeof CLAUDE_HAIKU_4_5.supports.tools;
|
|
354
|
+
[GEMINI_PRO_LATEST.name]: typeof GEMINI_PRO_LATEST.supports.tools;
|
|
355
|
+
[GEMINI_3_6_FLASH.name]: typeof GEMINI_3_6_FLASH.supports.tools;
|
|
356
|
+
[KIMI_K3.name]: typeof KIMI_K3.supports.tools;
|
|
357
|
+
[GLM_5_2.name]: typeof GLM_5_2.supports.tools;
|
|
358
|
+
[DEEPSEEK_V4_PRO.name]: typeof DEEPSEEK_V4_PRO.supports.tools;
|
|
359
|
+
[QWEN_3_7_MAX.name]: typeof QWEN_3_7_MAX.supports.tools;
|
|
360
|
+
[MINIMAX_M2_5.name]: typeof MINIMAX_M2_5.supports.tools;
|
|
361
|
+
[GROK_4_5.name]: typeof GROK_4_5.supports.tools;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Resolves the provider options type for a specific LLM Gateway model.
|
|
365
|
+
* Falls back to the generic options for uncurated model ids.
|
|
366
|
+
*/
|
|
367
|
+
export type ResolveProviderOptions<TModel extends string> = TModel extends keyof LLMGatewayChatModelProviderOptionsByName ? LLMGatewayChatModelProviderOptionsByName[TModel] : LLMGatewayTextProviderOptions;
|
|
368
|
+
/**
|
|
369
|
+
* Resolve input modalities for a specific model.
|
|
370
|
+
* If the model has explicit modalities in the map, use those; otherwise use
|
|
371
|
+
* text only.
|
|
372
|
+
*/
|
|
373
|
+
export type ResolveInputModalities<TModel extends string> = TModel extends keyof LLMGatewayModelInputModalitiesByName ? LLMGatewayModelInputModalitiesByName[TModel] : readonly ['text'];
|
|
374
|
+
export {};
|