Speech-to-Text
Transcribe audio files to text using the Speech-to-Text API.
The Speech-to-Text API transcribes audio into text. Use it for voice input, audio content processing, and accessibility features.
IAISpeechToTextService
The primary interface for speech-to-text operations. It follows the same builder pattern as IAIChatService, providing fluent configuration, profile resolution, guardrails, and observability.
public interface IAISpeechToTextService
{
Task<SpeechToTextResponse> TranscribeAsync(
Action<AISpeechToTextBuilder> configure,
Stream audioStream,
CancellationToken cancellationToken = default);
IAsyncEnumerable<SpeechToTextResponseUpdate> StreamTranscriptionAsync(
Action<AISpeechToTextBuilder> configure,
Stream audioStream,
CancellationToken cancellationToken = default);
Task<ISpeechToTextClient> CreateSpeechToTextClientAsync(
Action<AISpeechToTextBuilder> configure,
CancellationToken cancellationToken = default);
}Basic Usage
AISpeechToTextBuilder
All methods accept an Action<AISpeechToTextBuilder> to configure the request:
.WithAlias(string alias)
Required. Sets an alias for auditing and telemetry.
.WithProfile(Guid profileId)
Selects a profile by ID. Uses default if omitted.
.WithProfile(string profileAlias)
Selects a profile by alias.
.WithSpeechToTextOptions(SpeechToTextOptions options)
Overrides profile defaults (language, model).
.WithGuardrails(params Guid[] guardrailIds)
Applies guardrails by ID.
.WithGuardrails(params string[] guardrailAliases)
Applies guardrails by alias.
.WithContextItems(IEnumerable<AIRequestContextItem> contextItems)
Attaches context items to the request.
Streaming Transcription
For real-time transcription, use StreamTranscriptionAsync:
Management API Endpoint
Transcription is available through the Management API:
The endpoint accepts multipart/form-data with the following parameters:
file
file
Yes
Audio file to transcribe
profileIdOrAlias
string
No
Profile ID or alias (uses default if omitted)
language
string
No
Language hint (for example, en, fr, de)
Example Request
Response
The endpoint returns the transcribed text as a string.
Setting Up Speech-to-Text
1. Install a Provider with Speech-to-Text Support
Currently, OpenAI is the only provider with Speech-to-Text support:
2. Create a Connection
Create an OpenAI connection in the backoffice with your API key. See Managing Connections.
3. Create a Profile
Create a profile with the Speech-to-Text capability. Supported models include:
whisper-1
General-purpose transcription
gpt-4o-transcribe
Higher accuracy transcription
gpt-4o-mini-transcribe
Cost-effective transcription
Voice Input in Contextual Copilot and Copilot Workspace
Both Contextual Copilot and Copilot Workspace include a built-in voice input button, since they share the same chat input component. When a Speech-to-Text profile is configured, a microphone button appears in the chat input. Click it to record and transcribe audio into text.
See Contextual Copilot Usage or Copilot Workspace Usage for more details.
Related
Capabilities - Available capability types
OpenAI Provider - Provider with Speech-to-Text support
Contextual Copilot Usage - Voice input in Contextual Copilot
Copilot Workspace Usage - Voice input in Copilot Workspace
Last updated
Was this helpful?