@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.
Files changed (57) hide show
  1. package/README.md +71 -0
  2. package/dist/anthropic-DdrANeO1.mjs +236 -0
  3. package/dist/bedrock-534H9yfk.mjs +75 -0
  4. package/dist/catalog-CvvS2JaW.mjs +32 -0
  5. package/dist/deepseek-C1b74T2F.mjs +55 -0
  6. package/dist/gemini-DcJ5Kr3h.mjs +229 -0
  7. package/dist/grok-CffQuBd6.mjs +77 -0
  8. package/dist/groq-Ba6TTYLp.mjs +98 -0
  9. package/dist/index.d.mts +1056 -0
  10. package/dist/index.mjs +2809 -0
  11. package/dist/llmgateway-Pt5CS6aQ.mjs +211 -0
  12. package/dist/mistral-BGMwwbU9.mjs +107 -0
  13. package/dist/mock/index.d.mts +168 -0
  14. package/dist/mock/index.mjs +467 -0
  15. package/dist/ollama-BBJs-3mK.mjs +80 -0
  16. package/dist/openai--FIeahIH.mjs +153 -0
  17. package/dist/openrouter-q-lx-2Cb.mjs +167 -0
  18. package/dist/preset-CEyIPxfS.mjs +157 -0
  19. package/dist/preset-DRT0T14q.d.mts +19 -0
  20. package/dist/providers/anthropic.d.mts +6 -0
  21. package/dist/providers/anthropic.mjs +11 -0
  22. package/dist/providers/bedrock.d.mts +6 -0
  23. package/dist/providers/bedrock.mjs +11 -0
  24. package/dist/providers/byteplus.d.mts +6 -0
  25. package/dist/providers/byteplus.mjs +21 -0
  26. package/dist/providers/deepseek.d.mts +35 -0
  27. package/dist/providers/deepseek.mjs +283 -0
  28. package/dist/providers/gemini.d.mts +6 -0
  29. package/dist/providers/gemini.mjs +11 -0
  30. package/dist/providers/grok.d.mts +6 -0
  31. package/dist/providers/grok.mjs +11 -0
  32. package/dist/providers/groq.d.mts +6 -0
  33. package/dist/providers/groq.mjs +11 -0
  34. package/dist/providers/llmgateway.d.mts +6 -0
  35. package/dist/providers/llmgateway.mjs +11 -0
  36. package/dist/providers/mistral.d.mts +6 -0
  37. package/dist/providers/mistral.mjs +11 -0
  38. package/dist/providers/ollama.d.mts +9 -0
  39. package/dist/providers/ollama.mjs +28 -0
  40. package/dist/providers/openai-compatible.d.mts +32 -0
  41. package/dist/providers/openai-compatible.mjs +45 -0
  42. package/dist/providers/openai.d.mts +6 -0
  43. package/dist/providers/openai.mjs +11 -0
  44. package/dist/providers/openrouter.d.mts +6 -0
  45. package/dist/providers/openrouter.mjs +11 -0
  46. package/dist/providers/vercel-gateway.d.mts +6 -0
  47. package/dist/providers/vercel-gateway.mjs +11 -0
  48. package/dist/providers/vertex.d.mts +6 -0
  49. package/dist/providers/vertex.mjs +11 -0
  50. package/dist/server/index.d.mts +173 -0
  51. package/dist/server/index.mjs +440 -0
  52. package/dist/thinking-CH2uL1dr.mjs +26 -0
  53. package/dist/types-56Hn7Qq2.d.mts +46 -0
  54. package/dist/vercel-gateway-DW3Z0Os1.mjs +109 -0
  55. package/dist/vertex-hg4Dt54O.mjs +20 -0
  56. package/package.json +114 -0
  57. package/styles.css +3 -0
