krisspy-ai 1.1.17

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,961 @@
1
+ export * from '@anthropic-ai/claude-agent-sdk';
2
+
3
+ interface ProviderConfig {
4
+ baseUrl?: string;
5
+ apiKey?: string;
6
+ defaultModel?: string;
7
+ }
8
+ interface AnthropicMessage {
9
+ role: 'user' | 'assistant';
10
+ content: string | AnthropicContentBlock[];
11
+ }
12
+ interface AnthropicTextBlock {
13
+ type: 'text';
14
+ text: string;
15
+ }
16
+ interface AnthropicImageBlock {
17
+ type: 'image';
18
+ source: {
19
+ type: 'url' | 'base64';
20
+ url?: string;
21
+ media_type?: string;
22
+ data?: string;
23
+ };
24
+ }
25
+ interface AnthropicDocumentBlock {
26
+ type: 'document';
27
+ source: {
28
+ type: 'base64' | 'file';
29
+ media_type?: string;
30
+ data?: string;
31
+ file_id?: string;
32
+ };
33
+ }
34
+ interface AnthropicToolUseBlock {
35
+ type: 'tool_use';
36
+ id: string;
37
+ name: string;
38
+ input: Record<string, unknown>;
39
+ }
40
+ interface AnthropicToolResultBlock {
41
+ type: 'tool_result';
42
+ tool_use_id: string;
43
+ content: string | unknown;
44
+ }
45
+ type AnthropicContentBlock = AnthropicTextBlock | AnthropicImageBlock | AnthropicDocumentBlock | AnthropicToolUseBlock | AnthropicToolResultBlock;
46
+ interface AnthropicTool {
47
+ name: string;
48
+ description?: string;
49
+ input_schema?: Record<string, unknown>;
50
+ }
51
+ interface AnthropicRequest {
52
+ model: string;
53
+ messages: AnthropicMessage[];
54
+ max_tokens?: number;
55
+ system?: string | Array<{
56
+ text: string;
57
+ }>;
58
+ tools?: AnthropicTool[];
59
+ tool_choice?: {
60
+ type: 'auto' | 'any' | 'tool';
61
+ name?: string;
62
+ };
63
+ stream?: boolean;
64
+ anthropic_version?: string;
65
+ }
66
+ interface AnthropicResponse {
67
+ id: string;
68
+ type: 'message';
69
+ role: 'assistant';
70
+ content: AnthropicContentBlock[];
71
+ model: string;
72
+ stop_reason: string | null;
73
+ stop_sequence: string | null;
74
+ usage: {
75
+ input_tokens: number;
76
+ output_tokens: number;
77
+ };
78
+ }
79
+ interface OpenAIMessage {
80
+ role: 'system' | 'user' | 'assistant' | 'tool';
81
+ content: string | OpenAIContentPart[] | null;
82
+ tool_calls?: OpenAIToolCall[];
83
+ tool_call_id?: string;
84
+ }
85
+ interface OpenAIContentPart {
86
+ type: 'text' | 'image_url' | 'file';
87
+ text?: string;
88
+ image_url?: {
89
+ url: string;
90
+ };
91
+ file?: {
92
+ filename: string;
93
+ file_data: string;
94
+ };
95
+ }
96
+ interface OpenAIToolCall {
97
+ id: string;
98
+ type: 'function';
99
+ function: {
100
+ name: string;
101
+ arguments: string;
102
+ };
103
+ }
104
+ interface OpenAITool {
105
+ type: 'function';
106
+ function: {
107
+ name: string;
108
+ description?: string;
109
+ parameters?: Record<string, unknown>;
110
+ };
111
+ }
112
+ interface OpenAIRequest {
113
+ model: string;
114
+ messages: OpenAIMessage[];
115
+ max_tokens?: number;
116
+ max_completion_tokens?: number;
117
+ stream?: boolean;
118
+ tools?: OpenAITool[];
119
+ tool_choice?: string | {
120
+ type: 'function';
121
+ function: {
122
+ name: string;
123
+ };
124
+ };
125
+ temperature?: number;
126
+ }
127
+ interface StreamResponse {
128
+ setHeader(name: string, value: string): void;
129
+ flushHeaders(): void;
130
+ write(chunk: string): boolean;
131
+ flush?(): void;
132
+ end(): void;
133
+ writableEnded: boolean;
134
+ }
135
+ type ProviderRequest = OpenAIRequest | AnthropicRequest;
136
+ interface Provider {
137
+ getName(): string;
138
+ mapModel(anthropicModel: string): string;
139
+ convertMessages(anthropicMessages: AnthropicMessage[]): OpenAIMessage[] | AnthropicMessage[];
140
+ convertTools(anthropicTools?: AnthropicTool[]): OpenAITool[] | AnthropicTool[] | undefined;
141
+ buildRequest(anthropicRequest: AnthropicRequest): ProviderRequest;
142
+ getEndpoint(): string;
143
+ getHeaders(): Record<string, string>;
144
+ handleStreamingResponse(providerResponse: {
145
+ body: NodeJS.ReadableStream;
146
+ }, res: StreamResponse, messageId: string, requestedModel: string): Promise<void>;
147
+ convertResponse(providerData: unknown, messageId: string, requestedModel: string): AnthropicResponse;
148
+ }
149
+
150
+ /**
151
+ * Base provider interface
152
+ * All providers must implement these methods
153
+ */
154
+ declare abstract class BaseProvider implements Provider {
155
+ protected config: ProviderConfig;
156
+ constructor(config?: ProviderConfig);
157
+ /**
158
+ * Get provider name
159
+ */
160
+ abstract getName(): string;
161
+ /**
162
+ * Convert Anthropic messages to provider format
163
+ */
164
+ abstract convertMessages(anthropicMessages: AnthropicMessage[]): OpenAIMessage[] | AnthropicMessage[];
165
+ /**
166
+ * Convert Anthropic tools to provider format
167
+ */
168
+ abstract convertTools(anthropicTools?: AnthropicTool[]): OpenAITool[] | AnthropicTool[] | undefined;
169
+ /**
170
+ * Map Anthropic model to provider model
171
+ */
172
+ abstract mapModel(anthropicModel: string): string;
173
+ /**
174
+ * Build request body for provider API
175
+ */
176
+ abstract buildRequest(anthropicRequest: AnthropicRequest): ProviderRequest;
177
+ /**
178
+ * Get API endpoint URL
179
+ */
180
+ abstract getEndpoint(): string;
181
+ /**
182
+ * Get request headers
183
+ */
184
+ abstract getHeaders(): Record<string, string>;
185
+ /**
186
+ * Handle streaming response - convert provider SSE to Anthropic SSE format
187
+ */
188
+ abstract handleStreamingResponse(providerResponse: {
189
+ body: NodeJS.ReadableStream;
190
+ }, res: StreamResponse, messageId: string, requestedModel: string): Promise<void>;
191
+ /**
192
+ * Convert non-streaming response to Anthropic format
193
+ */
194
+ abstract convertResponse(providerData: unknown, messageId: string, requestedModel: string): AnthropicResponse;
195
+ }
196
+
197
+ declare class OpenAIProvider extends BaseProvider {
198
+ protected baseUrl: string;
199
+ protected apiKey: string;
200
+ protected defaultModel: string;
201
+ protected modelMap: Record<string, string>;
202
+ constructor(config?: ProviderConfig);
203
+ getName(): string;
204
+ mapModel(anthropicModel: string): string;
205
+ convertMessages(anthropicMessages: AnthropicMessage[]): OpenAIMessage[];
206
+ convertTools(anthropicTools?: AnthropicTool[]): OpenAITool[] | undefined;
207
+ buildRequest(anthropicRequest: AnthropicRequest): OpenAIRequest;
208
+ getEndpoint(): string;
209
+ getHeaders(): Record<string, string>;
210
+ handleStreamingResponse(providerResponse: {
211
+ body: NodeJS.ReadableStream;
212
+ }, res: StreamResponse, messageId: string, requestedModel: string): Promise<void>;
213
+ convertResponse(providerData: unknown, messageId: string, requestedModel: string): AnthropicResponse;
214
+ }
215
+
216
+ declare class ZAIProvider extends BaseProvider {
217
+ protected baseUrl: string;
218
+ protected apiKey: string;
219
+ protected defaultModel: string;
220
+ protected modelMap: Record<string, string>;
221
+ constructor(config?: ProviderConfig);
222
+ getName(): string;
223
+ mapModel(anthropicModel: string): string;
224
+ convertMessages(anthropicMessages: AnthropicMessage[]): OpenAIMessage[];
225
+ convertTools(anthropicTools?: AnthropicTool[]): OpenAITool[] | undefined;
226
+ buildRequest(anthropicRequest: AnthropicRequest): OpenAIRequest;
227
+ getEndpoint(): string;
228
+ getHeaders(): Record<string, string>;
229
+ handleStreamingResponse(providerResponse: {
230
+ body: NodeJS.ReadableStream;
231
+ }, res: StreamResponse, messageId: string, requestedModel: string): Promise<void>;
232
+ convertResponse(providerData: unknown, messageId: string, requestedModel: string): AnthropicResponse;
233
+ }
234
+
235
+ declare class GeminiProvider extends OpenAIProvider {
236
+ constructor(config?: ProviderConfig);
237
+ getName(): string;
238
+ buildRequest(anthropicRequest: AnthropicRequest): OpenAIRequest;
239
+ getHeaders(): Record<string, string>;
240
+ }
241
+
242
+ interface BedrockConfig extends ProviderConfig {
243
+ accessKeyId?: string;
244
+ secretAccessKey?: string;
245
+ region?: string;
246
+ }
247
+ declare class BedrockProvider extends BaseProvider {
248
+ protected region: string;
249
+ protected accessKeyId: string;
250
+ protected secretAccessKey: string;
251
+ protected defaultModel: string;
252
+ protected modelMap: Record<string, string>;
253
+ protected currentModel: string;
254
+ constructor(config?: BedrockConfig);
255
+ getName(): string;
256
+ mapModel(anthropicModel: string): string;
257
+ convertMessages(anthropicMessages: AnthropicMessage[]): AnthropicMessage[];
258
+ convertTools(anthropicTools?: AnthropicTool[]): AnthropicTool[] | undefined;
259
+ private sign;
260
+ private getSignatureKey;
261
+ private createAuthHeaders;
262
+ buildRequest(anthropicRequest: AnthropicRequest): AnthropicRequest;
263
+ getEndpoint(): string;
264
+ getHeaders(): Record<string, string>;
265
+ getSignedHeaders(payload: string): Record<string, string>;
266
+ handleStreamingResponse(providerResponse: {
267
+ body: NodeJS.ReadableStream;
268
+ }, res: StreamResponse, messageId: string, requestedModel: string): Promise<void>;
269
+ convertResponse(providerData: unknown, messageId: string, requestedModel: string): AnthropicResponse;
270
+ }
271
+
272
+ interface AzureConfig extends ProviderConfig {
273
+ deploymentName?: string;
274
+ apiVersion?: string;
275
+ }
276
+ /**
277
+ * Azure AI Foundry Provider (formerly Azure OpenAI)
278
+ *
279
+ * Uses the OpenAI-compatible API format with Azure-specific authentication and endpoints.
280
+ *
281
+ * Required config:
282
+ * - apiKey: Azure API key
283
+ * - baseUrl: Azure endpoint (e.g., https://your-resource.openai.azure.com)
284
+ * - deploymentName: Your model deployment name
285
+ */
286
+ declare class AzureProvider extends OpenAIProvider {
287
+ protected deploymentName: string;
288
+ protected apiVersion: string;
289
+ constructor(config?: AzureConfig);
290
+ getName(): string;
291
+ mapModel(anthropicModel: string): string;
292
+ buildRequest(anthropicRequest: AnthropicRequest): OpenAIRequest;
293
+ getEndpoint(): string;
294
+ getHeaders(): Record<string, string>;
295
+ }
296
+
297
+ /**
298
+ * Krisspy Provider
299
+ * Routes requests through Krisspy backend for credit-based billing
300
+ *
301
+ * The Krisspy backend acts as a proxy that:
302
+ * 1. Validates the user's API key
303
+ * 2. Checks their credit balance
304
+ * 3. Forwards to AWS Bedrock (using Krisspy's AWS credentials)
305
+ * 4. Deducts credits based on token usage
306
+ */
307
+
308
+ interface KrisspyProviderConfig extends ProviderConfig {
309
+ /** Krisspy API key (required at runtime) */
310
+ apiKey?: string;
311
+ /** Krisspy backend URL (default: https://api.krisspy.ai) */
312
+ baseUrl?: string;
313
+ /** App ID for billing context */
314
+ appId?: string;
315
+ /** User ID for billing context */
316
+ userId?: string;
317
+ }
318
+ declare class KrisspyProvider extends BaseProvider {
319
+ private krisspyConfig;
320
+ constructor(config: KrisspyProviderConfig);
321
+ getName(): string;
322
+ /**
323
+ * Pass through model names as-is
324
+ * Krisspy backend will handle model name mapping
325
+ */
326
+ mapModel(model: string): string;
327
+ /**
328
+ * Pass through Anthropic messages as-is
329
+ * Krisspy backend expects Anthropic format
330
+ */
331
+ convertMessages(messages: AnthropicMessage[]): AnthropicMessage[];
332
+ /**
333
+ * Pass through Anthropic tools as-is
334
+ */
335
+ convertTools(tools?: AnthropicTool[]): AnthropicTool[] | undefined;
336
+ /**
337
+ * Build request - pass through as Anthropic format
338
+ * Add Krisspy-specific headers/metadata
339
+ */
340
+ buildRequest(request: AnthropicRequest): AnthropicRequest;
341
+ /**
342
+ * Get Krisspy AI proxy endpoint
343
+ * Uses /messages endpoint for transparent LLM proxying (agent runs client-side)
344
+ */
345
+ getEndpoint(): string;
346
+ /**
347
+ * Get headers with Krisspy API key
348
+ */
349
+ getHeaders(): Record<string, string>;
350
+ /**
351
+ * Handle streaming response from Krisspy backend
352
+ * The backend streams krisspy-ai events as SSE, so we parse and pass through
353
+ */
354
+ handleStreamingResponse(providerResponse: {
355
+ body: NodeJS.ReadableStream;
356
+ }, res: StreamResponse, messageId: string, requestedModel: string): Promise<void>;
357
+ /**
358
+ * Convert non-streaming response
359
+ * Krisspy backend returns Anthropic format, so minimal conversion needed
360
+ */
361
+ convertResponse(data: unknown, messageId: string, requestedModel: string): AnthropicResponse;
362
+ }
363
+
364
+ type ProviderConstructor = new (config: ProviderConfig) => Provider;
365
+ /**
366
+ * Get provider instance by name
367
+ * @param name - Provider name (openai, zai, etc.)
368
+ * @param config - Optional configuration
369
+ * @returns Provider instance
370
+ */
371
+ declare function getProvider(name: string, config?: ProviderConfig): Provider;
372
+ /**
373
+ * Register a new provider
374
+ * @param name - Provider name
375
+ * @param ProviderClass - Provider class extending BaseProvider
376
+ */
377
+ declare function registerProvider(name: string, ProviderClass: ProviderConstructor): void;
378
+ /**
379
+ * Get list of available providers
380
+ * @returns Provider names
381
+ */
382
+ declare function getAvailableProviders(): string[];
383
+
384
+ interface GenerativeServiceConfig {
385
+ apiKey?: string;
386
+ baseUrl?: string;
387
+ apiVersion?: string;
388
+ deploymentName?: string;
389
+ }
390
+ interface ImageGenerationOptions {
391
+ prompt: string;
392
+ n?: number;
393
+ size?: '1024x1024' | '1792x1024' | '1024x1792';
394
+ quality?: 'standard' | 'hd';
395
+ style?: 'natural' | 'vivid';
396
+ responseFormat?: 'url' | 'b64_json';
397
+ user?: string;
398
+ }
399
+ interface GeneratedImage {
400
+ url?: string;
401
+ b64_json?: string;
402
+ revisedPrompt?: string;
403
+ }
404
+ interface ImageGenerationResult {
405
+ created: number;
406
+ data: GeneratedImage[];
407
+ }
408
+ interface VideoGenerationOptions {
409
+ prompt: string;
410
+ duration?: number;
411
+ width?: number;
412
+ height?: number;
413
+ nVariants?: number;
414
+ user?: string;
415
+ referenceImage?: string;
416
+ referenceImageFormat?: 'base64' | 'url';
417
+ }
418
+ type VideoJobStatusType = 'pending' | 'running' | 'succeeded' | 'failed' | 'canceled';
419
+ interface VideoJobSubmission {
420
+ jobId: string;
421
+ status: VideoJobStatusType;
422
+ createdAt: string;
423
+ }
424
+ interface VideoJobStatus {
425
+ jobId: string;
426
+ status: VideoJobStatusType;
427
+ progress?: number;
428
+ error?: string;
429
+ createdAt: string;
430
+ expiresAt?: string;
431
+ }
432
+ interface GeneratedVideo {
433
+ id: string;
434
+ url?: string;
435
+ }
436
+ interface VideoGenerationResult {
437
+ jobId: string;
438
+ status: 'succeeded';
439
+ generations: GeneratedVideo[];
440
+ createdAt: string;
441
+ }
442
+ interface GenerateImageOptions extends ImageGenerationOptions {
443
+ service?: string;
444
+ apiKey: string;
445
+ baseUrl?: string;
446
+ deploymentName?: string;
447
+ apiVersion?: string;
448
+ }
449
+ interface GenerateVideoOptions extends VideoGenerationOptions {
450
+ service?: string;
451
+ apiKey: string;
452
+ baseUrl?: string;
453
+ deploymentName?: string;
454
+ apiVersion?: string;
455
+ pollInterval?: number;
456
+ timeout?: number;
457
+ }
458
+ type VideoGenerationEvent = {
459
+ type: 'status';
460
+ status: VideoJobStatus;
461
+ } | {
462
+ type: 'result';
463
+ data: VideoGenerationResult;
464
+ };
465
+ interface TranscriptionOptions {
466
+ audio: Buffer | string;
467
+ language?: string;
468
+ prompt?: string;
469
+ responseFormat?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
470
+ temperature?: number;
471
+ timestampGranularities?: ('word' | 'segment')[];
472
+ }
473
+ interface TranscriptionWord {
474
+ word: string;
475
+ start: number;
476
+ end: number;
477
+ }
478
+ interface TranscriptionSegment {
479
+ id: number;
480
+ seek: number;
481
+ start: number;
482
+ end: number;
483
+ text: string;
484
+ tokens: number[];
485
+ temperature: number;
486
+ avg_logprob: number;
487
+ compression_ratio: number;
488
+ no_speech_prob: number;
489
+ }
490
+ interface DiarizedUtterance {
491
+ speaker: string;
492
+ start: number;
493
+ end: number;
494
+ text: string;
495
+ }
496
+ interface TranscriptionResult {
497
+ text: string;
498
+ language?: string;
499
+ duration?: number;
500
+ words?: TranscriptionWord[];
501
+ segments?: TranscriptionSegment[];
502
+ utterances?: DiarizedUtterance[];
503
+ }
504
+ type TTSVoice = 'alloy' | 'ash' | 'coral' | 'echo' | 'fable' | 'onyx' | 'nova' | 'sage' | 'shimmer';
505
+ type TTSFormat = 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';
506
+ interface TTSOptions {
507
+ input: string;
508
+ voice?: TTSVoice;
509
+ responseFormat?: TTSFormat;
510
+ speed?: number;
511
+ instructions?: string;
512
+ }
513
+ interface TTSResult {
514
+ audio: Buffer;
515
+ format: TTSFormat;
516
+ }
517
+ interface TranscribeOptions extends TranscriptionOptions {
518
+ service?: string;
519
+ apiKey: string;
520
+ baseUrl?: string;
521
+ deploymentName?: string;
522
+ apiVersion?: string;
523
+ }
524
+ interface SynthesizeOptions extends TTSOptions {
525
+ service?: string;
526
+ apiKey: string;
527
+ baseUrl?: string;
528
+ deploymentName?: string;
529
+ apiVersion?: string;
530
+ }
531
+
532
+ declare abstract class BaseGenerativeService {
533
+ protected config: GenerativeServiceConfig;
534
+ constructor(config?: GenerativeServiceConfig);
535
+ abstract getName(): string;
536
+ abstract getServiceType(): 'image' | 'video' | 'transcription' | 'tts';
537
+ }
538
+
539
+ declare abstract class BaseImageService extends BaseGenerativeService {
540
+ constructor(config?: GenerativeServiceConfig);
541
+ getServiceType(): 'image';
542
+ abstract generate(options: ImageGenerationOptions): Promise<ImageGenerationResult>;
543
+ }
544
+
545
+ declare abstract class BaseVideoService extends BaseGenerativeService {
546
+ constructor(config?: GenerativeServiceConfig);
547
+ getServiceType(): 'video';
548
+ abstract submitJob(options: VideoGenerationOptions): Promise<VideoJobSubmission>;
549
+ abstract getJobStatus(jobId: string): Promise<VideoJobStatus>;
550
+ abstract getResult(jobId: string): Promise<VideoGenerationResult>;
551
+ abstract downloadVideo(generationId: string): Promise<Buffer>;
552
+ /**
553
+ * Convenience generator that submits a job and polls until completion.
554
+ * Yields status updates and returns the final result.
555
+ *
556
+ * @param options - Video generation options
557
+ * @param pollInterval - Time between status checks in ms (default: 5000)
558
+ * @param timeout - Max wait time in ms (default: 600000 = 10 minutes)
559
+ */
560
+ generateAndWait(options: VideoGenerationOptions, pollInterval?: number, timeout?: number): AsyncGenerator<VideoJobStatus, VideoGenerationResult>;
561
+ }
562
+
563
+ /**
564
+ * Base class for speech-to-text transcription services
565
+ */
566
+ declare abstract class BaseTranscriptionService extends BaseGenerativeService {
567
+ constructor(config?: GenerativeServiceConfig);
568
+ getServiceType(): 'transcription';
569
+ abstract transcribe(options: TranscriptionOptions): Promise<TranscriptionResult>;
570
+ }
571
+ /**
572
+ * Base class for text-to-speech synthesis services
573
+ */
574
+ declare abstract class BaseTTSService extends BaseGenerativeService {
575
+ constructor(config?: GenerativeServiceConfig);
576
+ getServiceType(): 'tts';
577
+ abstract synthesize(options: TTSOptions): Promise<TTSResult>;
578
+ }
579
+
580
+ declare class AzureDalleService extends BaseImageService {
581
+ private baseUrl;
582
+ private apiKey;
583
+ private deploymentName;
584
+ private apiVersion;
585
+ constructor(config?: GenerativeServiceConfig);
586
+ getName(): string;
587
+ generate(options: ImageGenerationOptions): Promise<ImageGenerationResult>;
588
+ }
589
+
590
+ declare class OpenAIImageService extends BaseImageService {
591
+ private apiKey;
592
+ private baseUrl;
593
+ private model;
594
+ constructor(config?: GenerativeServiceConfig);
595
+ getName(): string;
596
+ generate(options: ImageGenerationOptions): Promise<ImageGenerationResult>;
597
+ }
598
+
599
+ declare class AzureSoraService extends BaseVideoService {
600
+ private baseUrl;
601
+ private apiKey;
602
+ private deploymentName;
603
+ private apiVersion;
604
+ constructor(config?: GenerativeServiceConfig);
605
+ getName(): string;
606
+ private mapStatus;
607
+ submitJob(options: VideoGenerationOptions): Promise<VideoJobSubmission>;
608
+ getJobStatus(jobId: string): Promise<VideoJobStatus>;
609
+ getResult(jobId: string): Promise<VideoGenerationResult>;
610
+ downloadVideo(generationId: string): Promise<Buffer>;
611
+ }
612
+
613
+ declare class OpenAISoraService extends BaseVideoService {
614
+ private baseUrl;
615
+ private apiKey;
616
+ private model;
617
+ constructor(config?: GenerativeServiceConfig);
618
+ getName(): string;
619
+ private mapStatus;
620
+ submitJob(options: VideoGenerationOptions): Promise<VideoJobSubmission>;
621
+ getJobStatus(jobId: string): Promise<VideoJobStatus>;
622
+ getResult(jobId: string): Promise<VideoGenerationResult>;
623
+ downloadVideo(generationId: string): Promise<Buffer>;
624
+ }
625
+
626
+ declare class AzureTranscriptionService extends BaseTranscriptionService {
627
+ private baseUrl;
628
+ private apiKey;
629
+ private deploymentName;
630
+ private apiVersion;
631
+ constructor(config?: GenerativeServiceConfig);
632
+ getName(): string;
633
+ transcribe(options: TranscriptionOptions): Promise<TranscriptionResult>;
634
+ }
635
+
636
+ declare class OpenAITranscriptionService extends BaseTranscriptionService {
637
+ private baseUrl;
638
+ private apiKey;
639
+ private model;
640
+ constructor(config?: GenerativeServiceConfig);
641
+ getName(): string;
642
+ transcribe(options: TranscriptionOptions): Promise<TranscriptionResult>;
643
+ }
644
+
645
+ declare class AzureTTSService extends BaseTTSService {
646
+ private baseUrl;
647
+ private apiKey;
648
+ private deploymentName;
649
+ private apiVersion;
650
+ constructor(config?: GenerativeServiceConfig);
651
+ getName(): string;
652
+ synthesize(options: TTSOptions): Promise<TTSResult>;
653
+ }
654
+
655
+ declare class OpenAITTSService extends BaseTTSService {
656
+ private baseUrl;
657
+ private apiKey;
658
+ private model;
659
+ constructor(config?: GenerativeServiceConfig);
660
+ getName(): string;
661
+ synthesize(options: TTSOptions): Promise<TTSResult>;
662
+ }
663
+
664
+ type ImageServiceConstructor = new (config: GenerativeServiceConfig) => BaseImageService;
665
+ type VideoServiceConstructor = new (config: GenerativeServiceConfig) => BaseVideoService;
666
+ type TranscriptionServiceConstructor = new (config: GenerativeServiceConfig) => BaseTranscriptionService;
667
+ type TTSServiceConstructor = new (config: GenerativeServiceConfig) => BaseTTSService;
668
+ /**
669
+ * Get an image generation service by name
670
+ *
671
+ * @param name - Service name: 'azure', 'openai', 'gpt-image'
672
+ * @param config - Service configuration
673
+ * @returns Image service instance
674
+ */
675
+ declare function getImageService(name: string, config?: GenerativeServiceConfig): BaseImageService;
676
+ /**
677
+ * Get a video generation service by name
678
+ *
679
+ * @param name - Service name: 'azure', 'openai', 'sora'
680
+ * @param config - Service configuration
681
+ * @returns Video service instance
682
+ */
683
+ declare function getVideoService(name: string, config?: GenerativeServiceConfig): BaseVideoService;
684
+ /**
685
+ * Get a transcription (speech-to-text) service by name
686
+ *
687
+ * @param name - Service name: 'azure', 'openai', 'whisper', 'gpt-4o-transcribe', 'gpt-4o-transcribe-diarize'
688
+ * @param config - Service configuration
689
+ * @returns Transcription service instance
690
+ *
691
+ * @example
692
+ * const service = getTranscriptionService('openai', {
693
+ * apiKey: 'sk-...',
694
+ * deploymentName: 'whisper' // or 'gpt-4o-transcribe-diarize'
695
+ * });
696
+ * const result = await service.transcribe({ audio: audioBuffer });
697
+ */
698
+ declare function getTranscriptionService(name: string, config?: GenerativeServiceConfig): BaseTranscriptionService;
699
+ /**
700
+ * Get a TTS (text-to-speech) service by name
701
+ *
702
+ * @param name - Service name: 'azure', 'openai', 'tts', 'tts', 'gpt-4o-mini-tts'
703
+ * @param config - Service configuration
704
+ * @returns TTS service instance
705
+ *
706
+ * @example
707
+ * const service = getTTSService('openai', {
708
+ * apiKey: 'sk-...',
709
+ * deploymentName: 'gpt-4o-mini-tts'
710
+ * });
711
+ * const result = await service.synthesize({ input: 'Hello world', voice: 'nova' });
712
+ */
713
+ declare function getTTSService(name: string, config?: GenerativeServiceConfig): BaseTTSService;
714
+ /**
715
+ * Register a custom image generation service
716
+ */
717
+ declare function registerImageService(name: string, ServiceClass: ImageServiceConstructor): void;
718
+ /**
719
+ * Register a custom video generation service
720
+ */
721
+ declare function registerVideoService(name: string, ServiceClass: VideoServiceConstructor): void;
722
+ /**
723
+ * Register a custom transcription service
724
+ */
725
+ declare function registerTranscriptionService(name: string, ServiceClass: TranscriptionServiceConstructor): void;
726
+ /**
727
+ * Register a custom TTS service
728
+ */
729
+ declare function registerTTSService(name: string, ServiceClass: TTSServiceConstructor): void;
730
+ declare function getAvailableImageServices(): string[];
731
+ declare function getAvailableVideoServices(): string[];
732
+ declare function getAvailableTranscriptionServices(): string[];
733
+ declare function getAvailableTTSServices(): string[];
734
+
735
+ interface FileAttachment {
736
+ type: 'pdf' | 'xlsx' | 'docx' | 'pptx' | 'csv' | 'unknown';
737
+ media_type: string;
738
+ data: string;
739
+ }
740
+ interface ImageAttachment {
741
+ type: 'url' | 'base64';
742
+ url?: string;
743
+ media_type?: string;
744
+ data?: string;
745
+ }
746
+ type ProviderType = 'claude_cli' | 'anthropic' | 'openai' | 'gemini' | 'zai' | 'zai_direct' | 'bedrock' | 'azure' | 'codex' | 'codex_cli' | 'krisspy';
747
+ interface MCPServerConfigStdio {
748
+ command: string;
749
+ args?: string[];
750
+ env?: Record<string, string>;
751
+ cwd?: string;
752
+ }
753
+ interface MCPServerConfigHttp {
754
+ type: 'http';
755
+ url: string;
756
+ headers?: Record<string, string>;
757
+ }
758
+ type MCPServerConfig = MCPServerConfigStdio | MCPServerConfigHttp;
759
+ interface HookConfig {
760
+ command: string;
761
+ timeout?: number;
762
+ }
763
+ interface HooksConfig {
764
+ onStart?: HookConfig;
765
+ onStop?: HookConfig;
766
+ onToolCall?: HookConfig;
767
+ onToolResult?: HookConfig;
768
+ }
769
+ interface AgentConfig {
770
+ name: string;
771
+ model?: string;
772
+ systemPrompt?: string;
773
+ tools?: string[];
774
+ }
775
+ interface KrissyQueryOptions {
776
+ [key: string]: unknown;
777
+ provider?: ProviderType;
778
+ model?: string;
779
+ apiKey?: string;
780
+ baseUrl?: string;
781
+ attachments?: {
782
+ images?: Array<ImageAttachment>;
783
+ files?: Array<FileAttachment>;
784
+ };
785
+ maxThinkingTokens?: number;
786
+ mcpServers?: Record<string, MCPServerConfig>;
787
+ betas?: string[];
788
+ allowedTools?: string[];
789
+ permissionMode?: 'default' | 'acceptEdits' | 'plan' | 'bypassPermissions';
790
+ systemPrompt?: string | {
791
+ type: 'preset';
792
+ preset: string;
793
+ } | {
794
+ type: 'custom';
795
+ content: string;
796
+ };
797
+ cwd?: string;
798
+ env?: Record<string, string>;
799
+ hooks?: HooksConfig;
800
+ agents?: Record<string, AgentConfig>;
801
+ maxTurns?: number;
802
+ maxBudgetUsd?: number;
803
+ outputFormat?: 'text' | 'json' | 'stream-json';
804
+ resume?: string;
805
+ sandbox?: boolean;
806
+ includePartialMessages?: boolean;
807
+ accessKeyId?: string;
808
+ secretAccessKey?: string;
809
+ region?: string;
810
+ deploymentName?: string;
811
+ apiVersion?: string;
812
+ }
813
+ /**
814
+ * query() - Drop-in replacement for claude-agent-sdk's query()
815
+ *
816
+ * Same API as @anthropic-ai/claude-agent-sdk but with:
817
+ * - Multi-provider support via options.provider
818
+ * - Integrated proxy for OpenAI/Gemini/ZAI (no separate server needed)
819
+ * - Multimodal support via options.attachments
820
+ * - All configuration via explicit options (no env vars required)
821
+ *
822
+ * @example
823
+ * // Use OpenAI with explicit API key
824
+ * for await (const event of query({
825
+ * prompt: 'Hello',
826
+ * options: {
827
+ * provider: 'openai',
828
+ * apiKey: 'sk-...',
829
+ * model: 'gpt-4o'
830
+ * }
831
+ * })) {
832
+ * console.log(event);
833
+ * }
834
+ *
835
+ * @example
836
+ * // Use Anthropic directly
837
+ * for await (const event of query({
838
+ * prompt: 'Hello',
839
+ * options: {
840
+ * provider: 'anthropic',
841
+ * apiKey: 'sk-ant-...'
842
+ * }
843
+ * })) {
844
+ * console.log(event);
845
+ * }
846
+ */
847
+ declare function query(params: {
848
+ prompt: string | AsyncIterable<unknown>;
849
+ options?: KrissyQueryOptions;
850
+ }): AsyncGenerator<unknown, void, unknown>;
851
+ declare function cleanup(): Promise<void>;
852
+
853
+ /**
854
+ * Generate an image using the specified service
855
+ *
856
+ * @param options - Image generation options
857
+ * @returns Promise resolving to image generation result
858
+ *
859
+ * @example
860
+ * const result = await generateImage({
861
+ * prompt: 'A cute baby polar bear',
862
+ * apiKey: 'your-azure-key',
863
+ * baseUrl: 'https://your-resource.openai.azure.com',
864
+ * deploymentName: 'gpt-image-1.5',
865
+ * size: '1024x1024',
866
+ * });
867
+ * console.log(result.data[0].url);
868
+ *
869
+ * // Save to file
870
+ * const imageUrl = result.data[0].url;
871
+ * // or if using b64_json:
872
+ * const imageBuffer = Buffer.from(result.data[0].b64_json!, 'base64');
873
+ */
874
+ declare function generateImage(options: GenerateImageOptions): Promise<ImageGenerationResult>;
875
+ /**
876
+ * Generate a video using the specified service (async with polling)
877
+ *
878
+ * This is an async generator that yields status updates and finally the result.
879
+ *
880
+ * @param options - Video generation options
881
+ * @yields Status updates as { type: 'status', status: VideoJobStatus }
882
+ * @yields Final result as { type: 'result', data: VideoGenerationResult }
883
+ *
884
+ * @example
885
+ * for await (const event of generateVideo({
886
+ * prompt: 'Wooly mammoths slowly walking in the ice',
887
+ * apiKey: 'your-azure-key',
888
+ * baseUrl: 'https://your-resource.openai.azure.com',
889
+ * deploymentName: 'sora-2',
890
+ * duration: 5,
891
+ * })) {
892
+ * if (event.type === 'status') {
893
+ * console.log(`Status: ${event.status.status}`);
894
+ * } else if (event.type === 'result') {
895
+ * console.log(`Video ready! Generation ID: ${event.data.generations[0].id}`);
896
+ * // Download the video
897
+ * const videoService = getVideoService('azure', { apiKey, baseUrl });
898
+ * const videoBuffer = await videoService.downloadVideo(event.data.generations[0].id);
899
+ * fs.writeFileSync('output.mp4', videoBuffer);
900
+ * }
901
+ * }
902
+ */
903
+ declare function generateVideo(options: GenerateVideoOptions): AsyncGenerator<VideoGenerationEvent>;
904
+ /**
905
+ * Transcribe audio to text using the specified service
906
+ *
907
+ * @param options - Transcription options
908
+ * @returns Promise resolving to transcription result
909
+ *
910
+ * @example
911
+ * // Using OpenAI Whisper
912
+ * const result = await transcribe({
913
+ * audio: fs.readFileSync('audio.mp3'),
914
+ * apiKey: 'sk-...',
915
+ * deploymentName: 'whisper',
916
+ * });
917
+ * console.log(result.text);
918
+ *
919
+ * @example
920
+ * // Using GPT-4o with diarization (speaker identification)
921
+ * const result = await transcribe({
922
+ * audio: fs.readFileSync('meeting.mp3'),
923
+ * apiKey: 'sk-...',
924
+ * deploymentName: 'gpt-4o-transcribe-diarize',
925
+ * responseFormat: 'verbose_json',
926
+ * });
927
+ * for (const utterance of result.utterances || []) {
928
+ * console.log(`${utterance.speaker}: ${utterance.text}`);
929
+ * }
930
+ */
931
+ declare function transcribe(options: TranscribeOptions): Promise<TranscriptionResult>;
932
+ /**
933
+ * Synthesize speech from text using the specified service
934
+ *
935
+ * @param options - TTS options
936
+ * @returns Promise resolving to audio buffer
937
+ *
938
+ * @example
939
+ * // Using OpenAI TTS
940
+ * const result = await synthesize({
941
+ * input: 'Hello, how are you today?',
942
+ * apiKey: 'sk-...',
943
+ * voice: 'nova',
944
+ * responseFormat: 'mp3',
945
+ * });
946
+ * fs.writeFileSync('output.mp3', result.audio);
947
+ *
948
+ * @example
949
+ * // Using gpt-4o-mini-tts with voice style instructions
950
+ * const result = await synthesize({
951
+ * input: 'Welcome to our podcast!',
952
+ * apiKey: 'sk-...',
953
+ * deploymentName: 'gpt-4o-mini-tts',
954
+ * voice: 'coral',
955
+ * instructions: 'Speak in an enthusiastic, energetic podcast host style',
956
+ * });
957
+ * fs.writeFileSync('intro.mp3', result.audio);
958
+ */
959
+ declare function synthesize(options: SynthesizeOptions): Promise<TTSResult>;
960
+
961
+ export { type AgentConfig, type AnthropicMessage, type AnthropicRequest, type AnthropicResponse, AzureDalleService, AzureProvider, AzureSoraService, AzureTTSService, AzureTranscriptionService, BaseGenerativeService, BaseImageService, BaseProvider, BaseTTSService, BaseTranscriptionService, BaseVideoService, BedrockProvider, type DiarizedUtterance, GeminiProvider, type GenerateImageOptions, type GenerateVideoOptions, type GeneratedImage, type GeneratedVideo, type GenerativeServiceConfig, type HookConfig, type HooksConfig, type ImageGenerationOptions, type ImageGenerationResult, KrisspyProvider, type KrissyQueryOptions, type MCPServerConfig, type MCPServerConfigHttp, type MCPServerConfigStdio, OpenAIImageService, type OpenAIMessage, OpenAIProvider, type OpenAIRequest, OpenAISoraService, OpenAITTSService, OpenAITranscriptionService, type Provider, type ProviderConfig, type ProviderType, type SynthesizeOptions, type TTSFormat, type TTSOptions, type TTSResult, type TTSVoice, type TranscribeOptions, type TranscriptionOptions, type TranscriptionResult, type TranscriptionSegment, type TranscriptionWord, type VideoGenerationEvent, type VideoGenerationOptions, type VideoGenerationResult, type VideoJobStatus, type VideoJobSubmission, ZAIProvider, cleanup, generateImage, generateVideo, getAvailableImageServices, getAvailableProviders, getAvailableTTSServices, getAvailableTranscriptionServices, getAvailableVideoServices, getImageService, getProvider, getTTSService, getTranscriptionService, getVideoService, query, registerImageService, registerProvider, registerTTSService, registerTranscriptionService, registerVideoService, synthesize, transcribe };