tekimax-ts 0.2.0 → 0.2.3
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 +55 -3
- package/dist/index.cjs +239 -272
- package/dist/index.d.cts +57 -152
- package/dist/index.d.ts +57 -152
- package/dist/index.js +236 -271
- package/dist/react/index.cjs +37 -2
- package/dist/react/index.d.cts +7 -5
- package/dist/react/index.d.ts +7 -5
- package/dist/react/index.js +37 -2
- package/dist/{tekimax-Dav_a903.d.cts → tekimax-B7sMy12E.d.cts} +57 -41
- package/dist/{tekimax-Dav_a903.d.ts → tekimax-B7sMy12E.d.ts} +57 -41
- package/dist/tekimax-DIIjg64-.d.cts +450 -0
- package/dist/tekimax-DIIjg64-.d.ts +450 -0
- package/dist/tekimax-DJz-T9Vt.d.cts +425 -0
- package/dist/tekimax-DJz-T9Vt.d.ts +425 -0
- package/package.json +11 -10
- package/dist/tekimax-D92pKxV_.d.cts +0 -309
- package/dist/tekimax-D92pKxV_.d.ts +0 -309
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
type MessageRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
2
|
+
interface ToolCall {
|
|
3
|
+
id: string;
|
|
4
|
+
type: 'function';
|
|
5
|
+
function: {
|
|
6
|
+
name: string;
|
|
7
|
+
arguments: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface ToolDefinition {
|
|
11
|
+
type: 'function';
|
|
12
|
+
function: {
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
parameters?: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
interface Tool<T = any> extends ToolDefinition {
|
|
19
|
+
execute: (args: T) => Promise<unknown>;
|
|
20
|
+
}
|
|
21
|
+
interface GenerateTextResult {
|
|
22
|
+
text: string;
|
|
23
|
+
toolCalls: Array<ToolCall>;
|
|
24
|
+
toolResults: Array<{
|
|
25
|
+
id: string;
|
|
26
|
+
result: unknown;
|
|
27
|
+
}>;
|
|
28
|
+
finishReason: 'stop' | 'length' | 'tool_calls' | 'error' | 'unknown';
|
|
29
|
+
usage: {
|
|
30
|
+
promptTokens: number;
|
|
31
|
+
completionTokens: number;
|
|
32
|
+
totalTokens: number;
|
|
33
|
+
};
|
|
34
|
+
warnings?: Array<string>;
|
|
35
|
+
}
|
|
36
|
+
interface TextContentPart {
|
|
37
|
+
type: 'text';
|
|
38
|
+
text: string;
|
|
39
|
+
}
|
|
40
|
+
interface ImageContentPart {
|
|
41
|
+
type: 'image_url';
|
|
42
|
+
image_url: {
|
|
43
|
+
url: string;
|
|
44
|
+
detail?: 'auto' | 'low' | 'high';
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
type ContentPart = TextContentPart | ImageContentPart;
|
|
48
|
+
interface Message {
|
|
49
|
+
role: MessageRole;
|
|
50
|
+
content: string | Array<ContentPart> | null;
|
|
51
|
+
thinking?: string;
|
|
52
|
+
toolCalls?: Array<ToolCall>;
|
|
53
|
+
toolCallId?: string;
|
|
54
|
+
name?: string;
|
|
55
|
+
}
|
|
56
|
+
interface ImageGenerationOptions {
|
|
57
|
+
prompt: string;
|
|
58
|
+
model?: string;
|
|
59
|
+
n?: number;
|
|
60
|
+
size?: string;
|
|
61
|
+
quality?: string;
|
|
62
|
+
style?: string;
|
|
63
|
+
response_format?: 'url' | 'b64_json';
|
|
64
|
+
user?: string;
|
|
65
|
+
}
|
|
66
|
+
interface ImageEditOptions extends ImageGenerationOptions {
|
|
67
|
+
image: string | Blob | Buffer;
|
|
68
|
+
mask?: string | Blob | Buffer;
|
|
69
|
+
}
|
|
70
|
+
interface ImageContent {
|
|
71
|
+
url?: string;
|
|
72
|
+
b64_json?: string;
|
|
73
|
+
revised_prompt?: string;
|
|
74
|
+
}
|
|
75
|
+
interface ImageResult {
|
|
76
|
+
created: number;
|
|
77
|
+
data: ImageContent[];
|
|
78
|
+
}
|
|
79
|
+
interface ImageAnalysisOptions {
|
|
80
|
+
image: string | Blob | Buffer;
|
|
81
|
+
prompt?: string;
|
|
82
|
+
model: string;
|
|
83
|
+
messages?: Array<Message>;
|
|
84
|
+
}
|
|
85
|
+
interface ImageAnalysisResult {
|
|
86
|
+
content: string;
|
|
87
|
+
usage?: {
|
|
88
|
+
inputTokens?: number;
|
|
89
|
+
outputTokens?: number;
|
|
90
|
+
totalTokens?: number;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
interface SpeechGenerationOptions {
|
|
94
|
+
input: string;
|
|
95
|
+
model?: string;
|
|
96
|
+
voice: string;
|
|
97
|
+
response_format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';
|
|
98
|
+
speed?: number;
|
|
99
|
+
}
|
|
100
|
+
interface SpeechResult {
|
|
101
|
+
buffer: ArrayBuffer;
|
|
102
|
+
headers?: Record<string, string>;
|
|
103
|
+
}
|
|
104
|
+
interface VideoGenerationOptions {
|
|
105
|
+
prompt: string;
|
|
106
|
+
model?: string;
|
|
107
|
+
aspect_ratio?: string;
|
|
108
|
+
duration_seconds?: number;
|
|
109
|
+
}
|
|
110
|
+
interface VideoContent {
|
|
111
|
+
url?: string;
|
|
112
|
+
b64_json?: string;
|
|
113
|
+
}
|
|
114
|
+
interface VideoResult {
|
|
115
|
+
data: VideoContent[];
|
|
116
|
+
}
|
|
117
|
+
interface VideoAnalysisOptions {
|
|
118
|
+
video: string | Blob | Buffer;
|
|
119
|
+
prompt?: string;
|
|
120
|
+
model: string;
|
|
121
|
+
messages?: Array<Message>;
|
|
122
|
+
}
|
|
123
|
+
interface VideoAnalysisResult {
|
|
124
|
+
content: string;
|
|
125
|
+
usage?: {
|
|
126
|
+
inputTokens?: number;
|
|
127
|
+
outputTokens?: number;
|
|
128
|
+
totalTokens?: number;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
interface ChatOptions {
|
|
132
|
+
model: string;
|
|
133
|
+
messages: Array<Message>;
|
|
134
|
+
tools?: Array<ToolDefinition>;
|
|
135
|
+
temperature?: number;
|
|
136
|
+
maxTokens?: number;
|
|
137
|
+
stream?: boolean;
|
|
138
|
+
think?: boolean;
|
|
139
|
+
signal?: AbortSignal;
|
|
140
|
+
/** Force a specific response format. 'json_object' enables JSON mode. */
|
|
141
|
+
responseFormat?: {
|
|
142
|
+
type: 'json_object' | 'text';
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
interface ChatResult {
|
|
146
|
+
message: Message;
|
|
147
|
+
usage?: {
|
|
148
|
+
promptTokens: number;
|
|
149
|
+
completionTokens: number;
|
|
150
|
+
totalTokens: number;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
interface StreamChunk {
|
|
154
|
+
delta: string;
|
|
155
|
+
thinking?: string;
|
|
156
|
+
toolCallDelta?: {
|
|
157
|
+
index: number;
|
|
158
|
+
id?: string;
|
|
159
|
+
type?: 'function';
|
|
160
|
+
function?: {
|
|
161
|
+
name?: string;
|
|
162
|
+
arguments?: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
usage?: {
|
|
166
|
+
promptTokens: number;
|
|
167
|
+
completionTokens: number;
|
|
168
|
+
totalTokens: number;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
interface TranscriptionOptions {
|
|
172
|
+
file: File | Blob | Buffer;
|
|
173
|
+
model?: string;
|
|
174
|
+
language?: string;
|
|
175
|
+
prompt?: string;
|
|
176
|
+
response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
|
|
177
|
+
temperature?: number;
|
|
178
|
+
}
|
|
179
|
+
interface TranscriptionResult {
|
|
180
|
+
text: string;
|
|
181
|
+
language?: string;
|
|
182
|
+
duration?: number;
|
|
183
|
+
segments?: Array<{
|
|
184
|
+
start: number;
|
|
185
|
+
end: number;
|
|
186
|
+
text: string;
|
|
187
|
+
}>;
|
|
188
|
+
}
|
|
189
|
+
interface EmbeddingOptions {
|
|
190
|
+
/** The text(s) to embed. Pass a string for a single embedding or an array for batch. */
|
|
191
|
+
input: string | string[];
|
|
192
|
+
/** The embedding model to use (e.g., 'text-embedding-3-small'). */
|
|
193
|
+
model?: string;
|
|
194
|
+
/** Number of dimensions for the output embedding (supported by some models). */
|
|
195
|
+
dimensions?: number;
|
|
196
|
+
}
|
|
197
|
+
interface EmbeddingResult {
|
|
198
|
+
/** Array of embedding vectors — one per input string. */
|
|
199
|
+
embeddings: number[][];
|
|
200
|
+
/** Model used for the embeddings. */
|
|
201
|
+
model: string;
|
|
202
|
+
usage?: {
|
|
203
|
+
promptTokens: number;
|
|
204
|
+
totalTokens: number;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
interface ModelLimit {
|
|
208
|
+
/** Maximum context window size in tokens */
|
|
209
|
+
context: number;
|
|
210
|
+
/** Maximum output tokens */
|
|
211
|
+
output: number;
|
|
212
|
+
}
|
|
213
|
+
interface ModelModalities {
|
|
214
|
+
input: Array<'text' | 'image' | 'audio' | 'video' | 'file'>;
|
|
215
|
+
output: Array<'text' | 'image' | 'audio' | 'video'>;
|
|
216
|
+
}
|
|
217
|
+
interface ModelCost {
|
|
218
|
+
/** Cost per 1M input tokens (USD) */
|
|
219
|
+
input?: number;
|
|
220
|
+
/** Cost per 1M output tokens (USD) */
|
|
221
|
+
output?: number;
|
|
222
|
+
/** Cost per 1M cached input tokens (USD) */
|
|
223
|
+
cache_read?: number;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* OpenResponses-compliant reasoning configuration.
|
|
227
|
+
* Maps from `models.dev` boolean `reasoning` flag into
|
|
228
|
+
* the official `ReasoningEffortEnum` from openresponses/openresponses.
|
|
229
|
+
*/
|
|
230
|
+
interface OpenResponsesReasoningConfig {
|
|
231
|
+
effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
232
|
+
summary?: 'none' | 'terse' | 'verbose' | 'detailed';
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* A standardized model definition that fuses the `models.dev` catalog
|
|
236
|
+
* with the `openresponses.org` specification.
|
|
237
|
+
*
|
|
238
|
+
* This type is returned by providers that support catalog introspection
|
|
239
|
+
* (e.g., fetching from `https://models.dev/api.json`).
|
|
240
|
+
*/
|
|
241
|
+
interface ModelDefinition {
|
|
242
|
+
/** Unique model identifier (e.g. "gpt-4o", "glm-4.6") */
|
|
243
|
+
id: string;
|
|
244
|
+
/** Human-readable display name */
|
|
245
|
+
name: string;
|
|
246
|
+
/** Model architecture family (e.g. "gpt", "glm", "deepseek") */
|
|
247
|
+
family?: string;
|
|
248
|
+
/** Provider name (e.g. "OpenAI", "Ollama Cloud") */
|
|
249
|
+
provider?: string;
|
|
250
|
+
/** Whether the model supports file/image/audio attachments in input */
|
|
251
|
+
attachment: boolean;
|
|
252
|
+
/** Whether the model supports function/tool calling */
|
|
253
|
+
tool_call: boolean;
|
|
254
|
+
/** Whether the model supports structured JSON output */
|
|
255
|
+
structured_output?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Reasoning capability.
|
|
258
|
+
* - `false`: No reasoning support.
|
|
259
|
+
* - `true`: Reasoning supported (default effort = "medium").
|
|
260
|
+
* - `OpenResponsesReasoningConfig`: Fine-grained reasoning control
|
|
261
|
+
* per the official openresponses.org ReasoningEffortEnum.
|
|
262
|
+
*/
|
|
263
|
+
reasoning: boolean | OpenResponsesReasoningConfig;
|
|
264
|
+
/** Supported input/output modalities */
|
|
265
|
+
modalities: ModelModalities;
|
|
266
|
+
/** Token limits */
|
|
267
|
+
limit: ModelLimit;
|
|
268
|
+
/** Pricing per 1M tokens */
|
|
269
|
+
cost?: ModelCost;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
interface AIProvider {
|
|
273
|
+
name: string;
|
|
274
|
+
/**
|
|
275
|
+
* Send a chat completion request.
|
|
276
|
+
*/
|
|
277
|
+
chat: (options: ChatOptions) => Promise<ChatResult>;
|
|
278
|
+
/**
|
|
279
|
+
* Stream a chat completion.
|
|
280
|
+
*/
|
|
281
|
+
chatStream: (options: ChatOptions) => AsyncIterable<StreamChunk>;
|
|
282
|
+
/**
|
|
283
|
+
* Optional: Fetch the catalog of available models from this provider.
|
|
284
|
+
* Returns OpenResponses-compliant ModelDefinition objects fused with
|
|
285
|
+
* models.dev metadata (modalities, limits, reasoning flags).
|
|
286
|
+
*/
|
|
287
|
+
getModels?: () => Promise<ModelDefinition[]>;
|
|
288
|
+
}
|
|
289
|
+
interface ImageGenerationCapability {
|
|
290
|
+
/**
|
|
291
|
+
* Generate an image.
|
|
292
|
+
*/
|
|
293
|
+
generateImage: (options: ImageGenerationOptions) => Promise<ImageResult>;
|
|
294
|
+
}
|
|
295
|
+
interface ImageEditCapability {
|
|
296
|
+
/**
|
|
297
|
+
* Edit an image.
|
|
298
|
+
*/
|
|
299
|
+
editImage: (options: ImageEditOptions) => Promise<ImageResult>;
|
|
300
|
+
}
|
|
301
|
+
interface VisionCapability {
|
|
302
|
+
/**
|
|
303
|
+
* Analyze an image (Vision).
|
|
304
|
+
*/
|
|
305
|
+
analyzeImage: (options: ImageAnalysisOptions) => Promise<ImageAnalysisResult>;
|
|
306
|
+
}
|
|
307
|
+
interface SpeechGenerationCapability {
|
|
308
|
+
/**
|
|
309
|
+
* Generate speech from text (TTS).
|
|
310
|
+
*/
|
|
311
|
+
generateSpeech: (options: SpeechGenerationOptions) => Promise<SpeechResult>;
|
|
312
|
+
}
|
|
313
|
+
interface TranscriptionCapability {
|
|
314
|
+
/**
|
|
315
|
+
* Transcribe audio to text (STT).
|
|
316
|
+
*/
|
|
317
|
+
transcribeAudio: (options: TranscriptionOptions) => Promise<TranscriptionResult>;
|
|
318
|
+
}
|
|
319
|
+
interface VideoGenerationCapability {
|
|
320
|
+
/**
|
|
321
|
+
* Generate a video.
|
|
322
|
+
*/
|
|
323
|
+
generateVideo: (options: VideoGenerationOptions) => Promise<VideoResult>;
|
|
324
|
+
}
|
|
325
|
+
interface VideoAnalysisCapability {
|
|
326
|
+
/**
|
|
327
|
+
* Analyze a video (Video-to-Text).
|
|
328
|
+
*/
|
|
329
|
+
analyzeVideo: (options: VideoAnalysisOptions) => Promise<VideoAnalysisResult>;
|
|
330
|
+
}
|
|
331
|
+
interface EmbeddingCapability {
|
|
332
|
+
/**
|
|
333
|
+
* Generate embeddings for text input(s).
|
|
334
|
+
*/
|
|
335
|
+
embed: (options: EmbeddingOptions) => Promise<EmbeddingResult>;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
declare class TextNamespace<TProvider extends AIProvider> {
|
|
339
|
+
private provider;
|
|
340
|
+
constructor(provider: TProvider);
|
|
341
|
+
/**
|
|
342
|
+
* Generate text from a prompt (Chat Completion).
|
|
343
|
+
*/
|
|
344
|
+
generate(options: ChatOptions): Promise<ChatResult>;
|
|
345
|
+
/**
|
|
346
|
+
* Stream text generation.
|
|
347
|
+
*/
|
|
348
|
+
generateStream(options: ChatOptions): AsyncGenerator<StreamChunk>;
|
|
349
|
+
/**
|
|
350
|
+
* Generate embeddings for text input(s). Only available if the provider supports embeddings.
|
|
351
|
+
*/
|
|
352
|
+
embed(options: TProvider extends EmbeddingCapability ? EmbeddingOptions : never): Promise<TProvider extends EmbeddingCapability ? EmbeddingResult : never>;
|
|
353
|
+
get chat(): {
|
|
354
|
+
completions: {
|
|
355
|
+
create: (options: ChatOptions) => Promise<ChatResult>;
|
|
356
|
+
createStream: (options: ChatOptions) => AsyncGenerator<StreamChunk, any, any>;
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
declare class ImagesNamespace<TProvider extends AIProvider> {
|
|
362
|
+
private provider;
|
|
363
|
+
constructor(provider: TProvider);
|
|
364
|
+
/**
|
|
365
|
+
* Generate images from a prompt. Only available if the provider supports image generation.
|
|
366
|
+
*/
|
|
367
|
+
generate(options: TProvider extends ImageGenerationCapability ? ImageGenerationOptions : never): Promise<TProvider extends ImageGenerationCapability ? ImageResult : never>;
|
|
368
|
+
/**
|
|
369
|
+
* Edit an image with a prompt. Only available if the provider supports image editing.
|
|
370
|
+
*/
|
|
371
|
+
edit(options: TProvider extends ImageEditCapability ? ImageEditOptions : never): Promise<TProvider extends ImageEditCapability ? ImageResult : never>;
|
|
372
|
+
/**
|
|
373
|
+
* Analyze an image (Vision). Only available if the provider supports vision analytics.
|
|
374
|
+
*/
|
|
375
|
+
analyze(options: TProvider extends VisionCapability ? ImageAnalysisOptions : never): Promise<TProvider extends VisionCapability ? ImageAnalysisResult : never>;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
declare class AudioNamespace<TProvider extends AIProvider> {
|
|
379
|
+
private provider;
|
|
380
|
+
constructor(provider: TProvider);
|
|
381
|
+
/**
|
|
382
|
+
* Convert text to speech. Only available if the provider supports TTS.
|
|
383
|
+
*/
|
|
384
|
+
speak(options: TProvider extends SpeechGenerationCapability ? SpeechGenerationOptions : never): Promise<TProvider extends SpeechGenerationCapability ? SpeechResult : never>;
|
|
385
|
+
/**
|
|
386
|
+
* Transcribe audio to text. Only available if the provider supports STT.
|
|
387
|
+
*/
|
|
388
|
+
transcribe(options: TProvider extends TranscriptionCapability ? TranscriptionOptions : never): Promise<TProvider extends TranscriptionCapability ? TranscriptionResult : never>;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
declare class VideosNamespace<TProvider extends AIProvider> {
|
|
392
|
+
private provider;
|
|
393
|
+
constructor(provider: TProvider);
|
|
394
|
+
/**
|
|
395
|
+
* Generate a video from a prompt. Only available if the provider supports video generation.
|
|
396
|
+
*/
|
|
397
|
+
generate(options: TProvider extends VideoGenerationCapability ? VideoGenerationOptions : never): Promise<TProvider extends VideoGenerationCapability ? VideoResult : never>;
|
|
398
|
+
/**
|
|
399
|
+
* Analyze a video (Video-to-Text). Only available if the provider supports video analysis.
|
|
400
|
+
*/
|
|
401
|
+
analyze(options: TProvider extends VideoAnalysisCapability ? VideoAnalysisOptions : never): Promise<TProvider extends VideoAnalysisCapability ? VideoAnalysisResult : never>;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
interface TekimaxOptions<TProvider extends AIProvider> {
|
|
405
|
+
provider: TProvider;
|
|
406
|
+
}
|
|
407
|
+
declare class Tekimax<TProvider extends AIProvider> {
|
|
408
|
+
private provider;
|
|
409
|
+
text: TextNamespace<TProvider>;
|
|
410
|
+
images: ImagesNamespace<TProvider>;
|
|
411
|
+
audio: AudioNamespace<TProvider>;
|
|
412
|
+
videos: VideosNamespace<TProvider>;
|
|
413
|
+
constructor(options: TekimaxOptions<TProvider>);
|
|
414
|
+
/**
|
|
415
|
+
* @deprecated Use client.text.chat instead. Kept for backward compatibility.
|
|
416
|
+
*/
|
|
417
|
+
get chat(): {
|
|
418
|
+
completions: {
|
|
419
|
+
create: (options: ChatOptions) => Promise<ChatResult>;
|
|
420
|
+
createStream: (options: ChatOptions) => AsyncGenerator<StreamChunk, any, any>;
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export { type AIProvider as A, Tekimax as B, type ChatOptions as C, type TekimaxOptions as D, type EmbeddingCapability as E, type TextContentPart as F, type GenerateTextResult as G, type ToolCall as H, type ImageAnalysisOptions as I, type ToolDefinition as J, type VideoContent as K, type VideoGenerationCapability as L, type Message as M, type VideoGenerationOptions as N, type OpenResponsesReasoningConfig as O, type VideoResult as P, type StreamChunk as S, type Tool as T, type VisionCapability as V, type ChatResult as a, type ImageAnalysisResult as b, type VideoAnalysisCapability as c, type VideoAnalysisOptions as d, type VideoAnalysisResult as e, type EmbeddingOptions as f, type EmbeddingResult as g, type SpeechGenerationCapability as h, type ImageGenerationCapability as i, type ImageEditCapability as j, type TranscriptionCapability as k, type SpeechGenerationOptions as l, type SpeechResult as m, type ImageGenerationOptions as n, type ImageResult as o, type TranscriptionOptions as p, type TranscriptionResult as q, type ImageEditOptions as r, type ContentPart as s, type ImageContent as t, type ImageContentPart as u, type MessageRole as v, type ModelCost as w, type ModelDefinition as x, type ModelLimit as y, type ModelModalities as z };
|