@ai-sdk/alibaba 2.0.57 → 2.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @ai-sdk/alibaba
2
2
 
3
+ ## 2.0.59
4
+
5
+ ### Patch Changes
6
+
7
+ - ede5b89: chore: migrate package builds from tsup to tsdown
8
+ - Updated dependencies [ede5b89]
9
+ - @ai-sdk/provider@4.0.20
10
+ - @ai-sdk/provider-utils@5.0.52
11
+
12
+ ## 2.0.58
13
+
14
+ ### Patch Changes
15
+
16
+ - c2511c1: fix: use standards-compliant User-Agent header
17
+ - Updated dependencies [c2511c1]
18
+ - @ai-sdk/provider-utils@5.0.51
19
+
3
20
  ## 2.0.57
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,164 +1,170 @@
1
- import { z } from 'zod/v4';
2
- import { ProviderV4, LanguageModelV4, EmbeddingModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
3
- import { FetchFunction } from '@ai-sdk/provider-utils';
4
-
1
+ import { EmbeddingModelV4, Experimental_VideoModelV4, LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
2
+ import { FetchFunction } from "@ai-sdk/provider-utils";
3
+ import { z } from "zod/v4";
4
+ //#region src/alibaba-chat-language-model-options.d.ts
5
5
  type AlibabaChatModelId = 'qwen3.7-max' | 'qwen3-max' | 'qwen3-max-preview' | 'qwen-plus' | 'qwen-plus-latest' | 'qwen-flash' | 'qwen-turbo' | 'qwen-turbo-latest' | 'qwen3-235b-a22b' | 'qwen3-32b' | 'qwen3-30b-a3b' | 'qwen3-14b' | 'qwen3-next-80b-a3b-thinking' | 'qwen3-235b-a22b-thinking-2507' | 'qwen3-30b-a3b-thinking-2507' | 'qwq-plus' | 'qwq-plus-latest' | 'qwq-32b' | 'qwen-coder' | 'qwen3-coder-plus' | 'qwen3-coder-flash' | (string & {});
6
6
  declare const alibabaLanguageModelChatOptions: z.ZodObject<{
7
- enableThinking: z.ZodOptional<z.ZodBoolean>;
8
- thinkingBudget: z.ZodOptional<z.ZodNumber>;
9
- preserveThinking: z.ZodOptional<z.ZodBoolean>;
10
- parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
7
+ enableThinking: z.ZodOptional<z.ZodBoolean>;
8
+ thinkingBudget: z.ZodOptional<z.ZodNumber>;
9
+ preserveThinking: z.ZodOptional<z.ZodBoolean>;
10
+ parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
11
11
  }, z.core.$strip>;
12
12
  type AlibabaLanguageModelChatOptions = z.infer<typeof alibabaLanguageModelChatOptions>;
13
-
13
+ //#endregion
14
+ //#region src/alibaba-chat-prompt.d.ts
14
15
  type AlibabaCacheControl = {
15
- type: string;
16
+ type: string;
16
17
  };
17
-
18
+ //#endregion
19
+ //#region src/alibaba-embedding-model-options.d.ts
18
20
  type AlibabaEmbeddingModelId = 'text-embedding-v4' | 'text-embedding-v3' | (string & {});
19
21
  declare const alibabaEmbeddingModelOptions: z.ZodObject<{
20
- textType: z.ZodOptional<z.ZodEnum<{
21
- query: "query";
22
- document: "document";
23
- }>>;
24
- dimension: z.ZodOptional<z.ZodNumber>;
25
- outputType: z.ZodOptional<z.ZodEnum<{
26
- dense: "dense";
27
- sparse: "sparse";
28
- "dense&sparse": "dense&sparse";
29
- }>>;
22
+ textType: z.ZodOptional<z.ZodEnum<{
23
+ query: "query";
24
+ document: "document";
25
+ }>>;
26
+ dimension: z.ZodOptional<z.ZodNumber>;
27
+ outputType: z.ZodOptional<z.ZodEnum<{
28
+ dense: "dense";
29
+ sparse: "sparse";
30
+ "dense&sparse": "dense&sparse";
31
+ }>>;
30
32
  }, z.core.$strip>;
31
33
  type AlibabaEmbeddingModelOptions = z.infer<typeof alibabaEmbeddingModelOptions>;
32
-
34
+ //#endregion
35
+ //#region src/alibaba-video-settings.d.ts
33
36
  type AlibabaVideoModelId = 'wan2.6-t2v' | 'wan2.5-t2v-preview' | 'wan2.7-t2v' | 'wan2.7-t2v-2026-06-12' | 'wan2.6-i2v' | 'wan2.6-i2v-flash' | 'wan2.6-r2v' | 'wan2.6-r2v-flash' | 'wan2.7-r2v' | 'wan2.7-r2v-2026-06-12' | 'wan3.0-video' | (string & {});
34
-
37
+ //#endregion
38
+ //#region src/alibaba-provider.d.ts
35
39
  interface AlibabaProvider extends ProviderV4 {
36
- (modelId: AlibabaChatModelId): LanguageModelV4;
37
- /**
38
- * Creates a model for text generation.
39
- */
40
- languageModel(modelId: AlibabaChatModelId): LanguageModelV4;
41
- /**
42
- * Creates a chat model for text generation.
43
- */
44
- chatModel(modelId: AlibabaChatModelId): LanguageModelV4;
45
- /**
46
- * Creates a model for text embeddings.
47
- */
48
- embedding(modelId: AlibabaEmbeddingModelId): EmbeddingModelV4;
49
- /**
50
- * Creates a model for text embeddings.
51
- */
52
- embeddingModel(modelId: AlibabaEmbeddingModelId): EmbeddingModelV4;
53
- /**
54
- * Creates a model for video generation.
55
- */
56
- video(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
57
- /**
58
- * Creates a model for video generation.
59
- */
60
- videoModel(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
40
+ (modelId: AlibabaChatModelId): LanguageModelV4;
41
+ /**
42
+ * Creates a model for text generation.
43
+ */
44
+ languageModel(modelId: AlibabaChatModelId): LanguageModelV4;
45
+ /**
46
+ * Creates a chat model for text generation.
47
+ */
48
+ chatModel(modelId: AlibabaChatModelId): LanguageModelV4;
49
+ /**
50
+ * Creates a model for text embeddings.
51
+ */
52
+ embedding(modelId: AlibabaEmbeddingModelId): EmbeddingModelV4;
53
+ /**
54
+ * Creates a model for text embeddings.
55
+ */
56
+ embeddingModel(modelId: AlibabaEmbeddingModelId): EmbeddingModelV4;
57
+ /**
58
+ * Creates a model for video generation.
59
+ */
60
+ video(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
61
+ /**
62
+ * Creates a model for video generation.
63
+ */
64
+ videoModel(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
61
65
  }
62
66
  interface AlibabaProviderSettings {
63
- /**
64
- * Use a different URL prefix for API calls, e.g. to use proxy servers or regional endpoints.
65
- * The default prefix is `https://dashscope-intl.aliyuncs.com/compatible-mode/v1`.
66
- */
67
- baseURL?: string;
68
- /**
69
- * Use a different URL prefix for video generation API calls.
70
- * The video API uses the DashScope native endpoint (not the OpenAI-compatible endpoint).
71
- * The default prefix is `https://dashscope-intl.aliyuncs.com`.
72
- */
73
- videoBaseURL?: string;
74
- /**
75
- * Use a different URL prefix for embedding API calls.
76
- * The embedding API uses the DashScope native endpoint (not the OpenAI-compatible endpoint).
77
- * The default prefix is `https://dashscope-intl.aliyuncs.com/api/v1`.
78
- */
79
- embeddingBaseURL?: string;
80
- /**
81
- * API key that is being sent using the `Authorization` header.
82
- * It defaults to the `ALIBABA_API_KEY` environment variable.
83
- */
84
- apiKey?: string;
85
- /**
86
- * Custom headers to include in the requests.
87
- */
88
- headers?: Record<string, string>;
89
- /**
90
- * Custom fetch implementation. You can use it as a middleware to intercept requests,
91
- * or to provide a custom fetch implementation for e.g. testing.
92
- */
93
- fetch?: FetchFunction;
94
- /**
95
- * Include usage information in streaming responses.
96
- * When enabled, token usage will be included in the final chunk.
97
- *
98
- * @default true
99
- */
100
- includeUsage?: boolean;
67
+ /**
68
+ * Use a different URL prefix for API calls, e.g. to use proxy servers or regional endpoints.
69
+ * The default prefix is `https://dashscope-intl.aliyuncs.com/compatible-mode/v1`.
70
+ */
71
+ baseURL?: string;
72
+ /**
73
+ * Use a different URL prefix for video generation API calls.
74
+ * The video API uses the DashScope native endpoint (not the OpenAI-compatible endpoint).
75
+ * The default prefix is `https://dashscope-intl.aliyuncs.com`.
76
+ */
77
+ videoBaseURL?: string;
78
+ /**
79
+ * Use a different URL prefix for embedding API calls.
80
+ * The embedding API uses the DashScope native endpoint (not the OpenAI-compatible endpoint).
81
+ * The default prefix is `https://dashscope-intl.aliyuncs.com/api/v1`.
82
+ */
83
+ embeddingBaseURL?: string;
84
+ /**
85
+ * API key that is being sent using the `Authorization` header.
86
+ * It defaults to the `ALIBABA_API_KEY` environment variable.
87
+ */
88
+ apiKey?: string;
89
+ /**
90
+ * Custom headers to include in the requests.
91
+ */
92
+ headers?: Record<string, string>;
93
+ /**
94
+ * Custom fetch implementation. You can use it as a middleware to intercept requests,
95
+ * or to provide a custom fetch implementation for e.g. testing.
96
+ */
97
+ fetch?: FetchFunction;
98
+ /**
99
+ * Include usage information in streaming responses.
100
+ * When enabled, token usage will be included in the final chunk.
101
+ *
102
+ * @default true
103
+ */
104
+ includeUsage?: boolean;
101
105
  }
102
106
  /**
103
107
  * Create an Alibaba Cloud (Qwen) provider instance.
104
108
  */
105
- declare function createAlibaba(options?: AlibabaProviderSettings): AlibabaProvider;
106
- declare const alibaba: AlibabaProvider;
107
-
109
+ export declare function createAlibaba(options?: AlibabaProviderSettings): AlibabaProvider;
110
+ export declare const alibaba: AlibabaProvider;
111
+ //#endregion
112
+ //#region src/alibaba-video-model-options.d.ts
108
113
  type AlibabaVideoModelOptions = {
109
- /** Negative prompt to specify what to avoid (max 500 chars). */
110
- negativePrompt?: string | null;
111
- /** URL to audio file for audio-video sync (WAV/MP3, 3-30s, max 15MB). */
112
- audioUrl?: string | null;
113
- /** Enable prompt extension/rewriting for better generation. Defaults to true. */
114
- promptExtend?: boolean | null;
115
- /**
116
- * Shot type: 'single' for single-shot or 'multi' for multi-shot narrative
117
- * (wan2.6 and earlier; wan2.7 models describe shot structure in the prompt).
118
- */
119
- shotType?: 'single' | 'multi' | null;
120
- /** Whether to add watermark to generated video. Defaults to false. */
121
- watermark?: boolean | null;
122
- /**
123
- * Enable audio generation (wan2.6 I2V/R2V and wan3 models;
124
- * wan2.7 models always generate audio). Defaults to true on wan3.
125
- */
126
- audio?: boolean | null;
127
- /**
128
- * Reference URLs for reference-to-video mode (wan2.6 models).
129
- * Array of URLs to images (0-5) and/or videos (0-3), max 5 total.
130
- * Use character identifiers (character1, character2) in prompts to reference them.
131
- */
132
- referenceUrls?: string[] | null;
133
- /**
134
- * Explicit media array (wan2.7 and wan3 models). Overrides the automatic
135
- * mapping from `inputReferences` and `frameImages`.
136
- * Use `Image 1`, `Video 1`, etc. in prompts to reference media items
137
- * (images, videos, and audio are counted separately, in array order).
138
- *
139
- * `reference_audio`, `file`, and `link` are wan3-only and have no top-level
140
- * call option, so they can only be passed here. wan3 also rejects mixing
141
- * `reference_*`/`file`/`link` with `first_frame`/`last_frame`.
142
- */
143
- media?: Array<{
144
- type: 'reference_image' | 'reference_video' | 'reference_audio' | 'first_frame' | 'last_frame' | 'file' | 'link';
145
- /** Public URL, or a `data:{mime};base64,{data}` URI for images. */
146
- url: string;
147
- /** URL to an audio file used as voice reference for this media item. */
148
- referenceVoice?: string | null;
149
- }> | null;
150
- /**
151
- * Aspect ratio (wan2.7 text-to-video and reference-to-video models, and
152
- * every wan3 generation). `adaptive` is wan3-only, and is its default.
153
- */
154
- ratio?: 'adaptive' | '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | null;
155
- /** Polling interval in milliseconds. Defaults to 5000 (5 seconds). */
156
- pollIntervalMs?: number | null;
157
- /** Maximum wait time in milliseconds for video generation. Defaults to 600000 (10 minutes). */
158
- pollTimeoutMs?: number | null;
159
- [key: string]: unknown;
114
+ /** Negative prompt to specify what to avoid (max 500 chars). */
115
+ negativePrompt?: string | null;
116
+ /** URL to audio file for audio-video sync (WAV/MP3, 3-30s, max 15MB). */
117
+ audioUrl?: string | null;
118
+ /** Enable prompt extension/rewriting for better generation. Defaults to true. */
119
+ promptExtend?: boolean | null;
120
+ /**
121
+ * Shot type: 'single' for single-shot or 'multi' for multi-shot narrative
122
+ * (wan2.6 and earlier; wan2.7 models describe shot structure in the prompt).
123
+ */
124
+ shotType?: 'single' | 'multi' | null;
125
+ /** Whether to add watermark to generated video. Defaults to false. */
126
+ watermark?: boolean | null;
127
+ /**
128
+ * Enable audio generation (wan2.6 I2V/R2V and wan3 models;
129
+ * wan2.7 models always generate audio). Defaults to true on wan3.
130
+ */
131
+ audio?: boolean | null;
132
+ /**
133
+ * Reference URLs for reference-to-video mode (wan2.6 models).
134
+ * Array of URLs to images (0-5) and/or videos (0-3), max 5 total.
135
+ * Use character identifiers (character1, character2) in prompts to reference them.
136
+ */
137
+ referenceUrls?: string[] | null;
138
+ /**
139
+ * Explicit media array (wan2.7 and wan3 models). Overrides the automatic
140
+ * mapping from `inputReferences` and `frameImages`.
141
+ * Use `Image 1`, `Video 1`, etc. in prompts to reference media items
142
+ * (images, videos, and audio are counted separately, in array order).
143
+ *
144
+ * `reference_audio`, `file`, and `link` are wan3-only and have no top-level
145
+ * call option, so they can only be passed here. wan3 also rejects mixing
146
+ * `reference_*`/`file`/`link` with `first_frame`/`last_frame`.
147
+ */
148
+ media?: Array<{
149
+ type: 'reference_image' | 'reference_video' | 'reference_audio' | 'first_frame' | 'last_frame' | 'file' | 'link';
150
+ /** Public URL, or a `data:{mime};base64,{data}` URI for images. */
151
+ url: string;
152
+ /** URL to an audio file used as voice reference for this media item. */
153
+ referenceVoice?: string | null;
154
+ }> | null;
155
+ /**
156
+ * Aspect ratio (wan2.7 text-to-video and reference-to-video models, and
157
+ * every wan3 generation). `adaptive` is wan3-only, and is its default.
158
+ */
159
+ ratio?: 'adaptive' | '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | null;
160
+ /** Polling interval in milliseconds. Defaults to 5000 (5 seconds). */
161
+ pollIntervalMs?: number | null;
162
+ /** Maximum wait time in milliseconds for video generation. Defaults to 600000 (10 minutes). */
163
+ pollTimeoutMs?: number | null;
164
+ [key: string]: unknown;
160
165
  };
161
-
166
+ //#endregion
167
+ //#region src/convert-alibaba-usage.d.ts
162
168
  /**
163
169
  * Usage as reported by Alibaba's OpenAI-compatible chat completions API.
164
170
  *
@@ -169,26 +175,28 @@ type AlibabaVideoModelOptions = {
169
175
  * there.
170
176
  */
171
177
  type AlibabaUsage = {
172
- prompt_tokens?: number | null;
173
- completion_tokens?: number | null;
174
- total_tokens?: number | null;
175
- prompt_tokens_details?: {
176
- cached_tokens?: number | null;
177
- cache_creation_input_tokens?: number | null;
178
- /**
179
- * Which caching mode served the request. Alibaba populates this only under
180
- * explicit context caching, which sending `cache_control` selects; under
181
- * implicit caching the field is absent. The two modes are mutually
182
- * exclusive and priced differently, so this is the discriminator for
183
- * attributing cache reads to a rate.
184
- */
185
- cache_type?: string | null;
186
- } | null;
187
- completion_tokens_details?: {
188
- reasoning_tokens?: number | null;
189
- } | null;
178
+ prompt_tokens?: number | null;
179
+ completion_tokens?: number | null;
180
+ total_tokens?: number | null;
181
+ prompt_tokens_details?: {
182
+ cached_tokens?: number | null;
183
+ cache_creation_input_tokens?: number | null;
184
+ /**
185
+ * Which caching mode served the request. Alibaba populates this only under
186
+ * explicit context caching, which sending `cache_control` selects; under
187
+ * implicit caching the field is absent. The two modes are mutually
188
+ * exclusive and priced differently, so this is the discriminator for
189
+ * attributing cache reads to a rate.
190
+ */
191
+ cache_type?: string | null;
192
+ } | null;
193
+ completion_tokens_details?: {
194
+ reasoning_tokens?: number | null;
195
+ } | null;
190
196
  };
191
-
192
- declare const VERSION: string;
193
-
194
- export { type AlibabaCacheControl, type AlibabaChatModelId, type AlibabaEmbeddingModelId, type AlibabaEmbeddingModelOptions, type AlibabaLanguageModelChatOptions, type AlibabaLanguageModelChatOptions as AlibabaLanguageModelOptions, type AlibabaProvider, type AlibabaLanguageModelChatOptions as AlibabaProviderOptions, type AlibabaProviderSettings, type AlibabaUsage, type AlibabaVideoModelId, type AlibabaVideoModelOptions, type AlibabaVideoModelOptions as AlibabaVideoProviderOptions, VERSION, alibaba, createAlibaba };
197
+ //#endregion
198
+ //#region src/version.d.ts
199
+ export declare const VERSION: string;
200
+ //#endregion
201
+ export type { AlibabaCacheControl, AlibabaChatModelId, AlibabaEmbeddingModelId, AlibabaEmbeddingModelOptions, AlibabaLanguageModelChatOptions, AlibabaLanguageModelChatOptions as AlibabaLanguageModelOptions, AlibabaLanguageModelChatOptions as AlibabaProviderOptions, AlibabaProvider, AlibabaProviderSettings, AlibabaUsage, AlibabaVideoModelId, AlibabaVideoModelOptions, AlibabaVideoModelOptions as AlibabaVideoProviderOptions };
202
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/alibaba-chat-language-model-options.ts","../src/alibaba-chat-prompt.ts","../src/alibaba-embedding-model-options.ts","../src/alibaba-video-settings.ts","../src/alibaba-provider.ts","../src/alibaba-video-model-options.ts","../src/convert-alibaba-usage.ts","../src/version.ts"],"mappings":";;;;KAGY;cA4BC,iCAA+B,EAAA;;;;;GA8B1C,EAAA,KAAA;KAEU,kCAAkC,EAAE,aACvC;;;KChEG;EAAwB;;;;KCExB;cAKC,8BAA4B,EAAA;;;;;;;;;;;GAqBvC,EAAA,KAAA;KAEU,+BAA+B,EAAE,aACpC;;;KC9BG;;;UCuBK,wBAAwB;GACtC,SAAS,qBAAqB;;;;EAK/B,cAAc,SAAS,qBAAqB;;;;EAK5C,UAAU,SAAS,qBAAqB;;;;EAKxC,UAAU,SAAS,0BAA0B;;;;EAK7C,eAAe,SAAS,0BAA0B;;;;EAKlD,MAAM,SAAS,sBAAsB;;;;EAKrC,WAAW,SAAS,sBAAsB;;UAG3B;;;;;EAKf;;;;;;EAOA;;;;;;EAOA;;;;;EAMA;;;;EAKA,UAAU;;;;;EAMV,QAAQ;;;;;;;EAQR;;;;;wBAMc,cACd,UAAS,0BACR;qBA4EU,SAAO;;;KCvLR;;EAEV;;EAEA;;EAEA;;;;;EAKA;;EAEA;;;;;EAKA;;;;;;EAMA;;;;;;;;;;;EAWA,QAAQ;IACN;;IASA;;IAEA;;;;;;EAMF;;EAEA;;EAEA;GACC;;;;;;;;;;;;;KCjDS;EACV;EACA;EACA;EACA;IACE;IACA;;;;;;;;IAQA;;EAEF;IACE;;;;;qBC3BS"}