Azure Voice setup + outdated doc
Hello, i am not able to use azure voice models :
here is my code:
Error: HTTP error! status: 500 - {"error":"Speech recognition failed: NoMatch - ","stack":"Error: Speech recognition failed: NoMatch - \nError: HTTP error! status: 500 - {"error":"Speech recognition failed: NoMatch - ","stack":"Error: Speech recognition failed: NoMatch - \nhere is my code:
import { createAzure } from '@ai-sdk/azure';
import { Agent } from '@mastra/core/agent';
import { AzureVoice } from '@mastra/voice-azure';
const azure = createAzure({
resourceName: process.env.AZURE_RESOURCE_NAME,
apiKey: process.env.AZURE_OPENAI_API_KEY,
});
const voice = new AzureVoice({
speechModel: {
voiceName: 'neural', // or a specific voice like "en-US-JennyNeural"
apiKey: process.env.AZURE_OPENAI_API_KEY,
region: process.env.AZURE_REGION,
},
listeningModel: {
voiceName: 'whisper', // or "en-US"
apiKey: process.env.AZURE_OPENAI_API_KEY,
region: process.env.AZURE_REGION,
},
speaker: 'en-US-JennyNeural', // Default voice
});
export const voiceAgent = new Agent({
name: 'Voice Agent',
instructions: `
# Goal
You are a helpful voice assistant that can help with voice related tasks.
`,
model: azure.languageModel('gpt-5-chat'),
voice: voice,
});import { createAzure } from '@ai-sdk/azure';
import { Agent } from '@mastra/core/agent';
import { AzureVoice } from '@mastra/voice-azure';
const azure = createAzure({
resourceName: process.env.AZURE_RESOURCE_NAME,
apiKey: process.env.AZURE_OPENAI_API_KEY,
});
const voice = new AzureVoice({
speechModel: {
voiceName: 'neural', // or a specific voice like "en-US-JennyNeural"
apiKey: process.env.AZURE_OPENAI_API_KEY,
region: process.env.AZURE_REGION,
},
listeningModel: {
voiceName: 'whisper', // or "en-US"
apiKey: process.env.AZURE_OPENAI_API_KEY,
region: process.env.AZURE_REGION,
},
speaker: 'en-US-JennyNeural', // Default voice
});
export const voiceAgent = new Agent({
name: 'Voice Agent',
instructions: `
# Goal
You are a helpful voice assistant that can help with voice related tasks.
`,
model: azure.languageModel('gpt-5-chat'),
voice: voice,
});