Path: redb-route/redb.Route.Llm/Providers/ITranscriptionProvider.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Llm/Providers/ITranscriptionProvider.cs
----
namespace redb.Route.Llm.Providers;
///
/// Pure transport over a speech-to-text API — turns recorded audio into text. The
/// third sibling of and :
/// implementations do protocol work only (encode the upload, HTTP, decode the
/// answer). Deciding whether a recording is worth transcribing, what to do with an
/// empty result and who pays for it belongs to the route, not here.
///
public interface ITranscriptionProvider
{
/// Provider identifier ("openai", "groq", "local", ...).
string ProviderId { get; }
/// Speech model id this provider was configured with.
string ModelId { get; }
/// Transcribes one recording.
Task TranscribeAsync(TranscriptionRequest request, CancellationToken ct = default);
}
///
/// One recording to transcribe.
///
/// The encoded audio, exactly as it arrived from its transport.
///
/// Name to upload the audio under, e.g. voice.oga. Not cosmetic: speech
/// endpoints pick the demuxer by extension, and an .ogg/opus recording sent as
/// file is a decode error on most servers rather than a transcription.
///
///
/// ISO-639-1 hint ("ru"). Null lets the model detect it — more forgiving on
/// mixed speech, measurably worse on short recordings, where a couple of words in one
/// language are routinely detected as another.
///
///
/// Optional decoding hint, in the model's own words: names and terms it would not
/// otherwise spell right. Hints can also displace what was actually said, so this is
/// deliberately something a caller opts into.
///
public readonly record struct TranscriptionRequest(
ReadOnlyMemory Audio,
string FileName,
string? Language = null,
string? Prompt = null);
///
/// What came back.
///
///
/// The recognised text, trimmed. Empty when the recording holds no speech — silence
/// and music transcribe to nothing, and that is an answer, not a failure.
///
/// Language the provider reports it heard, when it reports one.
///
/// Length of the recording, when the provider reports it. The unit speech APIs bill in,
/// so it is the number to record against a run — but it is optional in the response,
/// which is why a caller that must have it should take it from its own transport instead.
///
public readonly record struct TranscriptionResult(
string Text,
string? Language = null,
double? DurationSeconds = null);