@ai-sdk/alibaba 0.0.0-b66d09a8-20260328011513

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 ADDED
@@ -0,0 +1,229 @@
1
+ # @ai-sdk/alibaba
2
+
3
+ ## 0.0.0-b66d09a8-20260328011513
4
+
5
+ ### Major Changes
6
+
7
+ - 8359612: Start v7 pre-release
8
+
9
+ ### Patch Changes
10
+
11
+ - 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
12
+ - 45b3d76: fix(security): prevent streaming tool calls from finalizing on parsable partial JSON
13
+
14
+ Streaming tool call arguments were finalized using `isParsableJson()` as a heuristic for completion. If partial accumulated JSON happened to be valid JSON before all chunks arrived, the tool call would be executed with incomplete arguments. Tool call finalization now only occurs in `flush()` after the stream is fully consumed.
15
+
16
+ - 811cd8e: fix(provider/alibaba): handle single-item content array cache control
17
+ - f7295cb: revert incorrect fix https://github.com/vercel/ai/pull/13172
18
+ - 4ab27b9: chore(alibaba): update v3 specs to v4
19
+ - Updated dependencies [74d520f]
20
+ - Updated dependencies [531251e]
21
+ - Updated dependencies [45b3d76]
22
+ - Updated dependencies [1f509d4]
23
+ - Updated dependencies [5c2a5a2]
24
+ - Updated dependencies [f7d4f01]
25
+ - Updated dependencies [776b617]
26
+ - Updated dependencies [8f3e1da]
27
+ - Updated dependencies [f7295cb]
28
+ - Updated dependencies [3887c70]
29
+ - Updated dependencies [61753c3]
30
+ - Updated dependencies [8359612]
31
+ - @ai-sdk/openai-compatible@0.0.0-b66d09a8-20260328011513
32
+ - @ai-sdk/provider-utils@0.0.0-b66d09a8-20260328011513
33
+ - @ai-sdk/provider@0.0.0-b66d09a8-20260328011513
34
+
35
+ ## 2.0.0-beta.12
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [1f509d4]
40
+ - @ai-sdk/provider-utils@5.0.0-beta.7
41
+ - @ai-sdk/provider@4.0.0-beta.5
42
+ - @ai-sdk/openai-compatible@3.0.0-beta.10
43
+
44
+ ## 2.0.0-beta.11
45
+
46
+ ### Patch Changes
47
+
48
+ - 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
49
+ - Updated dependencies [74d520f]
50
+ - @ai-sdk/openai-compatible@3.0.0-beta.9
51
+
52
+ ## 2.0.0-beta.10
53
+
54
+ ### Patch Changes
55
+
56
+ - Updated dependencies [3887c70]
57
+ - @ai-sdk/provider-utils@5.0.0-beta.6
58
+ - @ai-sdk/provider@4.0.0-beta.4
59
+ - @ai-sdk/openai-compatible@3.0.0-beta.8
60
+
61
+ ## 2.0.0-beta.9
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [776b617]
66
+ - @ai-sdk/provider-utils@5.0.0-beta.5
67
+ - @ai-sdk/provider@4.0.0-beta.3
68
+ - @ai-sdk/openai-compatible@3.0.0-beta.7
69
+
70
+ ## 2.0.0-beta.8
71
+
72
+ ### Patch Changes
73
+
74
+ - Updated dependencies [61753c3]
75
+ - @ai-sdk/provider-utils@5.0.0-beta.4
76
+ - @ai-sdk/openai-compatible@3.0.0-beta.6
77
+
78
+ ## 2.0.0-beta.7
79
+
80
+ ### Patch Changes
81
+
82
+ - 811cd8e: fix(provider/alibaba): handle single-item content array cache control
83
+
84
+ ## 2.0.0-beta.6
85
+
86
+ ### Patch Changes
87
+
88
+ - Updated dependencies [f7d4f01]
89
+ - @ai-sdk/provider-utils@5.0.0-beta.3
90
+ - @ai-sdk/provider@4.0.0-beta.2
91
+ - @ai-sdk/openai-compatible@3.0.0-beta.5
92
+
93
+ ## 2.0.0-beta.5
94
+
95
+ ### Patch Changes
96
+
97
+ - Updated dependencies [5c2a5a2]
98
+ - @ai-sdk/provider@4.0.0-beta.1
99
+ - @ai-sdk/openai-compatible@3.0.0-beta.4
100
+ - @ai-sdk/provider-utils@5.0.0-beta.2
101
+
102
+ ## 2.0.0-beta.4
103
+
104
+ ### Patch Changes
105
+
106
+ - Updated dependencies [8f3e1da]
107
+ - @ai-sdk/openai-compatible@3.0.0-beta.3
108
+
109
+ ## 2.0.0-beta.3
110
+
111
+ ### Patch Changes
112
+
113
+ - 4ab27b9: chore(alibaba): update v3 specs to v4
114
+
115
+ ## 2.0.0-beta.2
116
+
117
+ ### Patch Changes
118
+
119
+ - 45b3d76: fix(security): prevent streaming tool calls from finalizing on parsable partial JSON
120
+
121
+ Streaming tool call arguments were finalized using `isParsableJson()` as a heuristic for completion. If partial accumulated JSON happened to be valid JSON before all chunks arrived, the tool call would be executed with incomplete arguments. Tool call finalization now only occurs in `flush()` after the stream is fully consumed.
122
+
123
+ - f7295cb: revert incorrect fix https://github.com/vercel/ai/pull/13172
124
+ - Updated dependencies [45b3d76]
125
+ - Updated dependencies [f7295cb]
126
+ - @ai-sdk/openai-compatible@3.0.0-beta.2
127
+
128
+ ## 2.0.0-beta.1
129
+
130
+ ### Patch Changes
131
+
132
+ - Updated dependencies [531251e]
133
+ - @ai-sdk/provider-utils@5.0.0-beta.1
134
+ - @ai-sdk/openai-compatible@3.0.0-beta.1
135
+
136
+ ## 2.0.0-beta.0
137
+
138
+ ### Major Changes
139
+
140
+ - 8359612: Start v7 pre-release
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [8359612]
145
+ - @ai-sdk/openai-compatible@3.0.0-beta.0
146
+ - @ai-sdk/provider@4.0.0-beta.0
147
+ - @ai-sdk/provider-utils@5.0.0-beta.0
148
+
149
+ ## 1.0.10
150
+
151
+ ### Patch Changes
152
+
153
+ - Updated dependencies [ad4cfc2]
154
+ - @ai-sdk/provider-utils@4.0.19
155
+ - @ai-sdk/openai-compatible@2.0.35
156
+
157
+ ## 1.0.9
158
+
159
+ ### Patch Changes
160
+
161
+ - Updated dependencies [824b295]
162
+ - @ai-sdk/provider-utils@4.0.18
163
+ - @ai-sdk/openai-compatible@2.0.34
164
+
165
+ ## 1.0.8
166
+
167
+ ### Patch Changes
168
+
169
+ - Updated dependencies [89caf28]
170
+ - @ai-sdk/openai-compatible@2.0.33
171
+
172
+ ## 1.0.7
173
+
174
+ ### Patch Changes
175
+
176
+ - Updated dependencies [08336f1]
177
+ - @ai-sdk/provider-utils@4.0.17
178
+ - @ai-sdk/openai-compatible@2.0.32
179
+
180
+ ## 1.0.6
181
+
182
+ ### Patch Changes
183
+
184
+ - Updated dependencies [58bc42d]
185
+ - @ai-sdk/provider-utils@4.0.16
186
+ - @ai-sdk/openai-compatible@2.0.31
187
+
188
+ ## 1.0.5
189
+
190
+ ### Patch Changes
191
+
192
+ - 6fe0630: fix(provider/alibaba): fix cache control for non-system messages
193
+
194
+ ## 1.0.4
195
+
196
+ ### Patch Changes
197
+
198
+ - Updated dependencies [4024a3a]
199
+ - @ai-sdk/provider-utils@4.0.15
200
+ - @ai-sdk/openai-compatible@2.0.30
201
+
202
+ ## 1.0.3
203
+
204
+ ### Patch Changes
205
+
206
+ - 99fbed8: feat: normalize provider specific model options type names and ensure they are exported
207
+ - Updated dependencies [99fbed8]
208
+ - @ai-sdk/openai-compatible@2.0.29
209
+
210
+ ## 1.0.2
211
+
212
+ ### Patch Changes
213
+
214
+ - 4d8c6b9: feat (provider/alibaba): add video generation support
215
+
216
+ ## 1.0.1
217
+
218
+ ### Patch Changes
219
+
220
+ - Updated dependencies [7168375]
221
+ - @ai-sdk/provider@3.0.8
222
+ - @ai-sdk/openai-compatible@2.0.28
223
+ - @ai-sdk/provider-utils@4.0.14
224
+
225
+ ## 1.0.0
226
+
227
+ ### Major Changes
228
+
229
+ - aa924c7: feat(provider/alibaba): initial alibaba provider
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023 Vercel, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # AI SDK - Alibaba Provider
2
+
3
+ The **[Alibaba provider](https://ai-sdk.dev/providers/ai-sdk-providers/alibaba)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for [Alibaba Cloud Model Studio](https://modelstudio.console.alibabacloud.com/), including the Qwen model series with advanced reasoning capabilities.
4
+
5
+ ## Setup
6
+
7
+ The Alibaba provider is available in the `@ai-sdk/alibaba` module. You can install it with
8
+
9
+ ```bash
10
+ npm i @ai-sdk/alibaba
11
+ ```
12
+
13
+ ## Skill for Coding Agents
14
+
15
+ If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:
16
+
17
+ ```shell
18
+ npx skills add vercel/ai
19
+ ```
20
+
21
+ ## Provider Instance
22
+
23
+ You can import the default provider instance `alibaba` from `@ai-sdk/alibaba`:
24
+
25
+ ```ts
26
+ import { alibaba } from '@ai-sdk/alibaba';
27
+ ```
28
+
29
+ ## Language Model Example
30
+
31
+ ```ts
32
+ import { alibaba } from '@ai-sdk/alibaba';
33
+ import { generateText } from 'ai';
34
+
35
+ const { text } = await generateText({
36
+ model: alibaba('qwen-plus'),
37
+ prompt: 'Write a vegetarian lasagna recipe for 4 people.',
38
+ });
39
+ ```
40
+
41
+ ## Thinking Mode Example (Qwen Reasoning Models)
42
+
43
+ Alibaba's Qwen models support thinking/reasoning mode for complex problem-solving:
44
+
45
+ ```ts
46
+ import { alibaba } from '@ai-sdk/alibaba';
47
+ import { generateText } from 'ai';
48
+
49
+ const { text, reasoningText } = await generateText({
50
+ model: alibaba('qwen3-max'),
51
+ providerOptions: {
52
+ alibaba: {
53
+ enableThinking: true,
54
+ thinkingBudget: 2048,
55
+ },
56
+ },
57
+ prompt: 'How many "r"s are in the word "strawberry"?',
58
+ });
59
+
60
+ console.log('Reasoning:', reasoningText);
61
+ console.log('Answer:', text);
62
+ ```
63
+
64
+ ## Tool Calling Example
65
+
66
+ ```ts
67
+ import { alibaba } from '@ai-sdk/alibaba';
68
+ import { generateText, tool } from 'ai';
69
+ import { z } from 'zod';
70
+
71
+ const { text } = await generateText({
72
+ model: alibaba('qwen-plus'),
73
+ tools: {
74
+ weather: tool({
75
+ description: 'Get the weather in a location',
76
+ parameters: z.object({
77
+ location: z.string().describe('The location to get the weather for'),
78
+ }),
79
+ execute: async ({ location }) => ({
80
+ location,
81
+ temperature: 72 + Math.floor(Math.random() * 21) - 10,
82
+ }),
83
+ }),
84
+ },
85
+ prompt: 'What is the weather in San Francisco?',
86
+ });
87
+ ```
88
+
89
+ ## Explicit Caching Example
90
+
91
+ Alibaba supports both implicit and explicit prompt caching to reduce costs for repeated prompts.
92
+
93
+ **Implicit caching** works automatically - the provider caches appropriate content without any configuration. For more control, you can use **explicit caching** by marking specific messages with `cacheControl`:
94
+
95
+ ```ts
96
+ import { alibaba } from '@ai-sdk/alibaba';
97
+ import { generateText } from 'ai';
98
+
99
+ const longDocument = '... large document content ...';
100
+
101
+ const { text, usage } = await generateText({
102
+ model: alibaba('qwen-plus'),
103
+ messages: [
104
+ {
105
+ role: 'user',
106
+ content: [
107
+ {
108
+ type: 'text',
109
+ text: 'Context: Please analyze this document.',
110
+ },
111
+ {
112
+ type: 'text',
113
+ text: longDocument,
114
+ providerOptions: {
115
+ alibaba: {
116
+ cacheControl: { type: 'ephemeral' },
117
+ },
118
+ },
119
+ },
120
+ ],
121
+ },
122
+ ],
123
+ });
124
+ ```
125
+
126
+ **Note:** The minimum content length for a cache block is 1,024 tokens.
127
+
128
+ ## Documentation
129
+
130
+ Please check out the **[Alibaba provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/alibaba)** for more information.
@@ -0,0 +1,119 @@
1
+ import { z } from 'zod/v4';
2
+ import { FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { ProviderV4, LanguageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
4
+
5
+ type AlibabaChatModelId = '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
+ declare const alibabaLanguageModelOptions: z.ZodObject<{
7
+ enableThinking: z.ZodOptional<z.ZodBoolean>;
8
+ thinkingBudget: z.ZodOptional<z.ZodNumber>;
9
+ parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
10
+ }, z.core.$strip>;
11
+ type AlibabaLanguageModelOptions = z.infer<typeof alibabaLanguageModelOptions>;
12
+
13
+ type AlibabaCacheControl = {
14
+ type: string;
15
+ };
16
+
17
+ type AlibabaVideoModelId = 'wan2.6-t2v' | 'wan2.5-t2v-preview' | 'wan2.6-i2v' | 'wan2.6-i2v-flash' | 'wan2.6-r2v' | 'wan2.6-r2v-flash' | (string & {});
18
+
19
+ interface AlibabaProvider extends ProviderV4 {
20
+ (modelId: AlibabaChatModelId): LanguageModelV4;
21
+ /**
22
+ * Creates a model for text generation.
23
+ */
24
+ languageModel(modelId: AlibabaChatModelId): LanguageModelV4;
25
+ /**
26
+ * Creates a chat model for text generation.
27
+ */
28
+ chatModel(modelId: AlibabaChatModelId): LanguageModelV4;
29
+ /**
30
+ * Creates a model for video generation.
31
+ */
32
+ video(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
33
+ /**
34
+ * Creates a model for video generation.
35
+ */
36
+ videoModel(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
37
+ }
38
+ interface AlibabaProviderSettings {
39
+ /**
40
+ * Use a different URL prefix for API calls, e.g. to use proxy servers or regional endpoints.
41
+ * The default prefix is `https://dashscope-intl.aliyuncs.com/compatible-mode/v1`.
42
+ */
43
+ baseURL?: string;
44
+ /**
45
+ * Use a different URL prefix for video generation API calls.
46
+ * The video API uses the DashScope native endpoint (not the OpenAI-compatible endpoint).
47
+ * The default prefix is `https://dashscope-intl.aliyuncs.com`.
48
+ */
49
+ videoBaseURL?: string;
50
+ /**
51
+ * API key that is being sent using the `Authorization` header.
52
+ * It defaults to the `ALIBABA_API_KEY` environment variable.
53
+ */
54
+ apiKey?: string;
55
+ /**
56
+ * Custom headers to include in the requests.
57
+ */
58
+ headers?: Record<string, string>;
59
+ /**
60
+ * Custom fetch implementation. You can use it as a middleware to intercept requests,
61
+ * or to provide a custom fetch implementation for e.g. testing.
62
+ */
63
+ fetch?: FetchFunction;
64
+ /**
65
+ * Include usage information in streaming responses.
66
+ * When enabled, token usage will be included in the final chunk.
67
+ *
68
+ * @default true
69
+ */
70
+ includeUsage?: boolean;
71
+ }
72
+ /**
73
+ * Create an Alibaba Cloud (Qwen) provider instance.
74
+ */
75
+ declare function createAlibaba(options?: AlibabaProviderSettings): AlibabaProvider;
76
+ declare const alibaba: AlibabaProvider;
77
+
78
+ type AlibabaVideoModelOptions = {
79
+ /** Negative prompt to specify what to avoid (max 500 chars). */
80
+ negativePrompt?: string | null;
81
+ /** URL to audio file for audio-video sync (WAV/MP3, 3-30s, max 15MB). */
82
+ audioUrl?: string | null;
83
+ /** Enable prompt extension/rewriting for better generation. Defaults to true. */
84
+ promptExtend?: boolean | null;
85
+ /** Shot type: 'single' for single-shot or 'multi' for multi-shot narrative. */
86
+ shotType?: 'single' | 'multi' | null;
87
+ /** Whether to add watermark to generated video. Defaults to false. */
88
+ watermark?: boolean | null;
89
+ /** Enable audio generation (for I2V/R2V models). */
90
+ audio?: boolean | null;
91
+ /**
92
+ * Reference URLs for reference-to-video mode.
93
+ * Array of URLs to images (0-5) and/or videos (0-3), max 5 total.
94
+ * Use character identifiers (character1, character2) in prompts to reference them.
95
+ */
96
+ referenceUrls?: string[] | null;
97
+ /** Polling interval in milliseconds. Defaults to 5000 (5 seconds). */
98
+ pollIntervalMs?: number | null;
99
+ /** Maximum wait time in milliseconds for video generation. Defaults to 600000 (10 minutes). */
100
+ pollTimeoutMs?: number | null;
101
+ [key: string]: unknown;
102
+ };
103
+
104
+ type AlibabaUsage = {
105
+ prompt_tokens?: number | null;
106
+ completion_tokens?: number | null;
107
+ total_tokens?: number | null;
108
+ prompt_tokens_details?: {
109
+ cached_tokens?: number | null;
110
+ cache_creation_input_tokens?: number | null;
111
+ } | null;
112
+ completion_tokens_details?: {
113
+ reasoning_tokens?: number | null;
114
+ } | null;
115
+ };
116
+
117
+ declare const VERSION: string;
118
+
119
+ export { type AlibabaCacheControl, type AlibabaChatModelId, type AlibabaLanguageModelOptions, type AlibabaProvider, type AlibabaLanguageModelOptions as AlibabaProviderOptions, type AlibabaProviderSettings, type AlibabaUsage, type AlibabaVideoModelId, type AlibabaVideoModelOptions, type AlibabaVideoModelOptions as AlibabaVideoProviderOptions, VERSION, alibaba, createAlibaba };
@@ -0,0 +1,119 @@
1
+ import { z } from 'zod/v4';
2
+ import { FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { ProviderV4, LanguageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
4
+
5
+ type AlibabaChatModelId = '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
+ declare const alibabaLanguageModelOptions: z.ZodObject<{
7
+ enableThinking: z.ZodOptional<z.ZodBoolean>;
8
+ thinkingBudget: z.ZodOptional<z.ZodNumber>;
9
+ parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
10
+ }, z.core.$strip>;
11
+ type AlibabaLanguageModelOptions = z.infer<typeof alibabaLanguageModelOptions>;
12
+
13
+ type AlibabaCacheControl = {
14
+ type: string;
15
+ };
16
+
17
+ type AlibabaVideoModelId = 'wan2.6-t2v' | 'wan2.5-t2v-preview' | 'wan2.6-i2v' | 'wan2.6-i2v-flash' | 'wan2.6-r2v' | 'wan2.6-r2v-flash' | (string & {});
18
+
19
+ interface AlibabaProvider extends ProviderV4 {
20
+ (modelId: AlibabaChatModelId): LanguageModelV4;
21
+ /**
22
+ * Creates a model for text generation.
23
+ */
24
+ languageModel(modelId: AlibabaChatModelId): LanguageModelV4;
25
+ /**
26
+ * Creates a chat model for text generation.
27
+ */
28
+ chatModel(modelId: AlibabaChatModelId): LanguageModelV4;
29
+ /**
30
+ * Creates a model for video generation.
31
+ */
32
+ video(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
33
+ /**
34
+ * Creates a model for video generation.
35
+ */
36
+ videoModel(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
37
+ }
38
+ interface AlibabaProviderSettings {
39
+ /**
40
+ * Use a different URL prefix for API calls, e.g. to use proxy servers or regional endpoints.
41
+ * The default prefix is `https://dashscope-intl.aliyuncs.com/compatible-mode/v1`.
42
+ */
43
+ baseURL?: string;
44
+ /**
45
+ * Use a different URL prefix for video generation API calls.
46
+ * The video API uses the DashScope native endpoint (not the OpenAI-compatible endpoint).
47
+ * The default prefix is `https://dashscope-intl.aliyuncs.com`.
48
+ */
49
+ videoBaseURL?: string;
50
+ /**
51
+ * API key that is being sent using the `Authorization` header.
52
+ * It defaults to the `ALIBABA_API_KEY` environment variable.
53
+ */
54
+ apiKey?: string;
55
+ /**
56
+ * Custom headers to include in the requests.
57
+ */
58
+ headers?: Record<string, string>;
59
+ /**
60
+ * Custom fetch implementation. You can use it as a middleware to intercept requests,
61
+ * or to provide a custom fetch implementation for e.g. testing.
62
+ */
63
+ fetch?: FetchFunction;
64
+ /**
65
+ * Include usage information in streaming responses.
66
+ * When enabled, token usage will be included in the final chunk.
67
+ *
68
+ * @default true
69
+ */
70
+ includeUsage?: boolean;
71
+ }
72
+ /**
73
+ * Create an Alibaba Cloud (Qwen) provider instance.
74
+ */
75
+ declare function createAlibaba(options?: AlibabaProviderSettings): AlibabaProvider;
76
+ declare const alibaba: AlibabaProvider;
77
+
78
+ type AlibabaVideoModelOptions = {
79
+ /** Negative prompt to specify what to avoid (max 500 chars). */
80
+ negativePrompt?: string | null;
81
+ /** URL to audio file for audio-video sync (WAV/MP3, 3-30s, max 15MB). */
82
+ audioUrl?: string | null;
83
+ /** Enable prompt extension/rewriting for better generation. Defaults to true. */
84
+ promptExtend?: boolean | null;
85
+ /** Shot type: 'single' for single-shot or 'multi' for multi-shot narrative. */
86
+ shotType?: 'single' | 'multi' | null;
87
+ /** Whether to add watermark to generated video. Defaults to false. */
88
+ watermark?: boolean | null;
89
+ /** Enable audio generation (for I2V/R2V models). */
90
+ audio?: boolean | null;
91
+ /**
92
+ * Reference URLs for reference-to-video mode.
93
+ * Array of URLs to images (0-5) and/or videos (0-3), max 5 total.
94
+ * Use character identifiers (character1, character2) in prompts to reference them.
95
+ */
96
+ referenceUrls?: string[] | null;
97
+ /** Polling interval in milliseconds. Defaults to 5000 (5 seconds). */
98
+ pollIntervalMs?: number | null;
99
+ /** Maximum wait time in milliseconds for video generation. Defaults to 600000 (10 minutes). */
100
+ pollTimeoutMs?: number | null;
101
+ [key: string]: unknown;
102
+ };
103
+
104
+ type AlibabaUsage = {
105
+ prompt_tokens?: number | null;
106
+ completion_tokens?: number | null;
107
+ total_tokens?: number | null;
108
+ prompt_tokens_details?: {
109
+ cached_tokens?: number | null;
110
+ cache_creation_input_tokens?: number | null;
111
+ } | null;
112
+ completion_tokens_details?: {
113
+ reasoning_tokens?: number | null;
114
+ } | null;
115
+ };
116
+
117
+ declare const VERSION: string;
118
+
119
+ export { type AlibabaCacheControl, type AlibabaChatModelId, type AlibabaLanguageModelOptions, type AlibabaProvider, type AlibabaLanguageModelOptions as AlibabaProviderOptions, type AlibabaProviderSettings, type AlibabaUsage, type AlibabaVideoModelId, type AlibabaVideoModelOptions, type AlibabaVideoModelOptions as AlibabaVideoProviderOptions, VERSION, alibaba, createAlibaba };