@mastra/voice-cloudflare 0.12.0-beta.0 → 0.12.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.
@@ -0,0 +1,72 @@
1
+ # Voice API Reference
2
+
3
+ > API reference for voice - 1 entries
4
+
5
+
6
+ ---
7
+
8
+ ## Reference: Cloudflare
9
+
10
+ > Documentation for the CloudflareVoice class, providing text-to-speech capabilities using Cloudflare Workers AI.
11
+
12
+ The CloudflareVoice class in Mastra provides text-to-speech capabilities using Cloudflare Workers AI. This provider specializes in efficient, low-latency speech synthesis suitable for edge computing environments.
13
+
14
+ ## Usage Example
15
+
16
+ ```typescript
17
+ import { CloudflareVoice } from "@mastra/voice-cloudflare";
18
+
19
+ // Initialize with configuration
20
+ const voice = new CloudflareVoice({
21
+ speechModel: {
22
+ name: "@cf/meta/m2m100-1.2b",
23
+ apiKey: "your-cloudflare-api-token",
24
+ accountId: "your-cloudflare-account-id",
25
+ },
26
+ speaker: "en-US-1", // Default voice
27
+ });
28
+
29
+ // Convert text to speech
30
+ const audioStream = await voice.speak("Hello, how can I help you?", {
31
+ speaker: "en-US-2", // Override default voice
32
+ });
33
+
34
+ // Get available voices
35
+ const speakers = await voice.getSpeakers();
36
+ console.log(speakers);
37
+ ```
38
+
39
+ ## Configuration
40
+
41
+ ### Constructor Options
42
+
43
+ ### CloudflareSpeechConfig
44
+
45
+ ## Methods
46
+
47
+ ### speak()
48
+
49
+ Converts text to speech using Cloudflare's text-to-speech service.
50
+
51
+ Returns: `Promise<NodeJS.ReadableStream>`
52
+
53
+ ### getSpeakers()
54
+
55
+ Returns an array of available voice options, where each node contains:
56
+
57
+ ## Notes
58
+
59
+ - API tokens can be provided via constructor options or environment variables (CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID)
60
+ - Cloudflare Workers AI is optimized for edge computing with low latency
61
+ - This provider only supports text-to-speech (TTS) functionality, not speech-to-text (STT)
62
+ - The service integrates well with other Cloudflare Workers products
63
+ - For production use, ensure your Cloudflare account has the appropriate Workers AI subscription
64
+ - Voice options are more limited compared to some other providers, but performance at the edge is excellent
65
+
66
+ ## Related Providers
67
+
68
+ If you need speech-to-text capabilities in addition to text-to-speech, consider using one of these providers:
69
+
70
+ - [OpenAI](./openai) - Provides both TTS and STT
71
+ - [Google](./google) - Provides both TTS and STT
72
+ - [Azure](./azure) - Provides both TTS and STT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/voice-cloudflare",
3
- "version": "0.12.0-beta.0",
3
+ "version": "0.12.0",
4
4
  "description": "Mastra Cloudflare AI voice integration",
5
5
  "type": "module",
6
6
  "files": [
@@ -27,17 +27,18 @@
27
27
  "cloudflare": "^4.5.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@cloudflare/workers-types": "^4.20251008.0",
31
- "@microsoft/api-extractor": "^7.52.8",
32
- "@types/node": "^20.19.0",
30
+ "@cloudflare/workers-types": "^4.20251111.0",
31
+ "@types/node": "22.13.17",
32
+ "@vitest/coverage-v8": "4.0.12",
33
+ "@vitest/ui": "4.0.12",
33
34
  "eslint": "^9.37.0",
34
35
  "tsup": "^8.5.0",
35
- "typescript": "^5.8.3",
36
- "vitest": "^3.2.4",
36
+ "typescript": "^5.9.3",
37
+ "vitest": "4.0.16",
37
38
  "zod": "^3.25.76",
38
- "@internal/lint": "0.0.53",
39
- "@internal/types-builder": "0.0.28",
40
- "@mastra/core": "1.0.0-beta.0"
39
+ "@internal/lint": "0.0.54",
40
+ "@internal/types-builder": "0.0.29",
41
+ "@mastra/core": "1.0.0"
41
42
  },
42
43
  "keywords": [
43
44
  "mastra",
@@ -67,6 +68,7 @@
67
68
  },
68
69
  "scripts": {
69
70
  "build": "tsup --silent --config tsup.config.ts",
71
+ "postbuild": "pnpx tsx ../../scripts/generate-package-docs.ts voice/cloudflare",
70
72
  "build:watch": "tsup --watch --silent --config tsup.config.ts",
71
73
  "test": "vitest run",
72
74
  "test:watch": "vitest watch",