@dazl/api-client 1.0.27 → 1.0.28

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.
@@ -35,6 +35,10 @@ export type PromotionNames = {
35
35
  'PRO_FEATURE_SET_BY_ADMIN'
36
36
  ];
37
37
  };
38
+ export type StreamTextChunk = {
39
+ type: 'text-delta' | 'reasoning-delta';
40
+ text: string;
41
+ };
38
42
  export type UserRaw = {
39
43
  id: number;
40
44
  createdAt: string;
@@ -533,6 +537,303 @@ export type ConnectionStatus = {
533
537
  integrationName: IntegrationName;
534
538
  isConnected: boolean;
535
539
  };
540
+ export type GenerateTextResponse = {
541
+ text: string;
542
+ output?: unknown;
543
+ reasoningText?: string;
544
+ /**
545
+ * Tool calls in ToolCallPart shape, directly reusable as assistant message content parts
546
+ */
547
+ toolCalls: Array<ToolCallPart>;
548
+ usage: TextGenerationUsage;
549
+ finishReason: FinishReason;
550
+ providerMetadata?: ProviderMetadata;
551
+ files?: Array<GeneratedFile>;
552
+ };
553
+ export type ToolCallPart = {
554
+ type: 'tool-call';
555
+ toolCallId: string;
556
+ toolName: string;
557
+ input?: unknown;
558
+ providerExecuted?: boolean;
559
+ providerOptions?: ProviderOptions;
560
+ };
561
+ /**
562
+ * Provider-specific options passed through to the underlying provider, keyed by provider name
563
+ */
564
+ export type ProviderOptions = {
565
+ [key: string]: {
566
+ [key: string]: unknown;
567
+ };
568
+ };
569
+ export type TextGenerationUsage = {
570
+ /**
571
+ * Model that actually served the request
572
+ */
573
+ model: 'claude-sonnet-5-anthropic' | 'claude-sonnet-5-vertex' | 'claude-sonnet-4-6-anthropic' | 'claude-sonnet-4-6-vertex' | 'claude-opus-4-8-anthropic' | 'claude-opus-4-8-vertex' | 'claude-opus-4-7-anthropic' | 'claude-opus-4-7-vertex' | 'claude-haiku-4-5-anthropic' | 'claude-haiku-4-5-vertex' | 'gemini-3-0-flash-vertex' | 'gemini-3-5-flash-vertex' | 'gemini-3-1-pro-vertex' | 'qwen-3-coder-openrouter' | 'qwen-3-coder-next-openrouter' | 'qwen-3-6-plus-openrouter' | 'qwen-3-5-flash-openrouter' | 'grok-code-fast-openrouter' | 'deepseek-v3-1-openrouter' | 'deepseek-v4-pro-openrouter' | 'deepseek-v4-flash-openrouter' | 'kimi-k-2-6-openrouter' | 'gpt-5-5-bedrock' | 'gpt-5-4-bedrock' | 'grok-4-3-bedrock' | 'glm-5-bedrock' | 'gpt-5-4-nano-openrouter' | 'gpt-5-4-mini-openrouter' | 'gpt-5-3-codex-openrouter' | 'minimax-m-2-7-openrouter' | 'hy3-preview-openrouter' | 'gemini-3-0-pro-image' | 'gemini-3-1-flash-image';
574
+ inputTokens: number;
575
+ inputTokensCost: number;
576
+ outputTokens: number;
577
+ outputTokensCost: number;
578
+ cacheWriteTokens: number;
579
+ cacheWriteTokensCost: number;
580
+ cacheReadTokens: number;
581
+ cacheReadTokensCost: number;
582
+ totalCost: number;
583
+ };
584
+ export type FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
585
+ /**
586
+ * Provider-specific metadata returned by the underlying provider, keyed by provider name
587
+ */
588
+ export type ProviderMetadata = {
589
+ [key: string]: {
590
+ [key: string]: unknown;
591
+ };
592
+ };
593
+ export type GeneratedFile = {
594
+ base64: string;
595
+ mediaType: string;
596
+ };
597
+ export type GenerateTextRequest = {
598
+ /**
599
+ * Primary model id
600
+ */
601
+ model: 'claude-sonnet-5-anthropic' | 'claude-sonnet-5-vertex' | 'claude-sonnet-4-6-anthropic' | 'claude-sonnet-4-6-vertex' | 'claude-opus-4-8-anthropic' | 'claude-opus-4-8-vertex' | 'claude-opus-4-7-anthropic' | 'claude-opus-4-7-vertex' | 'claude-haiku-4-5-anthropic' | 'claude-haiku-4-5-vertex' | 'gemini-3-0-flash-vertex' | 'gemini-3-5-flash-vertex' | 'gemini-3-1-pro-vertex' | 'qwen-3-coder-openrouter' | 'qwen-3-coder-next-openrouter' | 'qwen-3-6-plus-openrouter' | 'qwen-3-5-flash-openrouter' | 'grok-code-fast-openrouter' | 'deepseek-v3-1-openrouter' | 'deepseek-v4-pro-openrouter' | 'deepseek-v4-flash-openrouter' | 'kimi-k-2-6-openrouter' | 'gpt-5-5-bedrock' | 'gpt-5-4-bedrock' | 'grok-4-3-bedrock' | 'glm-5-bedrock' | 'gpt-5-4-nano-openrouter' | 'gpt-5-4-mini-openrouter' | 'gpt-5-3-codex-openrouter' | 'minimax-m-2-7-openrouter' | 'hy3-preview-openrouter' | 'gemini-3-0-pro-image' | 'gemini-3-1-flash-image';
602
+ /**
603
+ * Ordered fallback models, tried when the primary model fails before any output is produced
604
+ */
605
+ fallbackModels?: Array<TextGenerationModelId>;
606
+ /**
607
+ * Conversation messages: user, assistant, and tool
608
+ */
609
+ messages: Array<ModelMessage>;
610
+ /**
611
+ * System prompt: plain string, a single system message, or an array of system messages
612
+ */
613
+ system?: string | SystemModelMessage | Array<SystemModelMessage>;
614
+ /**
615
+ * Tool definitions available to the model, keyed by tool name
616
+ */
617
+ tools?: {
618
+ [key: string]: ToolDefinition;
619
+ };
620
+ /**
621
+ * Subset of tool names from tools enabled for this call
622
+ */
623
+ activeTools?: Array<string>;
624
+ reasoning?: ReasoningEffort;
625
+ maxOutputTokens?: number;
626
+ temperature?: number;
627
+ maxRetries?: number;
628
+ providerOptions?: ProviderOptions;
629
+ output?: TextGenerationOutput;
630
+ /**
631
+ * Correlation id attached to the operation logs; generated when omitted
632
+ */
633
+ opId?: string;
634
+ };
635
+ export type TextGenerationModelId = 'claude-sonnet-5-anthropic' | 'claude-sonnet-5-vertex' | 'claude-sonnet-4-6-anthropic' | 'claude-sonnet-4-6-vertex' | 'claude-opus-4-8-anthropic' | 'claude-opus-4-8-vertex' | 'claude-opus-4-7-anthropic' | 'claude-opus-4-7-vertex' | 'claude-haiku-4-5-anthropic' | 'claude-haiku-4-5-vertex' | 'gemini-3-0-flash-vertex' | 'gemini-3-5-flash-vertex' | 'gemini-3-1-pro-vertex' | 'qwen-3-coder-openrouter' | 'qwen-3-coder-next-openrouter' | 'qwen-3-6-plus-openrouter' | 'qwen-3-5-flash-openrouter' | 'grok-code-fast-openrouter' | 'deepseek-v3-1-openrouter' | 'deepseek-v4-pro-openrouter' | 'deepseek-v4-flash-openrouter' | 'kimi-k-2-6-openrouter' | 'gpt-5-5-bedrock' | 'gpt-5-4-bedrock' | 'grok-4-3-bedrock' | 'glm-5-bedrock' | 'gpt-5-4-nano-openrouter' | 'gpt-5-4-mini-openrouter' | 'gpt-5-3-codex-openrouter' | 'minimax-m-2-7-openrouter' | 'hy3-preview-openrouter' | 'gemini-3-0-pro-image' | 'gemini-3-1-flash-image';
636
+ export type ModelMessage = ({
637
+ role: 'user';
638
+ } & UserModelMessage) | ({
639
+ role: 'assistant';
640
+ } & AssistantModelMessage) | ({
641
+ role: 'tool';
642
+ } & ToolModelMessage);
643
+ export type UserModelMessage = {
644
+ role: 'user';
645
+ content: string | Array<TextPart | ImagePart | FilePart>;
646
+ providerOptions?: ProviderOptions;
647
+ };
648
+ export type TextPart = {
649
+ type: 'text';
650
+ text: string;
651
+ providerOptions?: ProviderOptions;
652
+ };
653
+ export type ImagePart = {
654
+ type: 'image';
655
+ /**
656
+ * Base64-encoded image data, a data url, or an http(s) url
657
+ */
658
+ image: string;
659
+ mediaType?: string;
660
+ providerOptions?: ProviderOptions;
661
+ };
662
+ export type FilePart = {
663
+ type: 'file';
664
+ /**
665
+ * Base64-encoded file data, a data url, or an http(s) url
666
+ */
667
+ data: string;
668
+ filename?: string;
669
+ /**
670
+ * IANA media type (e.g. image/png) or top-level segment (e.g. image)
671
+ */
672
+ mediaType: string;
673
+ providerOptions?: ProviderOptions;
674
+ };
675
+ export type AssistantModelMessage = {
676
+ role: 'assistant';
677
+ content: string | Array<TextPart | ReasoningPart | FilePart | ToolCallPart>;
678
+ providerOptions?: ProviderOptions;
679
+ };
680
+ export type ReasoningPart = {
681
+ type: 'reasoning';
682
+ text: string;
683
+ providerOptions?: ProviderOptions;
684
+ };
685
+ export type ToolModelMessage = {
686
+ role: 'tool';
687
+ content: Array<ToolResultPart>;
688
+ providerOptions?: ProviderOptions;
689
+ };
690
+ export type ToolResultPart = {
691
+ type: 'tool-result';
692
+ /**
693
+ * Must match the toolCallId of the corresponding tool call
694
+ */
695
+ toolCallId: string;
696
+ toolName: string;
697
+ output: ToolResultOutput;
698
+ providerOptions?: ProviderOptions;
699
+ };
700
+ export type ToolResultOutput = {
701
+ type: 'text';
702
+ value: string;
703
+ } | {
704
+ type: 'json';
705
+ value?: unknown;
706
+ } | {
707
+ type: 'error-text';
708
+ value: string;
709
+ } | {
710
+ type: 'error-json';
711
+ value?: unknown;
712
+ } | {
713
+ type: 'content';
714
+ value: Array<{
715
+ type: 'text';
716
+ text: string;
717
+ } | {
718
+ type: 'file-data';
719
+ data: string;
720
+ mediaType: string;
721
+ }>;
722
+ };
723
+ export type SystemModelMessage = {
724
+ role: 'system';
725
+ content: string;
726
+ providerOptions?: ProviderOptions;
727
+ };
728
+ export type ToolDefinition = {
729
+ description?: string;
730
+ /**
731
+ * JSON Schema of the tool input
732
+ */
733
+ inputSchema: {
734
+ [key: string]: unknown;
735
+ };
736
+ };
737
+ /**
738
+ * Reasoning effort for models that support it
739
+ */
740
+ export type ReasoningEffort = 'none' | 'low' | 'medium' | 'high';
741
+ /**
742
+ * Requested output mode: plain text, an object matching schema, or an array of elements matching elementSchema
743
+ */
744
+ export type TextGenerationOutput = {
745
+ type: 'text';
746
+ } | {
747
+ type: 'object';
748
+ schema: {
749
+ [key: string]: unknown;
750
+ };
751
+ } | {
752
+ type: 'array';
753
+ elementSchema: {
754
+ [key: string]: unknown;
755
+ };
756
+ };
757
+ /**
758
+ * Data payload of one server-sent event: text-delta and reasoning-delta events carry StreamTextChunk, the done event carries the final GenerateTextResponse, the error event carries ErrorResponse. A stream ending without done or error was aborted or truncated.
759
+ */
760
+ export type StreamTextEvent = StreamTextChunk | StreamTextResult | ErrorResponse;
761
+ export type StreamTextResult = {
762
+ text: string;
763
+ output?: unknown;
764
+ reasoningText?: string;
765
+ /**
766
+ * Tool calls in ToolCallPart shape, directly reusable as assistant message content parts
767
+ */
768
+ toolCalls: Array<ToolCallPart>;
769
+ usage: TextGenerationUsage;
770
+ finishReason: FinishReason;
771
+ providerMetadata?: ProviderMetadata;
772
+ files?: Array<GeneratedFile>;
773
+ };
774
+ export type StreamTextRequest = {
775
+ /**
776
+ * Primary model id
777
+ */
778
+ model: 'claude-sonnet-5-anthropic' | 'claude-sonnet-5-vertex' | 'claude-sonnet-4-6-anthropic' | 'claude-sonnet-4-6-vertex' | 'claude-opus-4-8-anthropic' | 'claude-opus-4-8-vertex' | 'claude-opus-4-7-anthropic' | 'claude-opus-4-7-vertex' | 'claude-haiku-4-5-anthropic' | 'claude-haiku-4-5-vertex' | 'gemini-3-0-flash-vertex' | 'gemini-3-5-flash-vertex' | 'gemini-3-1-pro-vertex' | 'qwen-3-coder-openrouter' | 'qwen-3-coder-next-openrouter' | 'qwen-3-6-plus-openrouter' | 'qwen-3-5-flash-openrouter' | 'grok-code-fast-openrouter' | 'deepseek-v3-1-openrouter' | 'deepseek-v4-pro-openrouter' | 'deepseek-v4-flash-openrouter' | 'kimi-k-2-6-openrouter' | 'gpt-5-5-bedrock' | 'gpt-5-4-bedrock' | 'grok-4-3-bedrock' | 'glm-5-bedrock' | 'gpt-5-4-nano-openrouter' | 'gpt-5-4-mini-openrouter' | 'gpt-5-3-codex-openrouter' | 'minimax-m-2-7-openrouter' | 'hy3-preview-openrouter' | 'gemini-3-0-pro-image' | 'gemini-3-1-flash-image';
779
+ /**
780
+ * Ordered fallback models, tried when the primary model fails before any output is produced
781
+ */
782
+ fallbackModels?: Array<TextGenerationModelId>;
783
+ /**
784
+ * Conversation messages: user, assistant, and tool
785
+ */
786
+ messages: Array<ModelMessage>;
787
+ /**
788
+ * System prompt: plain string, a single system message, or an array of system messages
789
+ */
790
+ system?: string | SystemModelMessage | Array<SystemModelMessage>;
791
+ /**
792
+ * Tool definitions available to the model, keyed by tool name
793
+ */
794
+ tools?: {
795
+ [key: string]: ToolDefinition;
796
+ };
797
+ /**
798
+ * Subset of tool names from tools enabled for this call
799
+ */
800
+ activeTools?: Array<string>;
801
+ reasoning?: ReasoningEffort;
802
+ maxOutputTokens?: number;
803
+ temperature?: number;
804
+ maxRetries?: number;
805
+ providerOptions?: ProviderOptions;
806
+ output?: TextGenerationOutput;
807
+ /**
808
+ * Correlation id attached to the operation logs; generated when omitted
809
+ */
810
+ opId?: string;
811
+ };
812
+ export type GenerateImageResponse = {
813
+ base64: string;
814
+ mediaType: ImageMediaType;
815
+ usage: ImageGenerationUsage;
816
+ };
817
+ export type ImageMediaType = 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
818
+ export type ImageGenerationUsage = {
819
+ model: ImageGenerationModelId;
820
+ totalCost: number;
821
+ inputTokens?: number;
822
+ outputTokens?: number;
823
+ totalTokens?: number;
824
+ };
825
+ export type ImageGenerationModelId = 'imagen-4-0-fast' | 'imagen-4-0' | 'imagen-4-0-ultra';
826
+ export type GenerateImageRequest = {
827
+ model: ImageGenerationModelId;
828
+ prompt: string;
829
+ aspectRatio: AspectRatio;
830
+ providerOptions?: ProviderOptions;
831
+ /**
832
+ * Correlation id attached to the operation logs; generated when omitted
833
+ */
834
+ opId?: string;
835
+ };
836
+ export type AspectRatio = '1:1' | '3:4' | '4:3' | '9:16' | '16:9';
536
837
  export type CreateCommentInput = {
537
838
  content: string;
538
839
  /**
@@ -7231,6 +7532,147 @@ export type GetConnectionStatusResponses = {
7231
7532
  200: Array<ConnectionStatus>;
7232
7533
  };
7233
7534
  export type GetConnectionStatusResponse = GetConnectionStatusResponses[keyof GetConnectionStatusResponses];
7535
+ export type GenerateTextData = {
7536
+ body: GenerateTextRequest;
7537
+ path?: never;
7538
+ query?: never;
7539
+ url: '/ai-gateway/generate-text';
7540
+ };
7541
+ export type GenerateTextErrors = {
7542
+ /**
7543
+ * Bad request - Invalid parameters or malformed JSON
7544
+ */
7545
+ 400: {
7546
+ message: string;
7547
+ issues?: string;
7548
+ };
7549
+ /**
7550
+ * Unauthorized
7551
+ */
7552
+ 401: ErrorResponse;
7553
+ /**
7554
+ * Forbidden
7555
+ */
7556
+ 403: ErrorResponse;
7557
+ /**
7558
+ * Not Found
7559
+ */
7560
+ 404: ErrorResponse;
7561
+ /**
7562
+ * Conflict
7563
+ */
7564
+ 409: ErrorResponse;
7565
+ /**
7566
+ * Internal server error
7567
+ */
7568
+ 500: ErrorResponse;
7569
+ /**
7570
+ * Service Unavailable
7571
+ */
7572
+ 503: ErrorResponse;
7573
+ };
7574
+ export type GenerateTextError = GenerateTextErrors[keyof GenerateTextErrors];
7575
+ export type GenerateTextResponses = {
7576
+ /**
7577
+ * Generates text response from selected AI model
7578
+ */
7579
+ 200: GenerateTextResponse;
7580
+ };
7581
+ export type GenerateTextResponse2 = GenerateTextResponses[keyof GenerateTextResponses];
7582
+ export type StreamTextData = {
7583
+ body: StreamTextRequest;
7584
+ path?: never;
7585
+ query?: never;
7586
+ url: '/ai-gateway/stream-text';
7587
+ };
7588
+ export type StreamTextErrors = {
7589
+ /**
7590
+ * Bad request - Invalid parameters or malformed JSON
7591
+ */
7592
+ 400: {
7593
+ message: string;
7594
+ issues?: string;
7595
+ };
7596
+ /**
7597
+ * Unauthorized
7598
+ */
7599
+ 401: ErrorResponse;
7600
+ /**
7601
+ * Forbidden
7602
+ */
7603
+ 403: ErrorResponse;
7604
+ /**
7605
+ * Not Found
7606
+ */
7607
+ 404: ErrorResponse;
7608
+ /**
7609
+ * Conflict
7610
+ */
7611
+ 409: ErrorResponse;
7612
+ /**
7613
+ * Internal server error
7614
+ */
7615
+ 500: ErrorResponse;
7616
+ /**
7617
+ * Service Unavailable
7618
+ */
7619
+ 503: ErrorResponse;
7620
+ };
7621
+ export type StreamTextError = StreamTextErrors[keyof StreamTextErrors];
7622
+ export type StreamTextResponses = {
7623
+ /**
7624
+ * Streams text chunks using Server-Sent Events
7625
+ */
7626
+ 200: StreamTextEvent;
7627
+ };
7628
+ export type StreamTextResponse = StreamTextResponses[keyof StreamTextResponses];
7629
+ export type GenerateImageData = {
7630
+ body: GenerateImageRequest;
7631
+ path?: never;
7632
+ query?: never;
7633
+ url: '/ai-gateway/generate-image';
7634
+ };
7635
+ export type GenerateImageErrors = {
7636
+ /**
7637
+ * Bad request - Invalid parameters or malformed JSON
7638
+ */
7639
+ 400: {
7640
+ message: string;
7641
+ issues?: string;
7642
+ };
7643
+ /**
7644
+ * Unauthorized
7645
+ */
7646
+ 401: ErrorResponse;
7647
+ /**
7648
+ * Forbidden
7649
+ */
7650
+ 403: ErrorResponse;
7651
+ /**
7652
+ * Not Found
7653
+ */
7654
+ 404: ErrorResponse;
7655
+ /**
7656
+ * Conflict
7657
+ */
7658
+ 409: ErrorResponse;
7659
+ /**
7660
+ * Internal server error
7661
+ */
7662
+ 500: ErrorResponse;
7663
+ /**
7664
+ * Service Unavailable
7665
+ */
7666
+ 503: ErrorResponse;
7667
+ };
7668
+ export type GenerateImageError = GenerateImageErrors[keyof GenerateImageErrors];
7669
+ export type GenerateImageResponses = {
7670
+ /**
7671
+ * Generates an image and returns base64 payload and usage
7672
+ */
7673
+ 200: GenerateImageResponse;
7674
+ };
7675
+ export type GenerateImageResponse2 = GenerateImageResponses[keyof GenerateImageResponses];
7234
7676
  export type DeleteCommentData = {
7235
7677
  body?: never;
7236
7678
  path: {