@metagptx/web-sdk 0.0.59-beta.2 → 0.0.59-beta.3

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.
Files changed (2) hide show
  1. package/README.md +80 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -54,7 +54,7 @@ The SDK provides eight main modules and a Vite plugin:
54
54
  - **integrations**: Integration function invocations
55
55
  - **frame**: Frame communication operations for iframe/parent window messaging
56
56
  - **utils**: Utility functions for URL opening and window management
57
- - **ai**: AI-powered text and image generation
57
+ - **ai**: AI-powered text, image, video, and audio generation
58
58
  - **storage**: Object storage operations (buckets, files, upload/download)
59
59
  - **vitePlugin404**: Vite plugin for automatically adding a 404 page to React Router applications
60
60
 
@@ -591,7 +591,7 @@ client.utils.openUrl('https://stripe.com/checkout'); // Navigates to URL when no
591
591
 
592
592
  ### AI Module
593
593
 
594
- Provides AI-powered text and image generation capabilities with support for streaming responses, multimodal inputs, and image editing.
594
+ Provides AI-powered text, image, video, and audio generation capabilities with support for streaming responses, multimodal inputs, image editing, and text-to-speech.
595
595
 
596
596
  #### `ai.gentxt(params)`
597
597
 
@@ -720,6 +720,76 @@ const response = await client.ai.genimg({
720
720
  }, { timeout: 600_000 });
721
721
  ```
722
722
 
723
+ #### `ai.genvideo(params, options?)`
724
+
725
+ Generate videos using AI models. Supports text-to-video and image-to-video (using an image as the first frame). Video generation is async — the API polls internally until completion.
726
+
727
+ **HTTP Details:**
728
+ - **Method:** `POST`
729
+ - **Path:** `/api/v1/aihub/genvideo`
730
+ - **Parameters:**
731
+ - `prompt` (required): Text prompt describing the desired video
732
+ - `model` (required): Model identifier (e.g., `'wan2.6-t2v'` for text-to-video, `'wan2.6-i2v'` for image-to-video)
733
+ - `size` (optional): Video size (default: `"1280x720"`)
734
+ - `seconds` (optional): Video duration in seconds (default: `"8"`)
735
+ - `image` (optional): Base64 Data URI image as the first frame reference (for image-to-video)
736
+ - **Options:**
737
+ - `timeout` (optional): Request timeout in milliseconds (default: 600000ms / 10 minutes). Video generation is slow; consider setting a longer timeout (e.g., `600_000` ms or more)
738
+
739
+ **Response:** `response.data.url` is the CDN URL of the generated video.
740
+
741
+ **Example - Text-to-Video:**
742
+ ```typescript
743
+ const video = await client.ai.genvideo(
744
+ { prompt: 'Ocean waves at sunset', model: 'wan2.6-t2v' },
745
+ { timeout: 600_000 }
746
+ );
747
+ const videoUrl = video.data.url;
748
+ ```
749
+
750
+ **Example - Image-to-Video (use image as first frame):**
751
+ ```typescript
752
+ const videoFromImage = await client.ai.genvideo(
753
+ { prompt: 'Animate the scene', model: 'wan2.6-i2v', image: 'data:image/png;base64,...' },
754
+ { timeout: 600_000 }
755
+ );
756
+ const videoUrl = videoFromImage.data.url;
757
+ ```
758
+
759
+ #### `ai.genaudio(params, options?)`
760
+
761
+ Generate audio (text-to-speech) using AI models. Voice is auto-selected based on model and gender — no manual voice selection needed.
762
+
763
+ **HTTP Details:**
764
+ - **Method:** `POST`
765
+ - **Path:** `/api/v1/aihub/genaudio`
766
+ - **Parameters:**
767
+ - `text` (required): Text content to convert to speech
768
+ - `model` (required): Model identifier (e.g., `'qwen3-tts-flash'`, `'eleven-v3-alpha'`)
769
+ - `gender` (optional): Voice gender — `"male"` or `"female"` (default: `"female"`)
770
+ - **Options:**
771
+ - `timeout` (optional): Request timeout in milliseconds (default: 60000ms / 1 minute)
772
+
773
+ **Response:** `response.data.url` is the CDN URL of the generated audio (mp3).
774
+
775
+ **Example - Female voice (default):**
776
+ ```typescript
777
+ const audio = await client.ai.genaudio(
778
+ { text: 'Welcome to our website', model: 'qwen3-tts-flash', gender: 'female' },
779
+ { timeout: 60_000 }
780
+ );
781
+ const audioUrl = audio.data.url;
782
+ ```
783
+
784
+ **Example - Male voice:**
785
+ ```typescript
786
+ const maleAudio = await client.ai.genaudio(
787
+ { text: 'Product introduction', model: 'eleven-v3-alpha', gender: 'male' },
788
+ { timeout: 60_000 }
789
+ );
790
+ const audioUrl = maleAudio.data.url;
791
+ ```
792
+
723
793
  ---
724
794
 
725
795
  ### Storage Module
@@ -1150,12 +1220,16 @@ import type {
1150
1220
  CreateBucketParams,
1151
1221
  CreateBucketResponse,
1152
1222
  DownloadParams,
1223
+ GenAudioParams,
1224
+ GenAudioResponse,
1153
1225
  GenImgParams,
1154
1226
  GenImgResponse,
1155
1227
  GenTxtNonStreamParams,
1156
1228
  GenTxtParams,
1157
1229
  GenTxtResponse,
1158
1230
  GenTxtStreamParams,
1231
+ GenVideoParams,
1232
+ GenVideoResponse,
1159
1233
  GetDownloadUrlParams,
1160
1234
  GetDownloadUrlResponse,
1161
1235
  GetObjectInfoParams,
@@ -1196,6 +1270,10 @@ import type {
1196
1270
  - **`GenTxtResponse`**: Text generation response
1197
1271
  - **`GenImgParams`**: Image generation parameters
1198
1272
  - **`GenImgResponse`**: Image generation response
1273
+ - **`GenVideoParams`**: Video generation parameters
1274
+ - **`GenVideoResponse`**: Video generation response (CDN URL)
1275
+ - **`GenAudioParams`**: Audio generation (TTS) parameters
1276
+ - **`GenAudioResponse`**: Audio generation response (CDN URL)
1199
1277
  - **`StreamChunk`**: Chunk received during streaming
1200
1278
  - **`StreamResult`**: Complete streaming result
1201
1279
  - **`ImageContent`**: Image content for multimodal messages
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@metagptx/web-sdk",
3
3
  "type": "module",
4
- "version": "0.0.59-beta.2",
4
+ "version": "0.0.59-beta.3",
5
5
  "packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b",
6
6
  "description": "TypeScript SDK for interacting with FuncSea API",
7
7
  "author": "MetaGPTX",