OpenAISpeechToTextClient sends Ogg MemoryStream audio with an .mp3 filename
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start with src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAISpeechToTextClient.cs, especially DetectAudioExtension and the filename resolution shared by ordinary and streaming transcription. Add focused coverage for Ogg/Opus and Ogg/Vorbis memory streams, checking that uploaded bytes remain unchanged and the multipart filename uses an Ogg extension. Done when both transcription paths label Ogg input correctly without changing its bytes or stream position.
Written by the indexing model from the issue text.
Description
Description
OpenAISpeechToTextClient misidentifies an Ogg/Opus MemoryStream as MP3, sending its unchanged Ogg bytes with the multipart filename audio.mp3. This affects in-memory voice recordings, for example Telegram voice notes.
The issue exists in Microsoft.Extensions.AI.OpenAI 10.11.0 (repository commit 25f07afa51034e37b334210642d7dc5f191c142d) and is also visible in the current main source inspected on 2026-10-30. DetectAudioExtension recognizes WAV, WebM, MP4/M4A and MP3, but not the Ogg OggS signature; the default is mp3.
Reproduction Steps
Use a valid Ogg/Opus recording and the normal SDK adapter:
#pragma warning disable MEAI001
using Microsoft.Extensions.AI;
using OpenAI.Audio;
// audioClient is a configured official OpenAI or Azure OpenAI AudioClient.
using ISpeechToTextClient speech = audioClient.AsISpeechToTextClient();
using var audio = new MemoryStream(await File.ReadAllBytesAsync("voice.ogg"));
await speech.GetTextAsync(audio);
Inspect the multipart file part at a local test transcription endpoint: the filename is audio.mp3, while the bytes start with OggS and still contain the original Ogg recording. The same issue applies to GetStreamingTextAsync, which calls the same filename resolver.
The adapter offers no filename option on SpeechToTextOptions; its raw-options callback only controls AudioTranscriptionOptions/AudioTranslationOptions, not the filename passed separately to AudioClient.
Expected behavior
Ogg input is labeled with an Ogg extension, with no byte conversion or stream-position change. Preferably applications can explicitly supply a filename instead of depending exclusively on sniffing, including for non-seekable streams. The official SDK already supports this with AudioClient.TranscribeAudioAsync(stream, fileName, options, cancellationToken).
Actual behavior
The multipart filename is audio.mp3. We observed an Azure OpenAI transcription rejection with HTTP 400, invalid_request_error, parameter file, and the message Audio file might be corrupted or unsupported in an affected in-memory voice-ingestion path. This report identifies the incorrect filename independently of any provider's decoding behavior; it does not claim every provider rejects every mismatched upload.
Regression?
Not bisected against older package versions.
Known Workarounds
Call the official SDK overload with an explicit filename. A FileStream also retains its filename, but requiring local temporary files is unsuitable for existing in-memory/private-storage pipelines.
Configuration
- .NET 10.
Microsoft.Extensions.AI.OpenAI10.11.0.- Official OpenAI / Azure OpenAI audio client.
- The filename-detection branch is platform-independent.
Other information
Affected source: OpenAISpeechToTextClient.cs.
Suggested focused upstream coverage: valid Ogg/Opus and Ogg/Vorbis memory streams, unchanged uploaded bytes/stream position, and both ordinary and streaming transcription filename resolution.
- Dominant language
- C#
- Stars
- 3.3k
- Forks
- 919
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 35
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/extensions
-
area-ai untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/extensions#7956 ·
Maintainers usually reply within 1 day
-
area-ai bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/extensions#7954 ·
Maintainers usually reply within 1 day
-
ServiceEndpointWatcher logs normal cancellation as an errorPossibly taken @seragAhmed claimed this 5 days ago. Openbug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
dotnet/extensions#7940 · 1 comment ·
Maintainers usually reply within 1 day
-
Unable to obtain the UsageContent and FinishReason of response.incompletePossibly taken @jaeminbird claimed this 20 days ago. Openarea-ai bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
dotnet/extensions#7893 ·
Maintainers usually reply within 1 day
-
AI Chat Web template: scaffolded Identity pages are inaccessible because App.razor applies an interactive render mode unconditionallyPossibly taken @valkiara claimed this 20 days ago. Openarea-ai-templates untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
dotnet/extensions#7889 · 1 comment ·
Maintainers usually reply within 1 day
All issues in dotnet/extensions
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area/backend type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
umbraco/Umbraco-CMS#24668 · 1 comment ·
Maintainers usually reply within 1 day
-
Pri3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
MicrosoftDocs/windows-dev-docs#6205 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day