@runpod/ai-sdk-provider 1.2.0 → 1.3.0
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 +6 -0
- package/README.md +110 -10
- package/dist/index.d.mts +46 -3
- package/dist/index.d.ts +46 -3
- package/dist/index.js +318 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +322 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -291,6 +291,7 @@ Check out our [examples](https://github.com/runpod/examples/tree/main/ai-sdk/get
|
|
|
291
291
|
| `qwen/qwen-image` | t2i | up to 4096x4096 | 1:1, 4:3, 3:4 |
|
|
292
292
|
| `qwen/qwen-image-edit` | edit | up to 4096x4096 | 1:1, 4:3, 3:4 |
|
|
293
293
|
| `qwen/qwen-image-edit-2511` | edit | up to 1536x1536 | 1:1, 4:3, 3:4 |
|
|
294
|
+
| `tongyi-mai/z-image-turbo` | t2i | up to 1536x1536 | 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16 |
|
|
294
295
|
| `black-forest-labs/flux-1-schnell` | t2i | up to 2048x2048 | 1:1, 4:3, 3:4 |
|
|
295
296
|
| `black-forest-labs/flux-1-dev` | t2i | up to 2048x2048 | 1:1, 4:3, 3:4 |
|
|
296
297
|
| `black-forest-labs/flux-1-kontext-dev` | edit | up to 2048x2048 | 1:1, 4:3, 3:4 |
|
|
@@ -435,6 +436,14 @@ const { image } = await generateImage({
|
|
|
435
436
|
});
|
|
436
437
|
```
|
|
437
438
|
|
|
439
|
+
#### Tongyi-MAI (Z-Image Turbo)
|
|
440
|
+
|
|
441
|
+
Supported model: `tongyi-mai/z-image-turbo`
|
|
442
|
+
|
|
443
|
+
- Supported sizes (validated by provider): 512x512, 768x768, 1024x1024, 1280x1280, 1536x1536, 512x768, 768x512, 1024x768, 768x1024, 1328x1328, 1472x1140, 1140x1472, 768x432, 1024x576, 1280x720, 1536x864, 432x768, 576x1024, 720x1280, 864x1536
|
|
444
|
+
- Supported `aspectRatio` values: 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16 (maps to sizes above; use `size` for exact dimensions)
|
|
445
|
+
- Additional parameters: `strength`, `output_format`, `enable_safety_checker`, `seed`
|
|
446
|
+
|
|
438
447
|
## Speech Models
|
|
439
448
|
|
|
440
449
|
Generate speech using the AI SDK's `generateSpeech` and `runpod.speech(...)`:
|
|
@@ -626,16 +635,16 @@ Check out our [examples](https://github.com/runpod/examples/tree/main/ai-sdk/get
|
|
|
626
635
|
|
|
627
636
|
Use `providerOptions.runpod` for model-specific parameters:
|
|
628
637
|
|
|
629
|
-
| Option
|
|
630
|
-
|
|
|
631
|
-
| `audio`
|
|
632
|
-
| `prompt`
|
|
633
|
-
| `language`
|
|
634
|
-
| `word_timestamps`
|
|
635
|
-
| `translate`
|
|
636
|
-
| `enable_vad`
|
|
637
|
-
| `maxPollAttempts`
|
|
638
|
-
| `pollIntervalMillis
|
|
638
|
+
| Option | Type | Default | Description |
|
|
639
|
+
| -------------------- | --------- | ------- | ---------------------------------------------- |
|
|
640
|
+
| `audio` | `string` | - | URL to audio file (alternative to binary data) |
|
|
641
|
+
| `prompt` | `string` | - | Context prompt to guide transcription |
|
|
642
|
+
| `language` | `string` | Auto | ISO-639-1 language code (e.g., 'en', 'es') |
|
|
643
|
+
| `word_timestamps` | `boolean` | `false` | Include word-level timestamps |
|
|
644
|
+
| `translate` | `boolean` | `false` | Translate audio to English |
|
|
645
|
+
| `enable_vad` | `boolean` | `false` | Enable voice activity detection |
|
|
646
|
+
| `maxPollAttempts` | `number` | `120` | Max polling attempts |
|
|
647
|
+
| `pollIntervalMillis` | `number` | `2000` | Polling interval (ms) |
|
|
639
648
|
|
|
640
649
|
**Example (providerOptions):**
|
|
641
650
|
|
|
@@ -653,6 +662,97 @@ const result = await transcribe({
|
|
|
653
662
|
});
|
|
654
663
|
```
|
|
655
664
|
|
|
665
|
+
## Video Models
|
|
666
|
+
|
|
667
|
+
Generate videos using the AI SDK's `experimental_generateVideo` and `runpod.video(...)`:
|
|
668
|
+
|
|
669
|
+
```ts
|
|
670
|
+
import { runpod } from '@runpod/ai-sdk-provider';
|
|
671
|
+
import { experimental_generateVideo as generateVideo } from 'ai';
|
|
672
|
+
|
|
673
|
+
// Text-to-video
|
|
674
|
+
const result = await generateVideo({
|
|
675
|
+
model: runpod.video('alibaba/wan-2.6-t2v'),
|
|
676
|
+
prompt: 'A golden retriever running on a sunny beach, cinematic, 4k',
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
console.log(result.video.url);
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
```ts
|
|
683
|
+
// Image-to-video
|
|
684
|
+
const result = await generateVideo({
|
|
685
|
+
model: runpod.video('alibaba/wan-2.6-i2v'),
|
|
686
|
+
prompt: 'Animate this scene with gentle camera movement',
|
|
687
|
+
image: new URL('https://example.com/image.png'),
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
console.log(result.video.url);
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
**Returns:**
|
|
694
|
+
|
|
695
|
+
- `result.video` - Generated video (`{ type: 'url', url, mediaType: 'video/mp4' }`)
|
|
696
|
+
- `result.warnings` - Array of any warnings
|
|
697
|
+
- `result.providerMetadata.runpod.jobId` - Runpod job ID
|
|
698
|
+
|
|
699
|
+
### Examples
|
|
700
|
+
|
|
701
|
+
Check out our [examples](https://github.com/runpod/examples/tree/main/ai-sdk/getting-started) for more code snippets on how to use all the different models.
|
|
702
|
+
|
|
703
|
+
### Supported Models
|
|
704
|
+
|
|
705
|
+
| Model ID | Type | Company |
|
|
706
|
+
| --------------------------------------- | ----------- | ------------------- |
|
|
707
|
+
| `pruna/p-video` | t2v | Pruna AI |
|
|
708
|
+
| `vidu/q3-t2v` | t2v | Shengshu Technology |
|
|
709
|
+
| `vidu/q3-i2v` | i2v | Shengshu Technology |
|
|
710
|
+
| `kwaivgi/kling-v2.6-std-motion-control` | i2v + video | KwaiVGI (Kuaishou) |
|
|
711
|
+
| `kwaivgi/kling-video-o1-r2v` | i2v | KwaiVGI (Kuaishou) |
|
|
712
|
+
| `kwaivgi/kling-v2.1-i2v-pro` | i2v | KwaiVGI (Kuaishou) |
|
|
713
|
+
| `alibaba/wan-2.6-t2v` | t2v | Alibaba |
|
|
714
|
+
| `alibaba/wan-2.6-i2v` | i2v | Alibaba |
|
|
715
|
+
| `alibaba/wan-2.5` | i2v | Alibaba |
|
|
716
|
+
| `alibaba/wan-2.2-t2v-720-lora` | i2v | Alibaba |
|
|
717
|
+
| `alibaba/wan-2.2-i2v-720` | i2v | Alibaba |
|
|
718
|
+
| `alibaba/wan-2.1-i2v-720` | i2v | Alibaba |
|
|
719
|
+
| `bytedance/seedance-v1.5-pro-i2v` | i2v | ByteDance |
|
|
720
|
+
| `openai/sora-2-pro-i2v` | i2v | OpenAI |
|
|
721
|
+
| `openai/sora-2-i2v` | i2v | OpenAI |
|
|
722
|
+
|
|
723
|
+
### Provider Options
|
|
724
|
+
|
|
725
|
+
Use `providerOptions.runpod` for model-specific parameters:
|
|
726
|
+
|
|
727
|
+
| Option | Type | Default | Description |
|
|
728
|
+
| --------------------- | -------- | ------- | ------------------------------------ |
|
|
729
|
+
| `negative_prompt` | `string` | - | What to avoid in the generated video |
|
|
730
|
+
| `guidance_scale` | `number` | - | Guidance scale for prompt adherence |
|
|
731
|
+
| `num_inference_steps` | `number` | - | Number of inference steps |
|
|
732
|
+
| `style` | `string` | - | Style preset (model-specific) |
|
|
733
|
+
| `maxPollAttempts` | `number` | `120` | Max polling attempts |
|
|
734
|
+
| `pollIntervalMillis` | `number` | `5000` | Polling interval (ms) |
|
|
735
|
+
|
|
736
|
+
Any additional model-specific parameters can be passed through `providerOptions.runpod` and will be forwarded to the API.
|
|
737
|
+
|
|
738
|
+
**Example (providerOptions):**
|
|
739
|
+
|
|
740
|
+
```ts
|
|
741
|
+
const result = await generateVideo({
|
|
742
|
+
model: runpod.video('alibaba/wan-2.6-t2v'),
|
|
743
|
+
prompt: 'A serene mountain landscape with flowing water',
|
|
744
|
+
duration: 5,
|
|
745
|
+
aspectRatio: '16:9',
|
|
746
|
+
seed: 42,
|
|
747
|
+
providerOptions: {
|
|
748
|
+
runpod: {
|
|
749
|
+
negative_prompt: 'blurry, low quality',
|
|
750
|
+
guidance_scale: 7.5,
|
|
751
|
+
},
|
|
752
|
+
},
|
|
753
|
+
});
|
|
754
|
+
```
|
|
755
|
+
|
|
656
756
|
## About Runpod
|
|
657
757
|
|
|
658
758
|
[Runpod](https://runpod.io) is the foundation for developers to build, deploy, and scale custom AI systems.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageModelV3, ImageModelV3, SpeechModelV3, TranscriptionModelV3 } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV3, ImageModelV3, SpeechModelV3, TranscriptionModelV3, Experimental_VideoModelV3 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
export { OpenAICompatibleErrorData as RunpodErrorData } from '@ai-sdk/openai-compatible';
|
|
4
4
|
import { z } from 'zod';
|
|
@@ -64,6 +64,14 @@ interface RunpodProvider {
|
|
|
64
64
|
Creates a transcription model for audio transcription.
|
|
65
65
|
*/
|
|
66
66
|
transcription(modelId: string): TranscriptionModelV3;
|
|
67
|
+
/**
|
|
68
|
+
Creates a video model for video generation.
|
|
69
|
+
*/
|
|
70
|
+
videoModel(modelId: string): Experimental_VideoModelV3;
|
|
71
|
+
/**
|
|
72
|
+
Creates a video model for video generation.
|
|
73
|
+
*/
|
|
74
|
+
video(modelId: string): Experimental_VideoModelV3;
|
|
67
75
|
}
|
|
68
76
|
declare function createRunpod(options?: RunpodProviderSettings): RunpodProvider;
|
|
69
77
|
declare const runpod: RunpodProvider;
|
|
@@ -72,7 +80,7 @@ type RunpodChatModelId = 'qwen/qwen3-32b-awq' | (string & {});
|
|
|
72
80
|
|
|
73
81
|
type RunpodCompletionModelId = 'qwen/qwen3-32b-awq' | (string & {});
|
|
74
82
|
|
|
75
|
-
type RunpodImageModelId = 'qwen/qwen-image' | 'qwen/qwen-image-edit' | 'qwen/qwen-image-edit-2511' | 'bytedance/seedream-3.0' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.0-edit' | 'black-forest-labs/flux-1-kontext-dev' | 'black-forest-labs/flux-1-schnell' | 'black-forest-labs/flux-1-dev' | 'alibaba/wan-2.6' | 'google/nano-banana-edit' | 'nano-banana-edit';
|
|
83
|
+
type RunpodImageModelId = 'qwen/qwen-image' | 'qwen/qwen-image-edit' | 'qwen/qwen-image-edit-2511' | 'bytedance/seedream-3.0' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.0-edit' | 'black-forest-labs/flux-1-kontext-dev' | 'black-forest-labs/flux-1-schnell' | 'black-forest-labs/flux-1-dev' | 'alibaba/wan-2.6' | 'tongyi-mai/z-image-turbo' | 'google/nano-banana-edit' | 'nano-banana-edit';
|
|
76
84
|
|
|
77
85
|
type RunpodTranscriptionModelId = 'pruna/whisper-v3-large' | (string & {});
|
|
78
86
|
interface RunpodTranscriptionProviderOptions {
|
|
@@ -133,6 +141,41 @@ interface RunpodTranscriptionProviderOptions {
|
|
|
133
141
|
pollIntervalMillis?: number;
|
|
134
142
|
}
|
|
135
143
|
|
|
144
|
+
type RunpodVideoModelId = 'pruna/p-video' | 'vidu/q3-t2v' | 'vidu/q3-i2v' | 'kwaivgi/kling-v2.6-std-motion-control' | 'kwaivgi/kling-video-o1-r2v' | 'kwaivgi/kling-v2.1-i2v-pro' | 'alibaba/wan-2.6-t2v' | 'alibaba/wan-2.6-i2v' | 'alibaba/wan-2.5' | 'alibaba/wan-2.2-t2v-720-lora' | 'alibaba/wan-2.2-i2v-720' | 'alibaba/wan-2.1-i2v-720' | 'bytedance/seedance-v1.5-pro-i2v' | 'openai/sora-2-pro-i2v' | 'openai/sora-2-i2v' | (string & {});
|
|
145
|
+
interface RunpodVideoProviderOptions {
|
|
146
|
+
/**
|
|
147
|
+
* Negative prompt to guide what to avoid in the generated video.
|
|
148
|
+
*/
|
|
149
|
+
negative_prompt?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Style preset for video generation (model-specific).
|
|
152
|
+
*/
|
|
153
|
+
style?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Guidance scale for prompt adherence.
|
|
156
|
+
*/
|
|
157
|
+
guidance_scale?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Number of inference steps.
|
|
160
|
+
*/
|
|
161
|
+
num_inference_steps?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Maximum number of polling attempts before timing out.
|
|
164
|
+
* @default 120
|
|
165
|
+
*/
|
|
166
|
+
maxPollAttempts?: number;
|
|
167
|
+
/**
|
|
168
|
+
* Interval between polling attempts in milliseconds.
|
|
169
|
+
* @default 5000
|
|
170
|
+
*/
|
|
171
|
+
pollIntervalMillis?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Additional model-specific parameters are passed through via
|
|
174
|
+
* index signature.
|
|
175
|
+
*/
|
|
176
|
+
[key: string]: unknown;
|
|
177
|
+
}
|
|
178
|
+
|
|
136
179
|
declare const runpodImageErrorSchema: z.ZodObject<{
|
|
137
180
|
error: z.ZodOptional<z.ZodString>;
|
|
138
181
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -145,4 +188,4 @@ declare const runpodImageErrorSchema: z.ZodObject<{
|
|
|
145
188
|
}>;
|
|
146
189
|
type RunpodImageErrorData = z.infer<typeof runpodImageErrorSchema>;
|
|
147
190
|
|
|
148
|
-
export { type RunpodChatModelId, type RunpodCompletionModelId, type RunpodImageErrorData, type RunpodImageModelId, type RunpodProvider, type RunpodProviderSettings, type RunpodTranscriptionModelId, type RunpodTranscriptionProviderOptions, createRunpod, runpod };
|
|
191
|
+
export { type RunpodChatModelId, type RunpodCompletionModelId, type RunpodImageErrorData, type RunpodImageModelId, type RunpodProvider, type RunpodProviderSettings, type RunpodTranscriptionModelId, type RunpodTranscriptionProviderOptions, type RunpodVideoModelId, type RunpodVideoProviderOptions, createRunpod, runpod };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageModelV3, ImageModelV3, SpeechModelV3, TranscriptionModelV3 } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV3, ImageModelV3, SpeechModelV3, TranscriptionModelV3, Experimental_VideoModelV3 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
export { OpenAICompatibleErrorData as RunpodErrorData } from '@ai-sdk/openai-compatible';
|
|
4
4
|
import { z } from 'zod';
|
|
@@ -64,6 +64,14 @@ interface RunpodProvider {
|
|
|
64
64
|
Creates a transcription model for audio transcription.
|
|
65
65
|
*/
|
|
66
66
|
transcription(modelId: string): TranscriptionModelV3;
|
|
67
|
+
/**
|
|
68
|
+
Creates a video model for video generation.
|
|
69
|
+
*/
|
|
70
|
+
videoModel(modelId: string): Experimental_VideoModelV3;
|
|
71
|
+
/**
|
|
72
|
+
Creates a video model for video generation.
|
|
73
|
+
*/
|
|
74
|
+
video(modelId: string): Experimental_VideoModelV3;
|
|
67
75
|
}
|
|
68
76
|
declare function createRunpod(options?: RunpodProviderSettings): RunpodProvider;
|
|
69
77
|
declare const runpod: RunpodProvider;
|
|
@@ -72,7 +80,7 @@ type RunpodChatModelId = 'qwen/qwen3-32b-awq' | (string & {});
|
|
|
72
80
|
|
|
73
81
|
type RunpodCompletionModelId = 'qwen/qwen3-32b-awq' | (string & {});
|
|
74
82
|
|
|
75
|
-
type RunpodImageModelId = 'qwen/qwen-image' | 'qwen/qwen-image-edit' | 'qwen/qwen-image-edit-2511' | 'bytedance/seedream-3.0' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.0-edit' | 'black-forest-labs/flux-1-kontext-dev' | 'black-forest-labs/flux-1-schnell' | 'black-forest-labs/flux-1-dev' | 'alibaba/wan-2.6' | 'google/nano-banana-edit' | 'nano-banana-edit';
|
|
83
|
+
type RunpodImageModelId = 'qwen/qwen-image' | 'qwen/qwen-image-edit' | 'qwen/qwen-image-edit-2511' | 'bytedance/seedream-3.0' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.0-edit' | 'black-forest-labs/flux-1-kontext-dev' | 'black-forest-labs/flux-1-schnell' | 'black-forest-labs/flux-1-dev' | 'alibaba/wan-2.6' | 'tongyi-mai/z-image-turbo' | 'google/nano-banana-edit' | 'nano-banana-edit';
|
|
76
84
|
|
|
77
85
|
type RunpodTranscriptionModelId = 'pruna/whisper-v3-large' | (string & {});
|
|
78
86
|
interface RunpodTranscriptionProviderOptions {
|
|
@@ -133,6 +141,41 @@ interface RunpodTranscriptionProviderOptions {
|
|
|
133
141
|
pollIntervalMillis?: number;
|
|
134
142
|
}
|
|
135
143
|
|
|
144
|
+
type RunpodVideoModelId = 'pruna/p-video' | 'vidu/q3-t2v' | 'vidu/q3-i2v' | 'kwaivgi/kling-v2.6-std-motion-control' | 'kwaivgi/kling-video-o1-r2v' | 'kwaivgi/kling-v2.1-i2v-pro' | 'alibaba/wan-2.6-t2v' | 'alibaba/wan-2.6-i2v' | 'alibaba/wan-2.5' | 'alibaba/wan-2.2-t2v-720-lora' | 'alibaba/wan-2.2-i2v-720' | 'alibaba/wan-2.1-i2v-720' | 'bytedance/seedance-v1.5-pro-i2v' | 'openai/sora-2-pro-i2v' | 'openai/sora-2-i2v' | (string & {});
|
|
145
|
+
interface RunpodVideoProviderOptions {
|
|
146
|
+
/**
|
|
147
|
+
* Negative prompt to guide what to avoid in the generated video.
|
|
148
|
+
*/
|
|
149
|
+
negative_prompt?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Style preset for video generation (model-specific).
|
|
152
|
+
*/
|
|
153
|
+
style?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Guidance scale for prompt adherence.
|
|
156
|
+
*/
|
|
157
|
+
guidance_scale?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Number of inference steps.
|
|
160
|
+
*/
|
|
161
|
+
num_inference_steps?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Maximum number of polling attempts before timing out.
|
|
164
|
+
* @default 120
|
|
165
|
+
*/
|
|
166
|
+
maxPollAttempts?: number;
|
|
167
|
+
/**
|
|
168
|
+
* Interval between polling attempts in milliseconds.
|
|
169
|
+
* @default 5000
|
|
170
|
+
*/
|
|
171
|
+
pollIntervalMillis?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Additional model-specific parameters are passed through via
|
|
174
|
+
* index signature.
|
|
175
|
+
*/
|
|
176
|
+
[key: string]: unknown;
|
|
177
|
+
}
|
|
178
|
+
|
|
136
179
|
declare const runpodImageErrorSchema: z.ZodObject<{
|
|
137
180
|
error: z.ZodOptional<z.ZodString>;
|
|
138
181
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -145,4 +188,4 @@ declare const runpodImageErrorSchema: z.ZodObject<{
|
|
|
145
188
|
}>;
|
|
146
189
|
type RunpodImageErrorData = z.infer<typeof runpodImageErrorSchema>;
|
|
147
190
|
|
|
148
|
-
export { type RunpodChatModelId, type RunpodCompletionModelId, type RunpodImageErrorData, type RunpodImageModelId, type RunpodProvider, type RunpodProviderSettings, type RunpodTranscriptionModelId, type RunpodTranscriptionProviderOptions, createRunpod, runpod };
|
|
191
|
+
export { type RunpodChatModelId, type RunpodCompletionModelId, type RunpodImageErrorData, type RunpodImageModelId, type RunpodProvider, type RunpodProviderSettings, type RunpodTranscriptionModelId, type RunpodTranscriptionProviderOptions, type RunpodVideoModelId, type RunpodVideoProviderOptions, createRunpod, runpod };
|