@apicity/xai 0.1.0-alpha.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.
@@ -0,0 +1,812 @@
1
+ import type { z } from "zod";
2
+ export type { XaiOptions, XaiMessage, XaiToolFunction, XaiTool, XaiImageReference, XaiVideoReference, XaiChunkConfiguration, XaiFieldDefinition, XaiChatRequest, XaiImageGenerateRequest, XaiImageEditRequest, XaiVideoGenerateRequest, XaiVideoEditRequest, XaiVideoExtendRequest, XaiBatchCreateRequest, XaiBatchAddRequestsBody, XaiCollectionCreateRequest, XaiCollectionUpdateRequest, XaiDocumentAddRequest, XaiDocumentSearchRequest, XaiResponseInputTextContent, XaiResponseInputImageContent, XaiResponseInputContent, XaiResponseInputMessage, XaiResponseFunctionCallOutput, XaiResponseItemReference, XaiResponseInputItem, XaiResponseFunctionTool, XaiResponseWebSearchTool, XaiResponseFileSearchTool, XaiResponseTool, XaiResponseTextFormat, XaiResponseReasoning, XaiResponseSearchParameters, XaiResponseRequest, XaiTokenizeTextRequest, XaiRealtimeClientSecretRequest, XaiTtsRequest, XaiSttRequest, XaiCustomVoiceCreateRequest, } from "./zod";
3
+ export interface XaiToolCall {
4
+ id: string;
5
+ type: "function";
6
+ function: {
7
+ name: string;
8
+ arguments: string;
9
+ };
10
+ }
11
+ export interface XaiUsage {
12
+ prompt_tokens: number;
13
+ completion_tokens: number;
14
+ total_tokens: number;
15
+ }
16
+ export interface XaiDeferredChatCompletionResult {
17
+ ready: boolean;
18
+ data: XaiChatResponse | null;
19
+ }
20
+ export interface XaiChatChoice {
21
+ index: number;
22
+ message: {
23
+ role: string;
24
+ content: string | null;
25
+ tool_calls?: XaiToolCall[];
26
+ };
27
+ finish_reason: string;
28
+ }
29
+ export interface XaiChatResponse {
30
+ id: string;
31
+ object: string;
32
+ created: number;
33
+ model: string;
34
+ choices: XaiChatChoice[];
35
+ usage?: XaiUsage;
36
+ error?: {
37
+ message?: string;
38
+ type?: string;
39
+ };
40
+ }
41
+ export interface XaiGeneratedImage {
42
+ url?: string;
43
+ b64_json?: string;
44
+ revised_prompt?: string;
45
+ respect_moderation?: boolean;
46
+ }
47
+ export interface XaiImageResponse {
48
+ created?: number;
49
+ model?: string;
50
+ data: XaiGeneratedImage[];
51
+ }
52
+ export interface XaiFileObject {
53
+ id: string;
54
+ object: string;
55
+ bytes: number;
56
+ created_at: number;
57
+ filename: string;
58
+ purpose: string;
59
+ }
60
+ export interface XaiFileListResponse {
61
+ data: XaiFileObject[];
62
+ object: string;
63
+ }
64
+ export interface XaiVideoAsyncResponse {
65
+ request_id: string;
66
+ }
67
+ export interface XaiVideoData {
68
+ url: string;
69
+ duration: number;
70
+ respect_moderation: boolean;
71
+ }
72
+ export interface XaiVideoResult {
73
+ status: "pending" | "done" | "expired" | "failed";
74
+ progress?: number;
75
+ request_id?: string;
76
+ video?: XaiVideoData;
77
+ model?: string;
78
+ }
79
+ export interface XaiModel {
80
+ id: string;
81
+ created: number;
82
+ object: string;
83
+ owned_by: string;
84
+ }
85
+ export interface XaiModelListResponse {
86
+ data: XaiModel[];
87
+ object: string;
88
+ }
89
+ export interface XaiLanguageModel {
90
+ id: string;
91
+ fingerprint: string;
92
+ created: number;
93
+ object: string;
94
+ owned_by: string;
95
+ version: string;
96
+ input_modalities: string[];
97
+ output_modalities: string[];
98
+ prompt_text_token_price: number;
99
+ cached_prompt_text_token_price?: number;
100
+ prompt_image_token_price?: number;
101
+ completion_text_token_price: number;
102
+ search_price?: number;
103
+ aliases: string[];
104
+ }
105
+ export interface XaiLanguageModelListResponse {
106
+ models: XaiLanguageModel[];
107
+ }
108
+ export interface XaiImageGenerationModel {
109
+ id: string;
110
+ fingerprint: string;
111
+ created: number;
112
+ object: string;
113
+ owned_by: string;
114
+ version: string;
115
+ max_prompt_length: number;
116
+ prompt_text_token_price?: number;
117
+ prompt_image_token_price?: number;
118
+ generated_image_token_price?: number;
119
+ image_price?: number;
120
+ input_modalities?: string[];
121
+ output_modalities?: string[];
122
+ aliases: string[];
123
+ }
124
+ export interface XaiImageGenerationModelListResponse {
125
+ models: XaiImageGenerationModel[];
126
+ }
127
+ export interface XaiVideoGenerationModel {
128
+ id: string;
129
+ fingerprint: string;
130
+ created: number;
131
+ object: string;
132
+ owned_by: string;
133
+ version: string;
134
+ input_modalities: string[];
135
+ output_modalities: string[];
136
+ aliases: string[];
137
+ }
138
+ export interface XaiVideoGenerationModelListResponse {
139
+ models: XaiVideoGenerationModel[];
140
+ }
141
+ export interface XaiBatchState {
142
+ num_requests: number;
143
+ num_pending: number;
144
+ num_success: number;
145
+ num_error: number;
146
+ num_cancelled: number;
147
+ }
148
+ export interface XaiBatch {
149
+ batch_id: string;
150
+ name: string;
151
+ create_time: string;
152
+ expire_time: string | null;
153
+ create_api_key_id: string;
154
+ cancel_time: string | null;
155
+ cancel_by_xai_message: string | null;
156
+ state: XaiBatchState;
157
+ }
158
+ export interface XaiBatchListResponse {
159
+ batches: XaiBatch[];
160
+ pagination_token: string | null;
161
+ }
162
+ export interface XaiBatchListParams {
163
+ limit?: number;
164
+ pagination_token?: string;
165
+ }
166
+ export interface XaiBatchRequestMetadata {
167
+ batch_request_id: string;
168
+ endpoint: string;
169
+ model: string;
170
+ state: "unknown" | "pending" | "succeeded" | "cancelled" | "failed";
171
+ create_time: string;
172
+ finish_time: string | null;
173
+ }
174
+ export interface XaiBatchRequestListResponse {
175
+ batch_request_metadata: XaiBatchRequestMetadata[];
176
+ pagination_token: string | null;
177
+ }
178
+ export interface XaiBatchRequestListParams {
179
+ limit?: number;
180
+ pagination_token?: string;
181
+ }
182
+ export interface XaiBatchRequestItem {
183
+ batch_request_id?: string | null;
184
+ batch_request: {
185
+ chat_get_completion: Record<string, unknown>;
186
+ };
187
+ }
188
+ export interface XaiBatchResultItem {
189
+ batch_request_id: string;
190
+ batch_result: Record<string, unknown>;
191
+ }
192
+ export interface XaiBatchResultListResponse {
193
+ results: XaiBatchResultItem[];
194
+ pagination_token: string | null;
195
+ }
196
+ export interface XaiBatchResultListParams {
197
+ limit?: number;
198
+ pagination_token?: string;
199
+ }
200
+ import type { XaiChunkConfiguration, XaiFieldDefinition } from "./zod";
201
+ export interface XaiCollection {
202
+ collection_id: string;
203
+ collection_name: string;
204
+ created_at: string;
205
+ index_configuration?: {
206
+ model_name: string;
207
+ };
208
+ chunk_configuration?: XaiChunkConfiguration;
209
+ documents_count?: number;
210
+ field_definitions?: XaiFieldDefinition[];
211
+ collection_description?: string;
212
+ }
213
+ export interface XaiCollectionListParams {
214
+ team_id?: string;
215
+ limit?: number;
216
+ order?: "ORDERING_ASCENDING" | "ORDERING_DESCENDING";
217
+ sort_by?: "COLLECTIONS_SORT_BY_NAME" | "COLLECTIONS_SORT_BY_AGE";
218
+ pagination_token?: string;
219
+ filter?: string;
220
+ }
221
+ export interface XaiCollectionListResponse {
222
+ collections: XaiCollection[];
223
+ pagination_token?: string;
224
+ }
225
+ export interface XaiDocumentFileMetadata {
226
+ file_id: string;
227
+ name: string;
228
+ size_bytes: string;
229
+ content_type: string;
230
+ created_at: string;
231
+ expires_at?: string | null;
232
+ hash?: string;
233
+ upload_status?: string;
234
+ upload_error_message?: string;
235
+ processing_status?: string;
236
+ file_path?: string;
237
+ }
238
+ export interface XaiDocument {
239
+ file_metadata: XaiDocumentFileMetadata;
240
+ fields?: Record<string, string>;
241
+ status: "DOCUMENT_STATUS_UNKNOWN" | "DOCUMENT_STATUS_PROCESSING" | "DOCUMENT_STATUS_PROCESSED" | "DOCUMENT_STATUS_FAILED";
242
+ error_message?: string;
243
+ last_indexed_at?: string;
244
+ }
245
+ export interface XaiDocumentListParams {
246
+ team_id?: string;
247
+ limit?: number;
248
+ order?: "ORDERING_ASCENDING" | "ORDERING_DESCENDING";
249
+ sort_by?: "DOCUMENTS_SORT_BY_NAME" | "DOCUMENTS_SORT_BY_SIZE" | "DOCUMENTS_SORT_BY_AGE";
250
+ pagination_token?: string;
251
+ filter?: string;
252
+ }
253
+ export interface XaiDocumentListResponse {
254
+ documents: XaiDocument[];
255
+ pagination_token?: string;
256
+ }
257
+ export interface XaiDocumentSearchMatch {
258
+ file_id: string;
259
+ chunk_id: string;
260
+ chunk_content: string;
261
+ score: number;
262
+ collection_ids: string[];
263
+ fields?: Record<string, string>;
264
+ page_number?: number;
265
+ }
266
+ export interface XaiDocumentSearchResponse {
267
+ matches: XaiDocumentSearchMatch[];
268
+ }
269
+ export interface XaiResponseAnnotation {
270
+ type: "url_citation" | "file_citation" | "file_path";
271
+ start_index: number;
272
+ end_index: number;
273
+ url?: string;
274
+ title?: string;
275
+ file_id?: string;
276
+ filename?: string;
277
+ }
278
+ export interface XaiResponseOutputText {
279
+ type: "output_text";
280
+ text: string;
281
+ annotations: XaiResponseAnnotation[];
282
+ }
283
+ export interface XaiResponseRefusal {
284
+ type: "refusal";
285
+ refusal: string;
286
+ }
287
+ export type XaiResponseOutputContent = XaiResponseOutputText | XaiResponseRefusal;
288
+ export interface XaiResponseOutputMessage {
289
+ type: "message";
290
+ id: string;
291
+ role: "assistant";
292
+ status: "completed" | "in_progress" | "incomplete";
293
+ content: XaiResponseOutputContent[];
294
+ }
295
+ export interface XaiResponseFunctionCallItem {
296
+ type: "function_call";
297
+ id: string;
298
+ call_id: string;
299
+ name: string;
300
+ arguments: string;
301
+ status: "completed" | "in_progress" | "incomplete";
302
+ }
303
+ export interface XaiResponseWebSearchCallItem {
304
+ type: "web_search_call";
305
+ id: string;
306
+ status: "completed";
307
+ }
308
+ export interface XaiResponseFileSearchCallItem {
309
+ type: "file_search_call";
310
+ id: string;
311
+ status: "completed";
312
+ results?: {
313
+ file_id: string;
314
+ text: string;
315
+ score: number;
316
+ }[];
317
+ }
318
+ export type XaiResponseOutputItem = XaiResponseOutputMessage | XaiResponseFunctionCallItem | XaiResponseWebSearchCallItem | XaiResponseFileSearchCallItem;
319
+ export interface XaiResponseUsage {
320
+ input_tokens: number;
321
+ output_tokens: number;
322
+ total_tokens: number;
323
+ input_tokens_details?: {
324
+ cached_tokens: number;
325
+ };
326
+ output_tokens_details?: {
327
+ reasoning_tokens: number;
328
+ };
329
+ }
330
+ import type { XaiResponseRequest, XaiResponseReasoning, XaiResponseTextFormat, XaiResponseTool } from "./zod";
331
+ export interface XaiResponseResponse {
332
+ id: string;
333
+ object: "response";
334
+ created_at: number;
335
+ completed_at: number | null;
336
+ status: "completed" | "in_progress" | "incomplete";
337
+ model: string;
338
+ output: XaiResponseOutputItem[];
339
+ instructions: string | null;
340
+ previous_response_id: string | null;
341
+ temperature: number | null;
342
+ top_p: number | null;
343
+ max_output_tokens: number | null;
344
+ store: boolean;
345
+ tools: XaiResponseTool[];
346
+ reasoning: XaiResponseReasoning | null;
347
+ text: XaiResponseTextFormat;
348
+ usage: XaiResponseUsage;
349
+ error: {
350
+ code: string;
351
+ message: string;
352
+ } | null;
353
+ incomplete_details: {
354
+ reason: string;
355
+ } | null;
356
+ metadata: Record<string, string>;
357
+ }
358
+ export interface XaiResponseDeleteResponse {
359
+ id: string;
360
+ object: "response";
361
+ deleted: boolean;
362
+ }
363
+ export interface XaiToken {
364
+ token_id: number;
365
+ string_token: string;
366
+ token_bytes: number[];
367
+ }
368
+ export interface XaiTokenizeTextResponse {
369
+ token_ids: XaiToken[];
370
+ }
371
+ export interface XaiRealtimeClientSecretResponse {
372
+ value: string;
373
+ expires_at: number;
374
+ }
375
+ export interface XaiRealtimeTurnDetection {
376
+ type: "server_vad" | null;
377
+ threshold?: number;
378
+ silence_duration_ms?: number;
379
+ prefix_padding_ms?: number;
380
+ }
381
+ export interface XaiRealtimeAudioFormat {
382
+ type?: "audio/pcm" | "audio/pcmu" | "audio/pcma";
383
+ rate?: 8000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000;
384
+ }
385
+ export interface XaiRealtimeAudioConfig {
386
+ input?: {
387
+ format?: XaiRealtimeAudioFormat;
388
+ };
389
+ output?: {
390
+ format?: XaiRealtimeAudioFormat;
391
+ };
392
+ }
393
+ export interface XaiRealtimeFunctionTool {
394
+ type: "function";
395
+ name: string;
396
+ description: string;
397
+ parameters: Record<string, unknown>;
398
+ }
399
+ export interface XaiRealtimeWebSearchTool {
400
+ type: "web_search";
401
+ }
402
+ export interface XaiRealtimeXSearchTool {
403
+ type: "x_search";
404
+ allowed_x_handles?: string[];
405
+ }
406
+ export interface XaiRealtimeFileSearchTool {
407
+ type: "file_search";
408
+ vector_store_ids: string[];
409
+ max_num_results?: number;
410
+ }
411
+ export interface XaiRealtimeMcpTool {
412
+ type: "mcp";
413
+ server_url: string;
414
+ server_label: string;
415
+ server_description?: string;
416
+ allowed_tools?: string[];
417
+ authorization?: string;
418
+ headers?: Record<string, string>;
419
+ }
420
+ export type XaiRealtimeTool = XaiRealtimeFunctionTool | XaiRealtimeWebSearchTool | XaiRealtimeXSearchTool | XaiRealtimeFileSearchTool | XaiRealtimeMcpTool;
421
+ export interface XaiRealtimeSession {
422
+ instructions?: string;
423
+ voice?: string;
424
+ turn_detection?: XaiRealtimeTurnDetection;
425
+ audio?: XaiRealtimeAudioConfig;
426
+ tools?: XaiRealtimeTool[];
427
+ }
428
+ export interface XaiRealtimeSessionUpdate {
429
+ type: "session.update";
430
+ session: XaiRealtimeSession;
431
+ }
432
+ export interface XaiRealtimeInputAudioBufferAppend {
433
+ type: "input_audio_buffer.append";
434
+ audio: string;
435
+ }
436
+ export interface XaiRealtimeInputAudioBufferCommit {
437
+ type: "input_audio_buffer.commit";
438
+ }
439
+ export interface XaiRealtimeConversationItemCreate {
440
+ type: "conversation.item.create";
441
+ previous_item_id?: string;
442
+ item: {
443
+ type: "message";
444
+ role: "user" | "assistant";
445
+ content: {
446
+ type: "input_text";
447
+ text: string;
448
+ }[];
449
+ } | {
450
+ type: "function_call_output";
451
+ call_id: string;
452
+ output: string;
453
+ };
454
+ }
455
+ export interface XaiRealtimeResponseCreate {
456
+ type: "response.create";
457
+ response?: {
458
+ modalities?: ("text" | "audio")[];
459
+ };
460
+ }
461
+ export interface XaiRealtimeResponseCancel {
462
+ type: "response.cancel";
463
+ }
464
+ export type XaiRealtimeClientEvent = XaiRealtimeSessionUpdate | XaiRealtimeInputAudioBufferAppend | XaiRealtimeInputAudioBufferCommit | XaiRealtimeConversationItemCreate | XaiRealtimeResponseCreate | XaiRealtimeResponseCancel;
465
+ export interface XaiRealtimeServerEventBase {
466
+ event_id: string;
467
+ }
468
+ export interface XaiRealtimeConversationCreated extends XaiRealtimeServerEventBase {
469
+ type: "conversation.created";
470
+ conversation: {
471
+ id: string;
472
+ object: string;
473
+ };
474
+ }
475
+ export interface XaiRealtimeSessionUpdated extends XaiRealtimeServerEventBase {
476
+ type: "session.updated";
477
+ session: XaiRealtimeSession;
478
+ }
479
+ export interface XaiRealtimeSpeechStarted extends XaiRealtimeServerEventBase {
480
+ type: "input_audio_buffer.speech_started";
481
+ item_id: string;
482
+ audio_start_ms?: number;
483
+ }
484
+ export interface XaiRealtimeSpeechStopped extends XaiRealtimeServerEventBase {
485
+ type: "input_audio_buffer.speech_stopped";
486
+ item_id: string;
487
+ audio_end_ms?: number;
488
+ }
489
+ export interface XaiRealtimeAudioBufferCommitted extends XaiRealtimeServerEventBase {
490
+ type: "input_audio_buffer.committed";
491
+ previous_item_id: string;
492
+ item_id: string;
493
+ }
494
+ export interface XaiRealtimeConversationItemAdded extends XaiRealtimeServerEventBase {
495
+ type: "conversation.item.added";
496
+ previous_item_id: string;
497
+ item: Record<string, unknown>;
498
+ }
499
+ export interface XaiRealtimeTranscriptionCompleted extends XaiRealtimeServerEventBase {
500
+ type: "conversation.item.input_audio_transcription.completed";
501
+ item_id: string;
502
+ transcript: string;
503
+ }
504
+ export interface XaiRealtimeResponseCreated extends XaiRealtimeServerEventBase {
505
+ type: "response.created";
506
+ response: {
507
+ id: string;
508
+ object: string;
509
+ status: string;
510
+ };
511
+ }
512
+ export interface XaiRealtimeResponseDone extends XaiRealtimeServerEventBase {
513
+ type: "response.done";
514
+ response: {
515
+ id: string;
516
+ object: string;
517
+ status: string;
518
+ };
519
+ }
520
+ export interface XaiRealtimeOutputItemAdded extends XaiRealtimeServerEventBase {
521
+ type: "response.output_item.added";
522
+ response_id: string;
523
+ output_index: number;
524
+ item: Record<string, unknown>;
525
+ }
526
+ export interface XaiRealtimeOutputItemDone extends XaiRealtimeServerEventBase {
527
+ type: "response.output_item.done";
528
+ response_id: string;
529
+ output_index: number;
530
+ item: Record<string, unknown>;
531
+ }
532
+ export interface XaiRealtimeAudioDelta extends XaiRealtimeServerEventBase {
533
+ type: "response.output_audio.delta";
534
+ response_id: string;
535
+ item_id: string;
536
+ output_index: number;
537
+ content_index: number;
538
+ delta: string;
539
+ }
540
+ export interface XaiRealtimeAudioDone extends XaiRealtimeServerEventBase {
541
+ type: "response.output_audio.done";
542
+ response_id: string;
543
+ item_id: string;
544
+ }
545
+ export interface XaiRealtimeAudioTranscriptDelta extends XaiRealtimeServerEventBase {
546
+ type: "response.output_audio_transcript.delta";
547
+ response_id: string;
548
+ item_id: string;
549
+ delta: string;
550
+ }
551
+ export interface XaiRealtimeAudioTranscriptDone extends XaiRealtimeServerEventBase {
552
+ type: "response.output_audio_transcript.done";
553
+ response_id: string;
554
+ item_id: string;
555
+ }
556
+ export interface XaiRealtimeTextDelta extends XaiRealtimeServerEventBase {
557
+ type: "response.text.delta";
558
+ response_id: string;
559
+ item_id: string;
560
+ delta: string;
561
+ }
562
+ export interface XaiRealtimeTextDone extends XaiRealtimeServerEventBase {
563
+ type: "response.text.done";
564
+ response_id: string;
565
+ item_id: string;
566
+ }
567
+ export interface XaiRealtimeFunctionCallDelta extends XaiRealtimeServerEventBase {
568
+ type: "response.function_call_arguments.delta";
569
+ response_id: string;
570
+ item_id: string;
571
+ call_id: string;
572
+ delta: string;
573
+ }
574
+ export interface XaiRealtimeFunctionCallDone extends XaiRealtimeServerEventBase {
575
+ type: "response.function_call_arguments.done";
576
+ response_id: string;
577
+ item_id: string;
578
+ call_id: string;
579
+ name: string;
580
+ arguments: string;
581
+ }
582
+ export interface XaiRealtimeContentPartAdded extends XaiRealtimeServerEventBase {
583
+ type: "response.content_part.added";
584
+ response_id: string;
585
+ item_id: string;
586
+ content_index: number;
587
+ part: Record<string, unknown>;
588
+ }
589
+ export interface XaiRealtimeContentPartDone extends XaiRealtimeServerEventBase {
590
+ type: "response.content_part.done";
591
+ response_id: string;
592
+ item_id: string;
593
+ content_index: number;
594
+ part: Record<string, unknown>;
595
+ }
596
+ export interface XaiRealtimeError extends XaiRealtimeServerEventBase {
597
+ type: "error";
598
+ error?: {
599
+ type?: string;
600
+ code?: string;
601
+ message?: string;
602
+ };
603
+ }
604
+ export type XaiRealtimeServerEvent = XaiRealtimeConversationCreated | XaiRealtimeSessionUpdated | XaiRealtimeSpeechStarted | XaiRealtimeSpeechStopped | XaiRealtimeAudioBufferCommitted | XaiRealtimeConversationItemAdded | XaiRealtimeTranscriptionCompleted | XaiRealtimeResponseCreated | XaiRealtimeResponseDone | XaiRealtimeOutputItemAdded | XaiRealtimeOutputItemDone | XaiRealtimeAudioDelta | XaiRealtimeAudioDone | XaiRealtimeAudioTranscriptDelta | XaiRealtimeAudioTranscriptDone | XaiRealtimeTextDelta | XaiRealtimeTextDone | XaiRealtimeFunctionCallDelta | XaiRealtimeFunctionCallDone | XaiRealtimeContentPartAdded | XaiRealtimeContentPartDone | XaiRealtimeError;
605
+ export interface XaiSttWord {
606
+ text: string;
607
+ start: number;
608
+ end: number;
609
+ }
610
+ export interface XaiSttResponse {
611
+ text: string;
612
+ language?: string;
613
+ duration?: number;
614
+ words?: XaiSttWord[];
615
+ }
616
+ export interface XaiCustomVoice {
617
+ voice_id: string;
618
+ name?: string;
619
+ language?: string;
620
+ }
621
+ export interface XaiRealtimeConnectOptions {
622
+ token?: string;
623
+ model?: string;
624
+ }
625
+ export interface XaiRealtimeConnection {
626
+ send(event: XaiRealtimeClientEvent): void;
627
+ close(): void;
628
+ [Symbol.asyncIterator](): AsyncIterableIterator<XaiRealtimeServerEvent>;
629
+ }
630
+ import type { XaiChatRequest, XaiImageGenerateRequest, XaiImageEditRequest, XaiVideoGenerateRequest, XaiVideoEditRequest, XaiVideoExtendRequest, XaiBatchCreateRequest, XaiBatchAddRequestsBody, XaiCollectionCreateRequest, XaiCollectionUpdateRequest, XaiDocumentAddRequest, XaiDocumentSearchRequest, XaiTokenizeTextRequest, XaiRealtimeClientSecretRequest, XaiTtsRequest, XaiSttRequest, XaiCustomVoiceCreateRequest } from "./zod";
631
+ interface XaiChatCompletionsMethod {
632
+ (req: XaiChatRequest, signal?: AbortSignal): Promise<XaiChatResponse>;
633
+ schema: z.ZodType<XaiChatRequest>;
634
+ }
635
+ interface XaiImageGenerationsMethod {
636
+ (req: XaiImageGenerateRequest, signal?: AbortSignal): Promise<XaiImageResponse>;
637
+ schema: z.ZodType<XaiImageGenerateRequest>;
638
+ }
639
+ interface XaiImageEditsMethod {
640
+ (req: XaiImageEditRequest, signal?: AbortSignal): Promise<XaiImageResponse>;
641
+ schema: z.ZodType<XaiImageEditRequest>;
642
+ }
643
+ interface XaiVideoGenerationsMethod {
644
+ (req: XaiVideoGenerateRequest, signal?: AbortSignal): Promise<XaiVideoAsyncResponse>;
645
+ schema: z.ZodType<XaiVideoGenerateRequest>;
646
+ }
647
+ interface XaiVideoEditsMethod {
648
+ (req: XaiVideoEditRequest, signal?: AbortSignal): Promise<XaiVideoAsyncResponse>;
649
+ schema: z.ZodType<XaiVideoEditRequest>;
650
+ }
651
+ interface XaiVideoExtensionsMethod {
652
+ (req: XaiVideoExtendRequest, signal?: AbortSignal): Promise<XaiVideoAsyncResponse>;
653
+ schema: z.ZodType<XaiVideoExtendRequest>;
654
+ }
655
+ interface XaiPostResponsesMethod {
656
+ (req: XaiResponseRequest, signal?: AbortSignal): Promise<XaiResponseResponse>;
657
+ schema: z.ZodType<XaiResponseRequest>;
658
+ }
659
+ interface XaiPostFilesMethod {
660
+ (file: Blob, filename: string, purpose?: string, signal?: AbortSignal): Promise<XaiFileObject>;
661
+ }
662
+ interface XaiPostBatchesMethod {
663
+ (req: XaiBatchCreateRequest, signal?: AbortSignal): Promise<XaiBatch>;
664
+ schema: z.ZodType<XaiBatchCreateRequest>;
665
+ cancel(batchId: string, signal?: AbortSignal): Promise<XaiBatch>;
666
+ requests(batchId: string, req: XaiBatchAddRequestsBody, signal?: AbortSignal): Promise<void>;
667
+ }
668
+ interface XaiPostCollectionsMethod {
669
+ (req: XaiCollectionCreateRequest, signal?: AbortSignal): Promise<XaiCollection>;
670
+ schema: z.ZodType<XaiCollectionCreateRequest>;
671
+ documents(collectionId: string, fileId: string, req?: XaiDocumentAddRequest, signal?: AbortSignal): Promise<void>;
672
+ }
673
+ interface XaiDocumentSearchMethod {
674
+ (req: XaiDocumentSearchRequest, signal?: AbortSignal): Promise<XaiDocumentSearchResponse>;
675
+ schema: z.ZodType<XaiDocumentSearchRequest>;
676
+ }
677
+ interface XaiTokenizeTextMethod {
678
+ (req: XaiTokenizeTextRequest, signal?: AbortSignal): Promise<XaiTokenizeTextResponse>;
679
+ schema: z.ZodType<XaiTokenizeTextRequest>;
680
+ }
681
+ interface XaiRealtimeClientSecretsMethod {
682
+ (req: XaiRealtimeClientSecretRequest, signal?: AbortSignal): Promise<XaiRealtimeClientSecretResponse>;
683
+ schema: z.ZodType<XaiRealtimeClientSecretRequest>;
684
+ }
685
+ interface XaiTtsMethod {
686
+ (req: XaiTtsRequest, signal?: AbortSignal): Promise<ArrayBuffer>;
687
+ schema: z.ZodType<XaiTtsRequest>;
688
+ }
689
+ interface XaiSttMethod {
690
+ (req: XaiSttRequest, signal?: AbortSignal): Promise<XaiSttResponse>;
691
+ schema: z.ZodType<XaiSttRequest>;
692
+ }
693
+ interface XaiCustomVoicesMethod {
694
+ (req: XaiCustomVoiceCreateRequest, signal?: AbortSignal): Promise<XaiCustomVoice>;
695
+ schema: z.ZodType<XaiCustomVoiceCreateRequest>;
696
+ }
697
+ interface XaiGetModelsLikeMethod<ListResponse, Item> {
698
+ (modelIdOrSignal?: string | AbortSignal, signal?: AbortSignal): Promise<ListResponse | Item>;
699
+ }
700
+ interface XaiPostV1 {
701
+ responses: XaiPostResponsesMethod;
702
+ chat: {
703
+ completions: XaiChatCompletionsMethod;
704
+ };
705
+ images: {
706
+ generations: XaiImageGenerationsMethod;
707
+ edits: XaiImageEditsMethod;
708
+ };
709
+ videos: {
710
+ generations: XaiVideoGenerationsMethod;
711
+ edits: XaiVideoEditsMethod;
712
+ extensions: XaiVideoExtensionsMethod;
713
+ };
714
+ files: XaiPostFilesMethod;
715
+ batches: XaiPostBatchesMethod;
716
+ collections: XaiPostCollectionsMethod;
717
+ documents: {
718
+ search: XaiDocumentSearchMethod;
719
+ };
720
+ tokenizeText: XaiTokenizeTextMethod;
721
+ realtime: {
722
+ clientSecrets: XaiRealtimeClientSecretsMethod;
723
+ };
724
+ tts: XaiTtsMethod;
725
+ stt: XaiSttMethod;
726
+ customVoices: XaiCustomVoicesMethod;
727
+ }
728
+ interface XaiGetFilesMethod {
729
+ (fileIdOrSignal?: string | AbortSignal, signal?: AbortSignal): Promise<XaiFileListResponse | XaiFileObject>;
730
+ }
731
+ interface XaiGetBatchesMethod {
732
+ (paramsOrIdOrSignal?: XaiBatchListParams | string | AbortSignal, signal?: AbortSignal): Promise<XaiBatchListResponse | XaiBatch>;
733
+ requests(batchId: string, params?: XaiBatchRequestListParams, signal?: AbortSignal): Promise<XaiBatchRequestListResponse>;
734
+ results(batchId: string, params?: XaiBatchResultListParams, signal?: AbortSignal): Promise<XaiBatchResultListResponse>;
735
+ }
736
+ interface XaiGetCollectionsDocumentsMethod {
737
+ (collectionId: string, paramsOrFileId?: XaiDocumentListParams | string | AbortSignal, signal?: AbortSignal): Promise<XaiDocumentListResponse | XaiDocument>;
738
+ batchGet(collectionId: string, fileIds: string[], signal?: AbortSignal): Promise<{
739
+ documents: XaiDocument[];
740
+ }>;
741
+ }
742
+ interface XaiGetCollectionsMethod {
743
+ (paramsOrIdOrSignal?: XaiCollectionListParams | string | AbortSignal, signal?: AbortSignal): Promise<XaiCollectionListResponse | XaiCollection>;
744
+ documents: XaiGetCollectionsDocumentsMethod;
745
+ }
746
+ interface XaiGetV1 {
747
+ responses(id: string, signal?: AbortSignal): Promise<XaiResponseResponse>;
748
+ chat: {
749
+ deferredCompletion(requestId: string, signal?: AbortSignal): Promise<XaiDeferredChatCompletionResult>;
750
+ };
751
+ videos(requestId: string, signal?: AbortSignal): Promise<XaiVideoResult>;
752
+ files: XaiGetFilesMethod;
753
+ models: XaiGetModelsLikeMethod<XaiModelListResponse, XaiModel>;
754
+ languageModels: XaiGetModelsLikeMethod<XaiLanguageModelListResponse, XaiLanguageModel>;
755
+ imageGenerationModels: XaiGetModelsLikeMethod<XaiImageGenerationModelListResponse, XaiImageGenerationModel>;
756
+ videoGenerationModels: XaiGetModelsLikeMethod<XaiVideoGenerationModelListResponse, XaiVideoGenerationModel>;
757
+ batches: XaiGetBatchesMethod;
758
+ collections: XaiGetCollectionsMethod;
759
+ }
760
+ interface XaiDeleteV1 {
761
+ responses(id: string, signal?: AbortSignal): Promise<XaiResponseDeleteResponse>;
762
+ files(fileId: string, signal?: AbortSignal): Promise<{
763
+ id: string;
764
+ deleted: boolean;
765
+ }>;
766
+ collections: {
767
+ (collectionId: string, signal?: AbortSignal): Promise<void>;
768
+ documents(collectionId: string, fileId: string, signal?: AbortSignal): Promise<void>;
769
+ };
770
+ }
771
+ interface XaiPutCollectionsMethod {
772
+ (collectionId: string, req: XaiCollectionUpdateRequest, signal?: AbortSignal): Promise<XaiCollection>;
773
+ schema: z.ZodType<XaiCollectionUpdateRequest>;
774
+ }
775
+ interface XaiPutV1 {
776
+ collections: XaiPutCollectionsMethod;
777
+ }
778
+ interface XaiPatchV1 {
779
+ collections: {
780
+ documents(collectionId: string, fileId: string, signal?: AbortSignal): Promise<void>;
781
+ };
782
+ }
783
+ interface XaiWsV1 {
784
+ realtime(opts?: XaiRealtimeConnectOptions): XaiRealtimeConnection;
785
+ }
786
+ export interface XaiProvider {
787
+ post: {
788
+ v1: XaiPostV1;
789
+ };
790
+ get: {
791
+ v1: XaiGetV1;
792
+ };
793
+ delete: {
794
+ v1: XaiDeleteV1;
795
+ };
796
+ put: {
797
+ v1: XaiPutV1;
798
+ };
799
+ patch: {
800
+ v1: XaiPatchV1;
801
+ };
802
+ ws: {
803
+ v1: XaiWsV1;
804
+ };
805
+ }
806
+ export declare class XaiError extends Error {
807
+ readonly status: number;
808
+ readonly body: unknown;
809
+ readonly code?: string;
810
+ constructor(message: string, status: number, body?: unknown, code?: string);
811
+ }
812
+ //# sourceMappingURL=types.d.ts.map