Skip to main content
Azure AI Speech hero Openlayer integrates with Azure AI Speech, Microsoft’s service for speech-to-text, speech translation, and text-to-speech. Each recognition, translation, or synthesis call made with the Azure Speech SDK becomes a step in your Openlayer trace, with the recognized text or synthesized-audio statistics, latency, the result reason, and failure details. You can optionally attach the audio itself.
Trace Azure AI Speech on your server only. Keep your Azure Speech key and your Openlayer API key in server-side configuration and out of browser or mobile code. For browser apps, issue short-lived Speech tokens from your backend and use SpeechConfig.fromAuthorizationToken in the browser.

Monitoring Azure AI Speech

To use monitoring mode, instrument your code to publish the Speech calls your AI system makes to the Openlayer platform.

Installation

Install Openlayer and the Azure Speech SDK:
Azure AI Speech tracing requires openlayer>=0.34.0 in Python and openlayer>=0.32.0 in TypeScript. In TypeScript, the Azure Speech SDK is an optional peer dependency, so installing openlayer alone does not add it.
Set your credentials and inference pipeline in the environment:

Trace Speech calls

In Python, init() instruments every SpeechRecognizer, TranslationRecognizer, and SpeechSynthesizer created afterwards. To trace a single client instead, pass it to trace_azure_speech(client) from openlayer.lib. In TypeScript, wrap each client with traceAzureSpeech(). If your resource uses a custom endpoint (for example, an Azure AI Services *.cognitiveservices.azure.com domain), create the configuration with SpeechConfig(subscription=..., endpoint=...) in Python or SpeechConfig.fromEndpoint(new URL(endpoint), key) in TypeScript. Tracing works the same way.

Trace a full voice turn

Wrap the function that handles a conversational turn so recognition and synthesis appear as steps of the same trace:

See full Python example

See full TypeScript example

Attach audio to traces

Audio is not sent to Openlayer by default. When you enable attachment uploads, synthesized audio is attached to each synthesis step automatically. For recognition, pass the audio you are transcribing explicitly, because the Speech SDK’s AudioConfig does not expose its source:
The audio is uploaded to Openlayer storage when the trace completes and appears as an audio player on the step: recognition audio under Inputs, synthesized audio under Output. A file path is read as bytes, so your local path is never recorded. Synthesized audio is labeled by its actual encoding. MP3, Ogg, WebM, and WAV output keep their format. Headerless PCM, µ-law, and A-law output (the raw-* formats) is wrapped in a WAV container so it can be played. Formats without a playable container, such as raw Opus frames, are attached as files that you can download.
Uploading audio sends that data to Openlayer. Enable it only when your privacy and security requirements allow it. See Trace multimodal data for how attachments are stored and displayed.

Data captured

Speech calls appear on the Data page of your Openlayer data source as steps named Azure Speech Recognition, Azure Speech Translation, or Azure Speech Synthesis, with the Azure_Speech provider. Azure reports most failures as canceled results rather than errors, so failed calls are traced too, with the cancellation reason, error code, and error details. Your Azure subscription key and authorization token are never recorded. Openlayer reads only an allowlist of non-secret settings, and it redacts credentials from error details: the Speech SDK can include your endpoint URL, with any token in its query string, in connection errors. Speech steps report 0 tokens, so their cost shows as $0.

Supported calls

Continuous recognition, streaming synthesis requests, and batch transcription are not traced.

Troubleshooting

In Python, call init() before creating your Speech clients, or pass each client to trace_azure_speech(). In TypeScript, wrap every recognizer and synthesizer with traceAzureSpeech(). Also check that OPENLAYER_API_KEY and OPENLAYER_INFERENCE_PIPELINE_ID are set.
Wrap the function that makes both calls with @trace() in Python or trace() in TypeScript. In TypeScript, await each Speech call inside that function so its step is recorded under the right parent.
Enable attachment uploads (attachment_upload_enabled=True in Python, attachmentUploadEnabled: true in TypeScript) before the trace is created. Recognition steps also need the audio passed explicitly, as openlayer_audio in Python or inputAudio in TypeScript.
Install microsoft-cognitiveservices-speech-sdk. It is an optional peer dependency, so installing openlayer alone does not add it to your application.
This is expected. Azure returns canceled and NoMatch outcomes as results, and Openlayer traces them so you can investigate the reason and latency.