JSPM

@mastra/voice-cloudflare

0.12.0-beta.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1091
  • Score
    100M100P100Q105581F
  • License Apache-2.0

Mastra Cloudflare AI voice integration

Package Exports

  • @mastra/voice-cloudflare
  • @mastra/voice-cloudflare/package.json

Readme

@mastra/voice-cloudflare

Cloudflare Voice integration for Mastra, providing Text-to-Speech (TTS) capabilities using open source speech models.

Installation

npm install @mastra/voice-cloudflare

Configuration

The module requires the following environment variables:

If using Cloudflare Native Bindings:

./wrangler.jsonc

"ai": {
    "binding": "AI",
  },

If using Cloudflare REST API:

CLOUDFLARE_AI_API_KEY=your_api_key
CLOUDFLARE_ACCOUNT_ID=your_account_id

Usage

import { CloudflareVoice } from '@mastra/voice-cloudflare';

// Native Bindings
const voice = new CloudflareVoice({
  binding: env.AI,
  listeningModel: {
    model: '@cf/openai/whisper-large-v3-turbo',
  },
});

// REST API
const voice = new CloudflareVoice({
  listeningModel: {
    apiKey: 'YOUR_API_KEY',
    model: '@cf/openai/whisper-large-v3-turbo',
    account_id: 'YOUR_ACC_ID',
  },
});

// Generate Text from an audio stream
const text = await voice.listen(audioStream);

Features

  • Open source models

Available Models

Speech Models

The following speech-to-text models are available:

Model Description
@cf/openai/whisper-tiny-en Lightweight English-only model
@cf/openai/whisper Standard multilingual model
@cf/openai/whisper-large-v3-turbo High-accuracy turbo model