@dazl/api-client 1.0.27 → 1.0.29

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.
@@ -4,6 +4,11 @@ export type ClientOptions = {
4
4
  baseUrl: `${string}://${string}` | (string & {});
5
5
  };
6
6
 
7
+ export type StreamTextChunk = {
8
+ type: 'text-delta' | 'reasoning-delta';
9
+ text: string;
10
+ };
11
+
7
12
  export type UserRaw = {
8
13
  id: number;
9
14
  createdAt: string;
@@ -96,6 +101,335 @@ export type ConnectionStatus = {
96
101
  isConnected: boolean;
97
102
  };
98
103
 
104
+ export type GenerateTextResponse = {
105
+ text: string;
106
+ output?: unknown;
107
+ reasoningText?: string;
108
+ /**
109
+ * Tool calls in ToolCallPart shape, directly reusable as assistant message content parts
110
+ */
111
+ toolCalls: Array<ToolCallPart>;
112
+ usage: TextGenerationUsage;
113
+ finishReason: FinishReason;
114
+ providerMetadata?: ProviderMetadata;
115
+ files?: Array<GeneratedFile>;
116
+ };
117
+
118
+ export type ToolCallPart = {
119
+ type: 'tool-call';
120
+ toolCallId: string;
121
+ toolName: string;
122
+ input?: unknown;
123
+ providerExecuted?: boolean;
124
+ providerOptions?: ProviderOptions;
125
+ };
126
+
127
+ /**
128
+ * Provider-specific options passed through to the underlying provider, keyed by provider name
129
+ */
130
+ export type ProviderOptions = {
131
+ [key: string]: {
132
+ [key: string]: unknown;
133
+ };
134
+ };
135
+
136
+ export type TextGenerationUsage = {
137
+ /**
138
+ * Model that actually served the request
139
+ */
140
+ 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';
141
+ inputTokens: number;
142
+ inputTokensCost: number;
143
+ outputTokens: number;
144
+ outputTokensCost: number;
145
+ cacheWriteTokens: number;
146
+ cacheWriteTokensCost: number;
147
+ cacheReadTokens: number;
148
+ cacheReadTokensCost: number;
149
+ totalCost: number;
150
+ };
151
+
152
+ export type FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
153
+
154
+ /**
155
+ * Provider-specific metadata returned by the underlying provider, keyed by provider name
156
+ */
157
+ export type ProviderMetadata = {
158
+ [key: string]: {
159
+ [key: string]: unknown;
160
+ };
161
+ };
162
+
163
+ export type GeneratedFile = {
164
+ base64: string;
165
+ mediaType: string;
166
+ };
167
+
168
+ export type GenerateTextRequest = {
169
+ /**
170
+ * Primary model id
171
+ */
172
+ 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';
173
+ /**
174
+ * Ordered fallback models, tried when the primary model fails before any output is produced
175
+ */
176
+ fallbackModels?: Array<TextGenerationModelId>;
177
+ /**
178
+ * Conversation messages: user, assistant, and tool
179
+ */
180
+ messages: Array<ModelMessage>;
181
+ /**
182
+ * System prompt: plain string, a single system message, or an array of system messages
183
+ */
184
+ system?: string | SystemModelMessage | Array<SystemModelMessage>;
185
+ /**
186
+ * Tool definitions available to the model, keyed by tool name
187
+ */
188
+ tools?: {
189
+ [key: string]: ToolDefinition;
190
+ };
191
+ /**
192
+ * Subset of tool names from tools enabled for this call
193
+ */
194
+ activeTools?: Array<string>;
195
+ reasoning?: ReasoningEffort;
196
+ maxOutputTokens?: number;
197
+ temperature?: number;
198
+ maxRetries?: number;
199
+ providerOptions?: ProviderOptions;
200
+ output?: TextGenerationOutput;
201
+ /**
202
+ * Correlation id attached to the operation logs; generated when omitted
203
+ */
204
+ opId?: string;
205
+ };
206
+
207
+ 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';
208
+
209
+ export type ModelMessage = ({
210
+ role: 'user';
211
+ } & UserModelMessage) | ({
212
+ role: 'assistant';
213
+ } & AssistantModelMessage) | ({
214
+ role: 'tool';
215
+ } & ToolModelMessage);
216
+
217
+ export type UserModelMessage = {
218
+ role: 'user';
219
+ content: string | Array<TextPart | ImagePart | FilePart>;
220
+ providerOptions?: ProviderOptions;
221
+ };
222
+
223
+ export type TextPart = {
224
+ type: 'text';
225
+ text: string;
226
+ providerOptions?: ProviderOptions;
227
+ };
228
+
229
+ export type ImagePart = {
230
+ type: 'image';
231
+ /**
232
+ * Base64-encoded image data, a data url, or an http(s) url
233
+ */
234
+ image: string;
235
+ mediaType?: string;
236
+ providerOptions?: ProviderOptions;
237
+ };
238
+
239
+ export type FilePart = {
240
+ type: 'file';
241
+ /**
242
+ * Base64-encoded file data, a data url, or an http(s) url
243
+ */
244
+ data: string;
245
+ filename?: string;
246
+ /**
247
+ * IANA media type (e.g. image/png) or top-level segment (e.g. image)
248
+ */
249
+ mediaType: string;
250
+ providerOptions?: ProviderOptions;
251
+ };
252
+
253
+ export type AssistantModelMessage = {
254
+ role: 'assistant';
255
+ content: string | Array<TextPart | ReasoningPart | FilePart | ToolCallPart>;
256
+ providerOptions?: ProviderOptions;
257
+ };
258
+
259
+ export type ReasoningPart = {
260
+ type: 'reasoning';
261
+ text: string;
262
+ providerOptions?: ProviderOptions;
263
+ };
264
+
265
+ export type ToolModelMessage = {
266
+ role: 'tool';
267
+ content: Array<ToolResultPart>;
268
+ providerOptions?: ProviderOptions;
269
+ };
270
+
271
+ export type ToolResultPart = {
272
+ type: 'tool-result';
273
+ /**
274
+ * Must match the toolCallId of the corresponding tool call
275
+ */
276
+ toolCallId: string;
277
+ toolName: string;
278
+ output: ToolResultOutput;
279
+ providerOptions?: ProviderOptions;
280
+ };
281
+
282
+ export type ToolResultOutput = {
283
+ type: 'text';
284
+ value: string;
285
+ } | {
286
+ type: 'json';
287
+ value?: unknown;
288
+ } | {
289
+ type: 'error-text';
290
+ value: string;
291
+ } | {
292
+ type: 'error-json';
293
+ value?: unknown;
294
+ } | {
295
+ type: 'content';
296
+ value: Array<{
297
+ type: 'text';
298
+ text: string;
299
+ } | {
300
+ type: 'file-data';
301
+ data: string;
302
+ mediaType: string;
303
+ }>;
304
+ };
305
+
306
+ export type SystemModelMessage = {
307
+ role: 'system';
308
+ content: string;
309
+ providerOptions?: ProviderOptions;
310
+ };
311
+
312
+ export type ToolDefinition = {
313
+ description?: string;
314
+ /**
315
+ * JSON Schema of the tool input
316
+ */
317
+ inputSchema: {
318
+ [key: string]: unknown;
319
+ };
320
+ };
321
+
322
+ /**
323
+ * Reasoning effort for models that support it
324
+ */
325
+ export type ReasoningEffort = 'none' | 'low' | 'medium' | 'high';
326
+
327
+ /**
328
+ * Requested output mode: plain text, an object matching schema, or an array of elements matching elementSchema
329
+ */
330
+ export type TextGenerationOutput = {
331
+ type: 'text';
332
+ } | {
333
+ type: 'object';
334
+ schema: {
335
+ [key: string]: unknown;
336
+ };
337
+ } | {
338
+ type: 'array';
339
+ elementSchema: {
340
+ [key: string]: unknown;
341
+ };
342
+ };
343
+
344
+ /**
345
+ * 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.
346
+ */
347
+ export type StreamTextEvent = StreamTextChunk | StreamTextResult | ErrorResponse;
348
+
349
+ export type StreamTextResult = {
350
+ text: string;
351
+ output?: unknown;
352
+ reasoningText?: string;
353
+ /**
354
+ * Tool calls in ToolCallPart shape, directly reusable as assistant message content parts
355
+ */
356
+ toolCalls: Array<ToolCallPart>;
357
+ usage: TextGenerationUsage;
358
+ finishReason: FinishReason;
359
+ providerMetadata?: ProviderMetadata;
360
+ files?: Array<GeneratedFile>;
361
+ };
362
+
363
+ export type StreamTextRequest = {
364
+ /**
365
+ * Primary model id
366
+ */
367
+ 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';
368
+ /**
369
+ * Ordered fallback models, tried when the primary model fails before any output is produced
370
+ */
371
+ fallbackModels?: Array<TextGenerationModelId>;
372
+ /**
373
+ * Conversation messages: user, assistant, and tool
374
+ */
375
+ messages: Array<ModelMessage>;
376
+ /**
377
+ * System prompt: plain string, a single system message, or an array of system messages
378
+ */
379
+ system?: string | SystemModelMessage | Array<SystemModelMessage>;
380
+ /**
381
+ * Tool definitions available to the model, keyed by tool name
382
+ */
383
+ tools?: {
384
+ [key: string]: ToolDefinition;
385
+ };
386
+ /**
387
+ * Subset of tool names from tools enabled for this call
388
+ */
389
+ activeTools?: Array<string>;
390
+ reasoning?: ReasoningEffort;
391
+ maxOutputTokens?: number;
392
+ temperature?: number;
393
+ maxRetries?: number;
394
+ providerOptions?: ProviderOptions;
395
+ output?: TextGenerationOutput;
396
+ /**
397
+ * Correlation id attached to the operation logs; generated when omitted
398
+ */
399
+ opId?: string;
400
+ };
401
+
402
+ export type GenerateImageResponse = {
403
+ base64: string;
404
+ mediaType: ImageMediaType;
405
+ usage: ImageGenerationUsage;
406
+ };
407
+
408
+ export type ImageMediaType = 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
409
+
410
+ export type ImageGenerationUsage = {
411
+ model: ImageGenerationModelId;
412
+ totalCost: number;
413
+ inputTokens?: number;
414
+ outputTokens?: number;
415
+ totalTokens?: number;
416
+ };
417
+
418
+ export type ImageGenerationModelId = 'imagen-4-0-fast' | 'imagen-4-0' | 'imagen-4-0-ultra';
419
+
420
+ export type GenerateImageRequest = {
421
+ model: ImageGenerationModelId;
422
+ prompt: string;
423
+ aspectRatio: AspectRatio;
424
+ providerOptions?: ProviderOptions;
425
+ /**
426
+ * Correlation id attached to the operation logs; generated when omitted
427
+ */
428
+ opId?: string;
429
+ };
430
+
431
+ export type AspectRatio = '1:1' | '3:4' | '4:3' | '9:16' | '16:9';
432
+
99
433
  export type UserMention = {
100
434
  dazlUserId: string;
101
435
  };
@@ -1608,6 +1942,162 @@ export type GetConnectionStatusResponses = {
1608
1942
 
1609
1943
  export type GetConnectionStatusResponse = GetConnectionStatusResponses[keyof GetConnectionStatusResponses];
1610
1944
 
1945
+ export type GenerateTextData = {
1946
+ body: GenerateTextRequest;
1947
+ path?: never;
1948
+ query?: never;
1949
+ url: '/ai-gateway/generate-text';
1950
+ };
1951
+
1952
+ export type GenerateTextErrors = {
1953
+ /**
1954
+ * Bad request - Invalid parameters or malformed JSON
1955
+ */
1956
+ 400: {
1957
+ message: string;
1958
+ issues?: string;
1959
+ };
1960
+ /**
1961
+ * Unauthorized
1962
+ */
1963
+ 401: ErrorResponse;
1964
+ /**
1965
+ * Forbidden
1966
+ */
1967
+ 403: ErrorResponse;
1968
+ /**
1969
+ * Not Found
1970
+ */
1971
+ 404: ErrorResponse;
1972
+ /**
1973
+ * Conflict
1974
+ */
1975
+ 409: ErrorResponse;
1976
+ /**
1977
+ * Internal server error
1978
+ */
1979
+ 500: ErrorResponse;
1980
+ /**
1981
+ * Service Unavailable
1982
+ */
1983
+ 503: ErrorResponse;
1984
+ };
1985
+
1986
+ export type GenerateTextError = GenerateTextErrors[keyof GenerateTextErrors];
1987
+
1988
+ export type GenerateTextResponses = {
1989
+ /**
1990
+ * Generates text response from selected AI model
1991
+ */
1992
+ 200: GenerateTextResponse;
1993
+ };
1994
+
1995
+ export type GenerateTextResponse2 = GenerateTextResponses[keyof GenerateTextResponses];
1996
+
1997
+ export type StreamTextData = {
1998
+ body: StreamTextRequest;
1999
+ path?: never;
2000
+ query?: never;
2001
+ url: '/ai-gateway/stream-text';
2002
+ };
2003
+
2004
+ export type StreamTextErrors = {
2005
+ /**
2006
+ * Bad request - Invalid parameters or malformed JSON
2007
+ */
2008
+ 400: {
2009
+ message: string;
2010
+ issues?: string;
2011
+ };
2012
+ /**
2013
+ * Unauthorized
2014
+ */
2015
+ 401: ErrorResponse;
2016
+ /**
2017
+ * Forbidden
2018
+ */
2019
+ 403: ErrorResponse;
2020
+ /**
2021
+ * Not Found
2022
+ */
2023
+ 404: ErrorResponse;
2024
+ /**
2025
+ * Conflict
2026
+ */
2027
+ 409: ErrorResponse;
2028
+ /**
2029
+ * Internal server error
2030
+ */
2031
+ 500: ErrorResponse;
2032
+ /**
2033
+ * Service Unavailable
2034
+ */
2035
+ 503: ErrorResponse;
2036
+ };
2037
+
2038
+ export type StreamTextError = StreamTextErrors[keyof StreamTextErrors];
2039
+
2040
+ export type StreamTextResponses = {
2041
+ /**
2042
+ * Streams text chunks using Server-Sent Events
2043
+ */
2044
+ 200: StreamTextEvent;
2045
+ };
2046
+
2047
+ export type StreamTextResponse = StreamTextResponses[keyof StreamTextResponses];
2048
+
2049
+ export type GenerateImageData = {
2050
+ body: GenerateImageRequest;
2051
+ path?: never;
2052
+ query?: never;
2053
+ url: '/ai-gateway/generate-image';
2054
+ };
2055
+
2056
+ export type GenerateImageErrors = {
2057
+ /**
2058
+ * Bad request - Invalid parameters or malformed JSON
2059
+ */
2060
+ 400: {
2061
+ message: string;
2062
+ issues?: string;
2063
+ };
2064
+ /**
2065
+ * Unauthorized
2066
+ */
2067
+ 401: ErrorResponse;
2068
+ /**
2069
+ * Forbidden
2070
+ */
2071
+ 403: ErrorResponse;
2072
+ /**
2073
+ * Not Found
2074
+ */
2075
+ 404: ErrorResponse;
2076
+ /**
2077
+ * Conflict
2078
+ */
2079
+ 409: ErrorResponse;
2080
+ /**
2081
+ * Internal server error
2082
+ */
2083
+ 500: ErrorResponse;
2084
+ /**
2085
+ * Service Unavailable
2086
+ */
2087
+ 503: ErrorResponse;
2088
+ };
2089
+
2090
+ export type GenerateImageError = GenerateImageErrors[keyof GenerateImageErrors];
2091
+
2092
+ export type GenerateImageResponses = {
2093
+ /**
2094
+ * Generates an image and returns base64 payload and usage
2095
+ */
2096
+ 200: GenerateImageResponse;
2097
+ };
2098
+
2099
+ export type GenerateImageResponse2 = GenerateImageResponses[keyof GenerateImageResponses];
2100
+
1611
2101
  export type DeleteCommentData = {
1612
2102
  body?: never;
1613
2103
  path: {