Skip to content

OpenAI Audio Provider ​

The OpenAI audio provider contributes audio client families under the openai provider key.

Use it when an agent needs OpenAI speech-to-text, text-to-speech, or realtime audio clients in addition to ordinary chat setup.

Package And Families ​

Reference the OpenAI audio provider package or project. The provider key is:

text
openai

Source-confirmed client families:

FamilyConfig slot
Speech to textClients.SpeechToText
Text to speechClients.TextToSpeech
RealtimeClients.Realtime

The OpenAI chat provider package and OpenAI audio provider package can share the same provider key because provider resolution is family-specific.

Secrets ​

The OpenAI audio provider uses the same common OpenAI aliases:

text
OPENAI_API_KEY
OPENAI_ENDPOINT
OPENAI_BASE_URL

Configuration keys such as openai:ApiKey can also be resolved by the provider secret system.

Text To Speech ​

Configure text-to-speech through Clients.TextToSpeech or the audio runtime attachment options used by your application.

In C# apps, the fluent helper configures the same Clients.TextToSpeech family slot:

csharp
using HPD.Agent;
using HPD.Agent.Audio;
using HPD.Agent.Providers.Audio.OpenAI;
csharp
var assistant = new AgentConfig()
    .WithOpenAITextToSpeech(
        model: "tts-1",
        voice: "nova",
        outputFormat: "mp3",
        configure: options => options.Speed = 1.0f)
    .WithAudioRuntimeAttachment(audio =>
    {
        audio.AssistantOutputSynthesisMode = AssistantOutputSynthesisMode.FinalText;
    });

Source defaults include:

OptionDefault
Modeltts-1
Voicenova
Formatmp3

The provider metadata also lists newer TTS model ids such as tts-1-hd and gpt-4o-mini-tts.

TTS defaults live on the portable TextToSpeechClientConfig family fields:

json
{
  "clients": {
    "textToSpeech": {
      "provider": {
        "key": "openai"
      },
      "modelName": "tts-1",
      "voiceId": "nova",
      "audioFormat": "mp3",
      "speed": 1.0
    }
  }
}

Source-confirmed portable TTS defaults:

OptionUse it for
ModelNameTTS model; defaults to tts-1 when omitted.
VoiceIdDefault voice id; the provider default is nova.
AudioFormatDefault output format.
SpeedSpeech speed.

Speech To Text ​

Configure speech-to-text through Clients.SpeechToText.

In C# apps, use the speech-to-text helper when finite audio input should use OpenAI transcription:

csharp
using HPD.Agent;
using HPD.Agent.Audio;
using HPD.Agent.Providers.Audio.OpenAI;
csharp
var assistant = new AgentConfig()
    .WithOpenAISpeechToText(
        model: "whisper-1",
        configure: options => options.Prompt = "Technical support call");

The helper only selects the speech-to-text client family. The audio runtime attachment still decides when finite audio input is transcribed and how committed transcripts are projected into the turn.

Source defaults include:

OptionDefault
Modelwhisper-1

The provider metadata also lists gpt-4o-transcribe and gpt-4o-mini-transcribe.

Finite audio input uses HPD audio runtime wiring; see Speech To Text Input.

Provider request options use OpenAISttOptions through providerOptions:

json
{
  "clients": {
    "speechToText": {
      "provider": {
        "key": "openai"
      },
      "modelName": "whisper-1",
      "providerOptions": {
        "prompt": "Technical support call",
        "responseFormat": "json"
      }
    }
  }
}

Source-confirmed STT request options:

OptionUse it for
ModelNameSTT model; defaults to whisper-1 when omitted.
promptProvider transcription prompt.
temperatureProvider transcription temperature.
responseFormatProvider response format.
timestampGranularitiesTimestamp granularities.
includeLogprobsInclude log probabilities when supported.
keywordsLiteral vocabulary hints for retained realtime transcription.
realtimeDelayRetained transcription delay.

Realtime ​

OpenAI realtime support is present in source under Clients.Realtime. Source defaults include:

In C# apps, the realtime helper configures the realtime family; the run path still needs realtime transport:

csharp
using HPD.Agent;
using HPD.Agent.Providers.Audio.OpenAI;
csharp
var assistant = new AgentConfig()
    .WithOpenAIRealtime(model: "gpt-realtime");
OptionDefault
Modelgpt-realtime

Use realtime with AgentModelTransportMode.Realtime. The ordinary chat path and finite speech-to-text path are separate from native realtime transport.

Provider-specific realtime options use OpenAIRealtimeConfig through ProviderConfig:

json
{
  "clients": {
    "realtime": {
      "provider": {
        "key": "openai"
      },
      "modelName": "gpt-realtime",
      "providerConfig": {
        "organizationId": "org_...",
        "projectId": "proj_..."
      }
    }
  }
}

Source-confirmed realtime provider configuration:

OptionUse it for
organizationIdOpenAI organization id.
projectIdOpenAI project id.

C# Construction Options ​

The fluent helpers are the shortest path. Manual typed config is still useful when you are dynamically composing family configs or loading part of the setup outside normal builder code:

csharp
using HPD.Agent;
using HPD.Agent.Providers;
using HPD.Agent.Providers.Audio.OpenAI;
csharp
var tts = new TextToSpeechClientConfig
{
    Provider = new HPD.Agent.Providers.ProviderReference { Key = "openai" },
    ModelName = "tts-1",
    VoiceId = "nova",
    AudioFormat = "mp3",
    Speed = 1.0f
};

Live Verification ​

Credentialed text-to-speech can be verified with the live smoke test:

bash
HPD_AUDIO_LIVE_SMOKE=1 OPENAI_API_KEY=... \
dotnet test test/HPD.Agent.Audio.V2.Tests/HPD.Agent.Audio.V2.Tests.csproj \
  --framework net10.0 \
  --filter "FullyQualifiedName~OpenAIAudioProviderTests.LiveTextToSpeech_WithConfiguredApiKey_ReturnsAudio"

Credentialed realtime agent turns can be verified through the public realtime run path:

bash
HPD_REALTIME_LIVE_SMOKE=1 OPENAI_API_KEY=... \
dotnet test test/HPD.Agent.Audio.V2.Tests/HPD.Agent.Audio.V2.Tests.csproj \
  --framework net10.0 \
  --filter "FullyQualifiedName~OpenAIAudioProviderTests.LiveRealtimeAgentTurn_WithConfiguredApiKey_ReturnsText"

Built for production .NET agent applications.