@@ -0,0 +1,467 @@
1
+ "use client";
2
+ import { EventType, INTERRUPT_BINDING_METADATA_KEY, INTERRUPT_BINDING_VERSION, canonicalInterruptJson, digestInterruptJson, generateMessageId, hashSchemaInput, normalizeApprovalSchema } from "@tanstack/ai/client";
3
+ //#region src/mock/steps.ts
4
+ /** Assistant text. Several `text` steps in one run share a single assistant message. */
5
+ const text = (content, o = {}) => ({
6
+ kind: "text",
7
+ content,
8
+ ...o
9
+ });
10
+ /** A thinking block; `signature` is attached via `STEP_FINISHED` the way the engine does it. */
11
+ const reasoning = (content, o = {}) => ({
12
+ kind: "reasoning",
13
+ content,
14
+ ...o
15
+ });
16
+ /**
17
+ * A tool call. Without `approval` / `client` the result follows immediately;
18
+ * with either, the run finishes on an interrupt and `tool.result` continues it next turn.
19
+ */
20
+ const tool = Object.assign((name, input, o = {}) => ({
21
+ kind: "tool",
22
+ name,
23
+ input,
24
+ ...o
25
+ }), { result: (toolCallId, output, o = {}) => ({
26
+ kind: "tool-result",
27
+ toolCallId,
28
+ output,
29
+ ...o
30
+ }) });
31
+ const custom = (name, value) => ({
32
+ kind: "custom",
33
+ name,
34
+ value
35
+ });
36
+ const structured = (object, o = {}) => ({
37
+ kind: "structured",
38
+ object,
39
+ ...o
40
+ });
41
+ /** Token usage for the run. `details` carries the fields with no spec slot, through the same leftover channel the real transport uses. */
42
+ const usage = (u, details) => ({
43
+ kind: "usage",
44
+ usage: u,
45
+ ...details ? { details } : {}
46
+ });
47
+ const error = (message, code) => ({
48
+ kind: "error",
49
+ message,
50
+ code
51
+ });
52
+ const sleep = (ms) => ({
53
+ kind: "sleep",
54
+ ms
55
+ });
56
+ const finish = (o = {}) => ({
57
+ kind: "finish",
58
+ ...o
59
+ });
60
+ //#endregion
61
+ //#region src/mock/run.ts
62
+ const DEFAULT_PACE = 24;
63
+ const INPUT_SCHEMA = {
64
+ type: "object",
65
+ additionalProperties: true
66
+ };
67
+ const CLIENT_RESPONSE_SCHEMA = { type: "object" };
68
+ /** Turn a step script into a `ChatFetcher` for `useChat({ fetcher })`. */
69
+ function scripted(script, options = {}) {
70
+ let turn = 0;
71
+ return async (input, { signal }) => {
72
+ const ctx = toContext(input, signal, turn++);
73
+ const out = await script(ctx);
74
+ if (out instanceof Response) return out;
75
+ const chunks = run(ctx, out, options);
76
+ return options.sse ? toSseResponse(chunks, signal) : chunks;
77
+ };
78
+ }
79
+ /** The wire shape `toServerSentEventsResponse` emits: one `data:` line per chunk, blank-line separated. */
80
+ function toSseResponse(chunks, signal) {
81
+ const encoder = new TextEncoder();
82
+ const body = new ReadableStream({ async start(controller) {
83
+ try {
84
+ for await (const chunk of chunks) {
85
+ if (signal.aborted) break;
86
+ controller.enqueue(encoder.encode(`data: ${JSON.stringify(chunk)}\n\n`));
87
+ }
88
+ } catch (error) {
89
+ controller.error(error);
90
+ return;
91
+ }
92
+ controller.close();
93
+ } });
94
+ return new Response(body, {
95
+ status: 200,
96
+ headers: {
97
+ "content-type": "text/event-stream",
98
+ "cache-control": "no-cache"
99
+ }
100
+ });
101
+ }
102
+ /** Turn n answers with `turns[n]`; past the end the last entry repeats. */
103
+ function sequence(turns) {
104
+ return (ctx) => {
105
+ const t = turns[Math.min(ctx.turn, turns.length - 1)] ?? [];
106
+ return typeof t === "function" ? t(ctx) : t;
107
+ };
108
+ }
109
+ /** Pick the first rule whose matcher hits `lastUserText`; otherwise `fallback` (default: `echo()`). */
110
+ function respond(rules, fallback = echo()) {
111
+ return (ctx) => {
112
+ const hit = rules.find(([match]) => typeof match === "function" ? match(ctx) : typeof match === "string" ? ctx.lastUserText.includes(match) : match.test(ctx.lastUserText));
113
+ const reply = hit ? hit[1] : fallback;
114
+ return typeof reply === "function" ? reply(ctx) : reply;
115
+ };
116
+ }
117
+ /** Repeat the last user message, listing attachment MIME types and `data.model` when present. */
118
+ function echo(options = {}) {
119
+ return (ctx) => {
120
+ const mimes = (ctx.lastUser?.parts ?? []).map((p) => "source" in p ? p.source.mimeType : void 0).filter((m) => typeof m === "string");
121
+ const lines = [ctx.lastUserText];
122
+ if (mimes.length > 0) lines.push(`Attachments: ${mimes.join(", ")}`);
123
+ if (typeof ctx.data.model === "string") lines.push(`Model: ${ctx.data.model}`);
124
+ return [text(lines.join("\n\n"), options)];
125
+ };
126
+ }
127
+ /** A 401 the client turns into `byok.request(provider, 'missing')`. Return it from a script. */
128
+ function byokMissing(provider) {
129
+ return new Response(JSON.stringify({ error: {
130
+ type: "byok_missing",
131
+ provider,
132
+ message: `Missing ${provider} API key`
133
+ } }), {
134
+ status: 401,
135
+ headers: { "content-type": "application/json" }
136
+ });
137
+ }
138
+ /** The user's decision for `tool(name, input, { approval: true })` from the previous run, if resolved. */
139
+ function approvalOf(ctx, toolCallId) {
140
+ const payload = resolved(ctx, `approval_${toolCallId}`)?.payload;
141
+ if (typeof payload === "boolean") return { approved: payload };
142
+ if (typeof payload === "object" && payload !== null && "approved" in payload && typeof payload.approved === "boolean") {
143
+ const { approved, editedArgs, payload: extra } = payload;
144
+ return {
145
+ approved,
146
+ ...editedArgs !== void 0 && { editedArgs },
147
+ ...extra !== void 0 && { payload: extra }
148
+ };
149
+ }
150
+ }
151
+ /** The client-side output for `tool(name, input, { client: true })` from the previous run, if resolved. */
152
+ function clientResultOf(ctx, toolCallId) {
153
+ return resolved(ctx, `client_tool_${toolCallId}`)?.payload;
154
+ }
155
+ function resolved(ctx, interruptId) {
156
+ return ctx.resume?.find((r) => r.interruptId === interruptId && r.status === "resolved");
157
+ }
158
+ function toContext(input, signal, turn) {
159
+ const lastUser = input.messages.findLast((m) => m.role === "user");
160
+ return {
161
+ messages: input.messages,
162
+ lastUser,
163
+ lastUserText: lastUser?.parts.map((p) => p.type === "text" ? p.content : "").join("") ?? "",
164
+ data: input.data ?? {},
165
+ threadId: input.threadId,
166
+ runId: input.runId,
167
+ parentRunId: input.parentRunId,
168
+ resume: input.resume,
169
+ turn,
170
+ signal
171
+ };
172
+ }
173
+ function wait(signal, ms) {
174
+ if (ms <= 0 || signal.aborted) return Promise.resolve();
175
+ return new Promise((resolve) => {
176
+ let timer;
177
+ const done = () => {
178
+ clearTimeout(timer);
179
+ signal.removeEventListener("abort", done);
180
+ resolve();
181
+ };
182
+ timer = setTimeout(done, ms);
183
+ signal.addEventListener("abort", done, { once: true });
184
+ });
185
+ }
186
+ function split(content, chunk) {
187
+ if (chunk === "char") return Array.from(content);
188
+ if (chunk === "word") return content.match(/\S+\s*|\s+/g) ?? [];
189
+ const size = Math.max(1, Math.floor(chunk));
190
+ const out = [];
191
+ for (let i = 0; i < content.length; i += size) out.push(content.slice(i, i + size));
192
+ return out;
193
+ }
194
+ async function* run(ctx, steps, options) {
195
+ const { signal, threadId, runId, parentRunId } = ctx;
196
+ const pace = options.pace === "instant" ? 0 : options.pace ?? DEFAULT_PACE;
197
+ const chunking = options.chunk ?? "word";
198
+ const messageId = options.messageId?.() ?? generateMessageId();
199
+ const pending = [];
200
+ let textStarted = false;
201
+ let runUsage;
202
+ let runUsageDetails;
203
+ let finishReason;
204
+ yield {
205
+ type: EventType.RUN_STARTED,
206
+ threadId,
207
+ runId,
208
+ ...parentRunId !== void 0 && { parentRunId }
209
+ };
210
+ async function* deltas(content, chunk, stepPace) {
211
+ for (const delta of split(content, chunk ?? chunking)) {
212
+ await wait(signal, stepPace ?? pace);
213
+ if (signal.aborted) return false;
214
+ yield delta;
215
+ }
216
+ return true;
217
+ }
218
+ for await (const step of steps) {
219
+ if (signal.aborted) return;
220
+ switch (step.kind) {
221
+ case "text":
222
+ if (!textStarted) {
223
+ textStarted = true;
224
+ yield {
225
+ type: EventType.TEXT_MESSAGE_START,
226
+ messageId,
227
+ role: "assistant"
228
+ };
229
+ }
230
+ for await (const delta of deltas(step.content, step.chunk, step.pace)) yield {
231
+ type: EventType.TEXT_MESSAGE_CONTENT,
232
+ messageId,
233
+ delta
234
+ };
235
+ break;
236
+ case "reasoning": {
237
+ const stepId = generateMessageId();
238
+ yield {
239
+ type: EventType.STEP_STARTED,
240
+ stepName: stepId
241
+ };
242
+ yield {
243
+ type: EventType.REASONING_START,
244
+ messageId: stepId
245
+ };
246
+ yield {
247
+ type: EventType.REASONING_MESSAGE_START,
248
+ messageId: stepId,
249
+ role: "reasoning"
250
+ };
251
+ for await (const delta of deltas(step.content, step.chunk, step.pace)) yield {
252
+ type: EventType.REASONING_MESSAGE_CONTENT,
253
+ messageId: stepId,
254
+ delta
255
+ };
256
+ yield {
257
+ type: EventType.REASONING_MESSAGE_END,
258
+ messageId: stepId
259
+ };
260
+ yield {
261
+ type: EventType.REASONING_END,
262
+ messageId: stepId
263
+ };
264
+ if (step.signature !== void 0) yield {
265
+ type: EventType.STEP_FINISHED,
266
+ stepName: stepId,
267
+ signature: step.signature
268
+ };
269
+ break;
270
+ }
271
+ case "tool": {
272
+ const toolCallId = step.toolCallId ?? options.toolCallId?.() ?? generateMessageId();
273
+ const metadata = step.providerExecuted ? {
274
+ ...step.metadata,
275
+ providerExecuted: true
276
+ } : step.metadata;
277
+ yield {
278
+ type: EventType.TOOL_CALL_START,
279
+ toolCallId,
280
+ toolCallName: step.name,
281
+ parentMessageId: messageId,
282
+ ...metadata && { metadata }
283
+ };
284
+ const args = JSON.stringify(step.input ?? {});
285
+ const argsChunk = step.argsChunk ?? options.argsChunk;
286
+ for (const delta of argsChunk !== void 0 ? split(args, argsChunk) : [args]) {
287
+ await wait(signal, pace);
288
+ if (signal.aborted) return;
289
+ yield {
290
+ type: EventType.TOOL_CALL_ARGS,
291
+ toolCallId,
292
+ delta
293
+ };
294
+ }
295
+ yield {
296
+ type: EventType.TOOL_CALL_END,
297
+ toolCallId,
298
+ input: step.input
299
+ };
300
+ if (step.approval || step.client) {
301
+ pending.push({
302
+ name: step.name,
303
+ toolCallId,
304
+ input: step.input,
305
+ client: Boolean(step.client)
306
+ });
307
+ break;
308
+ }
309
+ yield toolResult(toolCallId, step.error !== void 0 ? { error: step.error } : step.output, step.error !== void 0);
310
+ break;
311
+ }
312
+ case "tool-result":
313
+ yield toolResult(step.toolCallId, step.output, Boolean(step.error));
314
+ break;
315
+ case "custom":
316
+ yield {
317
+ type: EventType.CUSTOM,
318
+ name: step.name,
319
+ value: step.value
320
+ };
321
+ break;
322
+ case "structured": {
323
+ const raw = JSON.stringify(step.object);
324
+ yield {
325
+ type: EventType.CUSTOM,
326
+ name: "structured-output.start",
327
+ value: { messageId }
328
+ };
329
+ if (!textStarted) {
330
+ textStarted = true;
331
+ yield {
332
+ type: EventType.TEXT_MESSAGE_START,
333
+ messageId,
334
+ role: "assistant"
335
+ };
336
+ }
337
+ for await (const delta of deltas(raw, step.chunk ?? 8, void 0)) yield {
338
+ type: EventType.TEXT_MESSAGE_CONTENT,
339
+ messageId,
340
+ delta
341
+ };
342
+ yield {
343
+ type: EventType.CUSTOM,
344
+ name: "structured-output.complete",
345
+ value: {
346
+ object: step.object,
347
+ raw
348
+ }
349
+ };
350
+ break;
351
+ }
352
+ case "usage":
353
+ runUsage = step.usage;
354
+ runUsageDetails = step.details;
355
+ break;
356
+ case "error":
357
+ yield {
358
+ type: EventType.RUN_ERROR,
359
+ message: step.message,
360
+ ...step.code !== void 0 && { code: step.code }
361
+ };
362
+ return;
363
+ case "sleep":
364
+ await wait(signal, step.ms);
365
+ break;
366
+ case "finish": finishReason = step.finishReason;
367
+ }
368
+ if (signal.aborted) return;
369
+ }
370
+ if (textStarted) yield {
371
+ type: EventType.TEXT_MESSAGE_END,
372
+ messageId
373
+ };
374
+ if (pending.length > 0) {
375
+ yield {
376
+ type: EventType.RUN_FINISHED,
377
+ threadId,
378
+ runId,
379
+ outcome: {
380
+ type: "interrupt",
381
+ interrupts: pending.map((p) => p.client ? clientToolInterrupt(runId, p) : approvalInterrupt(runId, p))
382
+ },
383
+ metadata: { tanstack: { finishReason: "tool_calls" } }
384
+ };
385
+ return;
386
+ }
387
+ yield {
388
+ type: EventType.RUN_FINISHED,
389
+ threadId,
390
+ runId,
391
+ ...runUsage && { usage: [{
392
+ ...runUsage,
393
+ totalTokens: runUsage.inputTokens + runUsage.outputTokens
394
+ }] },
395
+ metadata: { tanstack: {
396
+ finishReason: finishReason ?? "stop",
397
+ ...runUsageDetails ? { usage: runUsageDetails } : {}
398
+ } }
399
+ };
400
+ }
401
+ function toolResult(toolCallId, output, isError) {
402
+ return {
403
+ type: EventType.TOOL_CALL_RESULT,
404
+ messageId: generateMessageId(),
405
+ toolCallId,
406
+ content: JSON.stringify(output ?? null),
407
+ role: "tool",
408
+ ...isError && { metadata: { tanstack: { state: "output-error" } } }
409
+ };
410
+ }
411
+ function approvalInterrupt(runId, p) {
412
+ const id = `approval_${p.toolCallId}`;
413
+ const normalized = normalizeApprovalSchema(void 0, INPUT_SCHEMA);
414
+ return {
415
+ id,
416
+ reason: "tool_call",
417
+ message: `Approval required to run ${p.name}`,
418
+ toolCallId: p.toolCallId,
419
+ responseSchema: normalized.responseSchema,
420
+ metadata: {
421
+ kind: "approval",
422
+ toolName: p.name,
423
+ input: p.input,
424
+ [INTERRUPT_BINDING_METADATA_KEY]: {
425
+ v: INTERRUPT_BINDING_VERSION,
426
+ kind: "tool-approval",
427
+ interruptId: id,
428
+ toolName: p.name,
429
+ toolCallId: p.toolCallId,
430
+ originalArgs: p.input,
431
+ inputSchemaHash: hashSchemaInput(INPUT_SCHEMA),
432
+ approvalSchemaHash: normalized.approvalSchemaHash,
433
+ responseSchemaHash: normalized.responseSchemaHash,
434
+ interruptedRunId: runId,
435
+ generation: 0
436
+ }
437
+ }
438
+ };
439
+ }
440
+ function clientToolInterrupt(runId, p) {
441
+ const id = `client_tool_${p.toolCallId}`;
442
+ return {
443
+ id,
444
+ reason: "tanstack:client_tool_execution",
445
+ message: `Client tool ${p.name} is ready to run`,
446
+ toolCallId: p.toolCallId,
447
+ responseSchema: CLIENT_RESPONSE_SCHEMA,
448
+ metadata: {
449
+ kind: "client_tool",
450
+ toolName: p.name,
451
+ input: p.input,
452
+ [INTERRUPT_BINDING_METADATA_KEY]: {
453
+ v: INTERRUPT_BINDING_VERSION,
454
+ kind: "client-tool-execution",
455
+ interruptId: id,
456
+ toolName: p.name,
457
+ toolCallId: p.toolCallId,
458
+ outputSchemaHash: hashSchemaInput(void 0),
459
+ responseSchemaHash: digestInterruptJson(canonicalInterruptJson(CLIENT_RESPONSE_SCHEMA)),
460
+ interruptedRunId: runId,
461
+ generation: 0
462
+ }
463
+ }
464
+ };
465
+ }
466
+ //#endregion
467
+ export { approvalOf, byokMissing, clientResultOf, custom, echo, error, finish, reasoning, respond, scripted, sequence, sleep, structured, text, tool, usage };
@@ -0,0 +1,80 @@
1
+ import { defineByokProvider } from "@tanstack/ai/byok";
2
+ //#region src/catalog/providers/ollama.ts
3
+ const ollama = {
4
+ id: "ollama",
5
+ label: "Ollama",
6
+ byok: defineByokProvider({
7
+ id: "ollama",
8
+ label: "Ollama"
9
+ }),
10
+ keyRequired: false,
11
+ runtime: "local",
12
+ models: [
13
+ {
14
+ id: "llama3.3:latest",
15
+ name: "Llama 3.3",
16
+ provider: "ollama",
17
+ input: ["text"],
18
+ reasoning: false,
19
+ contextWindow: 128e3
20
+ },
21
+ {
22
+ id: "qwen3:latest",
23
+ name: "Qwen3",
24
+ provider: "ollama",
25
+ input: ["text"],
26
+ reasoning: true,
27
+ contextWindow: 4e4
28
+ },
29
+ {
30
+ id: "gpt-oss:20b",
31
+ name: "GPT-OSS 20B",
32
+ provider: "ollama",
33
+ input: ["text"],
34
+ reasoning: true,
35
+ contextWindow: 128e3
36
+ },
37
+ {
38
+ id: "deepseek-r1:latest",
39
+ name: "DeepSeek R1",
40
+ provider: "ollama",
41
+ input: ["text"],
42
+ reasoning: true,
43
+ contextWindow: 128e3
44
+ },
45
+ {
46
+ id: "gemma3:latest",
47
+ name: "Gemma 3",
48
+ provider: "ollama",
49
+ input: ["text", "image"],
50
+ reasoning: false,
51
+ contextWindow: 128e3
52
+ },
53
+ {
54
+ id: "mistral:latest",
55
+ name: "Mistral 7B",
56
+ provider: "ollama",
57
+ input: ["text"],
58
+ reasoning: false,
59
+ contextWindow: 32e3
60
+ },
61
+ {
62
+ id: "phi4:latest",
63
+ name: "Phi-4",
64
+ provider: "ollama",
65
+ input: ["text"],
66
+ reasoning: false,
67
+ contextWindow: 16e3
68
+ },
69
+ {
70
+ id: "llava:latest",
71
+ name: "LLaVA",
72
+ provider: "ollama",
73
+ input: ["text", "image"],
74
+ reasoning: false,
75
+ contextWindow: 32e3
76
+ }
77
+ ]
78
+ };
79
+ //#endregion
80
+ export { ollama as t };
@@ -0,0 +1,153 @@
1
+ import { defineByokProvider } from "@tanstack/ai/byok";
2
+ //#region src/catalog/providers/openai.ts
3
+ const openai = {
4
+ id: "openai",
5
+ label: "OpenAI",
6
+ byok: defineByokProvider({
7
+ id: "openai",
8
+ label: "OpenAI",
9
+ env: "OPENAI_API_KEY"
10
+ }),
11
+ keyRequired: true,
12
+ runtime: "node",
13
+ models: [
14
+ {
15
+ id: "gpt-5.6",
16
+ name: "GPT-5.6",
17
+ provider: "openai",
18
+ input: ["image", "text"],
19
+ reasoning: true,
20
+ contextWindow: 105e4,
21
+ maxOutputTokens: 128e3,
22
+ cost: {
23
+ input: 5,
24
+ output: 30,
25
+ cacheRead: .5
26
+ }
27
+ },
28
+ {
29
+ id: "gpt-5.5",
30
+ name: "GPT-5.5",
31
+ provider: "openai",
32
+ input: [
33
+ "text",
34
+ "image",
35
+ "document"
36
+ ],
37
+ reasoning: true,
38
+ contextWindow: 105e4,
39
+ maxOutputTokens: 128e3,
40
+ cost: {
41
+ input: 5,
42
+ output: 30,
43
+ cacheRead: .5
44
+ }
45
+ },
46
+ {
47
+ id: "gpt-5.4-mini",
48
+ name: "GPT-5.4 mini",
49
+ provider: "openai",
50
+ input: ["image", "text"],
51
+ reasoning: true,
52
+ contextWindow: 4e5,
53
+ maxOutputTokens: 128e3,
54
+ cost: {
55
+ input: .75,
56
+ output: 4.5,
57
+ cacheRead: .075
58
+ }
59
+ },
60
+ {
61
+ id: "gpt-5.2",
62
+ name: "GPT-5.2",
63
+ provider: "openai",
64
+ input: [
65
+ "text",
66
+ "image",
67
+ "document"
68
+ ],
69
+ reasoning: true,
70
+ contextWindow: 4e5,
71
+ maxOutputTokens: 128e3,
72
+ cost: {
73
+ input: 1.75,
74
+ output: 14,
75
+ cacheRead: .175
76
+ }
77
+ },
78
+ {
79
+ id: "gpt-5.1",
80
+ name: "GPT-5.1",
81
+ provider: "openai",
82
+ input: [
83
+ "text",
84
+ "image",
85
+ "document"
86
+ ],
87
+ reasoning: true,
88
+ contextWindow: 4e5,
89
+ maxOutputTokens: 128e3,
90
+ cost: {
91
+ input: 1.25,
92
+ output: 10,
93
+ cacheRead: .125
94
+ }
95
+ },
96
+ {
97
+ id: "gpt-5",
98
+ name: "GPT-5",
99
+ provider: "openai",
100
+ input: [
101
+ "text",
102
+ "image",
103
+ "document"
104
+ ],
105
+ reasoning: true,
106
+ contextWindow: 4e5,
107
+ maxOutputTokens: 128e3,
108
+ cost: {
109
+ input: 1.25,
110
+ output: 10,
111
+ cacheRead: .125
112
+ }
113
+ },
114
+ {
115
+ id: "gpt-4.1",
116
+ name: "GPT-4.1",
117
+ provider: "openai",
118
+ input: [
119
+ "text",
120
+ "image",
121
+ "document"
122
+ ],
123
+ reasoning: false,
124
+ contextWindow: 1047576,
125
+ maxOutputTokens: 32768,
126
+ cost: {
127
+ input: 2,
128
+ output: 8,
129
+ cacheRead: .5
130
+ }
131
+ },
132
+ {
133
+ id: "o4-mini",
134
+ name: "o4-mini",
135
+ provider: "openai",
136
+ input: [
137
+ "text",
138
+ "image",
139
+ "document"
140
+ ],
141
+ reasoning: true,
142
+ contextWindow: 2e5,
143
+ maxOutputTokens: 1e5,
144
+ cost: {
145
+ input: 1.1,
146
+ output: 4.4,
147
+ cacheRead: .275
148
+ }
149
+ }
150
+ ]
151
+ };
152
+ //#endregion
153
+ export { openai as t };