Documentation
¶
Overview ¶
Package providers is the catalogue of model providers this server can be pointed at, and the one place that knows how to build one.
An open implementation of the Realtime API is only as useful as the set of models it can actually run, so the three roles a voice stack needs - recognition, language, and synthesis - are each backed by a named list here rather than by a switch statement in the command. Adding a provider is a table entry plus, when its wire format is genuinely its own, an adapter.
Two things are deliberately separated in every entry. The **endpoint, credential, and wire dialect** are durable facts about a provider: they change on the timescale of API versions. The **default model** is a hint that goes stale the week a vendor ships something new. So a default model is always overridable, `openrealtime providers` prints when the catalogue was last reviewed, and `openrealtime providers -probe` asks the provider itself what it serves rather than trusting this file.
Index ¶
- Constants
- Variables
- func ASRAcceptsLanguage(provider string) bool
- func DescribeASR(request ASRRequest) (v1.Descriptor, error)
- func DescribeLLM(request LLMRequest) (continuation.Descriptor, error)
- func DescribeTTS(request TTSRequest) (v1.Descriptor, error)
- func NewASRFactory(request ASRRequest) (func() (v1.PerceptionProvider, error), error)
- func NewLLM(request LLMRequest) (continuation.Provider, error)
- func NewTTS(request TTSRequest) (v1.StreamingSpeechProvider, error)
- func NewVision(request VisionRequest) (perception.Vision, error)
- type ASR
- type ASRRequest
- type Auth
- type Common
- type DefaultModel
- type Dialect
- type LLM
- type LLMRequest
- type ProbeResult
- type Reason
- type Role
- type TTS
- type TTSRequest
- type UnknownError
- type Upstream
- type UpstreamProbe
- type UpstreamRequest
- type UpstreamSettings
- type Verification
- type VisionRequest
Constants ¶
const Reviewed = "2026-08-22"
Reviewed records when the default models in this catalogue were last checked against the providers' own documentation. It is printed by the listing command so a reader can judge how much to trust a default they did not set.
Variables ¶
var ErrUnknown = errors.New("unknown provider")
ErrUnknown reports a provider name that is not in the catalogue.
Functions ¶
func ASRAcceptsLanguage ¶
ASRAcceptsLanguage reports whether a recogniser forwards a language hint to its service. The default recogniser detects the language itself and refuses one; composers use this to decide whether a shared, role-agnostic language setting should reach recognition at all.
func DescribeASR ¶
func DescribeASR(request ASRRequest) (v1.Descriptor, error)
DescribeASR validates and normalizes through the same constructor path as a live provider, but supplies a non-secret sentinel credential. Provider constructors in this package are resource-free; sockets are opened only by utterance methods. This prevents metadata preflight and live construction from accepting different endpoint, timeout, model, or dialect settings.
func DescribeLLM ¶
func DescribeLLM(request LLMRequest) (continuation.Descriptor, error)
DescribeLLM validates through the exact live constructor with a non-secret sentinel credential. Adapter constructors allocate no network resource, so preflight stays resource-free while sharing all normalization and validation (including dialect-specific effort and sampling rules) with live sessions.
func DescribeTTS ¶
func DescribeTTS(request TTSRequest) (v1.Descriptor, error)
DescribeTTS validates through the exact resource-free live constructor with a non-secret sentinel credential. This makes endpoint, model, voice, sample rate, and timeout acceptance identical in preflight and live sessions.
func NewASRFactory ¶
func NewASRFactory(request ASRRequest) (func() (v1.PerceptionProvider, error), error)
NewASRFactory returns a factory producing one recogniser per utterance.
It is a factory rather than a provider because every recogniser here owns the state of exactly one stream: a WebSocket, a remote session, or an audio buffer. Sharing one across concurrent utterances would interleave them.
func NewLLM ¶
func NewLLM(request LLMRequest) (continuation.Provider, error)
NewLLM builds the configured provider.
Everything a phase decides - authority over tools, authority over speech, whether to reason - is passed in rather than inferred from the catalogue. The catalogue knows how to reach a provider; the arrangement knows what the provider is for, and conflating the two is how a fast provider ends up with tool authority because its vendor happened to support tools.
func NewTTS ¶
func NewTTS(request TTSRequest) (v1.StreamingSpeechProvider, error)
NewTTS builds the configured speech provider.
func NewVision ¶
func NewVision(request VisionRequest) (perception.Vision, error)
NewVision builds the client a video observer narrates through.
It resolves against the language-model catalogue rather than a separate one, because a narrator is a vision-capable chat model and every provider that serves one already has an entry. What it adds is the refusal: a provider whose catalogue entry does not declare vision, or that does not speak Chat Completions, cannot narrate, and saying so here is better than a runtime error on the first frame.
Types ¶
type ASR ¶
type ASR struct {
Common
// Model is the default recognition model.
Model string
// Streaming reports whether the provider emits hypotheses before the
// speaker stops.
//
// It is the single most important property of a recogniser in this
// system, because the stable-partial observation policy has nothing to
// observe without it, and it is a property of the vendor's protocol
// rather than of its accuracy. A batch endpoint listed here still works;
// it just recognises once, at the endpoint of the utterance.
Streaming bool
// Path overrides the transcription route for a batch endpoint.
Path string
// ModelField names the multipart field carrying the model.
ModelField string
// AuthHeader names the header the credential goes in.
AuthHeader string
}
ASR is one recogniser provider.
type ASRRequest ¶
type ASRRequest struct {
Provider string
Model string
BaseURL string
APIKey string
KeyEnv string
Language string
// Keyterms are exact streaming-recognizer vocabulary hints. They are
// currently implemented by Deepgram Nova-3 as repeated keyterm query
// parameters and ignored by no other provider.
Keyterms []string
// PartialInterval asks a batch endpoint for hypotheses this often, by
// re-transcribing the utterance. It is ignored by a streaming provider,
// which produces them for free.
PartialInterval time.Duration
// Endpointing configures a streaming service's own VAD. Batch providers
// ignore it; Deepgram honours it; the local Qwen3-ASR service, whose
// endpoint the engine's own gate decides, refuses it.
Endpointing time.Duration
// EOTThreshold, EagerEOTThreshold and EOTTimeout configure Deepgram Flux's
// model-integrated turn detection: the confidence for EndOfTurn, the
// confidence for EagerEndOfTurn (which also enables TurnResumed), and the
// silence after which a turn ends regardless. Zero leaves the service
// default. Every recogniser other than a Flux model refuses them.
EOTThreshold float64
EagerEOTThreshold float64
EOTTimeout time.Duration
RequestTimeout time.Duration
Header http.Header
}
ASRRequest is one resolved recogniser construction.
type Auth ¶
type Auth string
Auth names how a credential reaches a provider.
const ( // AuthBearer sends Authorization: Bearer. AuthBearer Auth = "bearer" // AuthToken sends Authorization: Token, which Deepgram uses. AuthToken Auth = "token" // AuthAnthropic sends x-api-key with the version header. AuthAnthropic Auth = "anthropic" // AuthXIKey sends xi-api-key, which ElevenLabs uses. AuthXIKey Auth = "xi-api-key" // AuthAPIKeyHeader sends X-API-Key, which Cartesia uses. AuthAPIKeyHeader Auth = "x-api-key" // AuthQuery sends the key as a query parameter, which Gemini's native // endpoint accepts. AuthQuery Auth = "query" // AuthNone is a trusted local endpoint that wants no credential. AuthNone Auth = "none" )
type Common ¶
type Common struct {
// Name is the value a flag takes.
Name string
// Aliases are other spellings that resolve to this entry. They exist
// because a provider's product name and its company name are often
// different, and an operator should not have to know which one this file
// chose.
Aliases []string
// Label is the human name.
Label string
// Dialect selects the adapter.
Dialect Dialect
// BaseURL is the default endpoint. A local provider's is a loopback
// address; a hosted one's is the vendor's.
BaseURL string
// Auth is how the credential is sent.
Auth Auth
// KeyEnv lists environment variables holding the credential, in
// preference order. The first one that is set wins. Several entries carry
// more than one because vendors have renamed their own variable.
KeyEnv []string
// Local marks an endpoint that runs on the operator's own machine, which
// is what makes a missing credential fine rather than an error.
Local bool
// Notes is a one-line caveat printed by the listing command.
Notes string
}
Common is the part of an entry that every role shares.
func (Common) CredentialEnv ¶
CredentialEnv reports the variable a credential should be put in. It is the first of the accepted names, which is the one worth telling an operator about when none of them is set.
type DefaultModel ¶
DefaultModel is one phase's declared model and whether the provider serves it.
type Dialect ¶
type Dialect string
Dialect names the wire contract an adapter speaks.
It is the field that decides which adapter serves an entry, and it is separate from the provider name because most providers speak a dialect someone else defined. That is the whole reason this catalogue can be long: one adapter covers thirty vendors, and the ones with their own protocol get their own adapter rather than a pile of special cases inside a shared one.
const ( // DialectOpenAIChat is /v1/chat/completions with SSE streaming. DialectOpenAIChat Dialect = "openai-chat" // DialectAnthropicMessages is /v1/messages with SSE streaming. DialectAnthropicMessages Dialect = "anthropic-messages" // DialectGemini is generativelanguage :streamGenerateContent. DialectGemini Dialect = "gemini-generate-content" // DialectOpenAIRealtime is the Realtime API over a WebSocket. DialectOpenAIRealtime Dialect = "openai-realtime" // DialectGeminiLive is BidiGenerateContent, which is not a Realtime // dialect and is translated into one. DialectGeminiLive Dialect = "gemini-live" // DialectGPTLive is OpenAI's v1/live/sessions protocol. It shares a vendor // with the Realtime API and not its event contract - it is full duplex and // reports no turn boundaries - so it is translated rather than aliased. DialectGPTLive Dialect = "gpt-live" // DialectOpenAITranscriptions is /v1/audio/transcriptions. DialectOpenAITranscriptions Dialect = "openai-transcriptions" // DialectElevenLabsSTT is ElevenLabs /v1/speech-to-text. DialectElevenLabsSTT Dialect = "elevenlabs-speech-to-text" // DialectDeepgramListen is the Deepgram streaming WebSocket. DialectDeepgramListen Dialect = "deepgram-listen" // DialectQwenASR is the local Qwen3-ASR start/chunk/finish service. DialectQwenASR Dialect = "qwen-asr" // DialectVLLMRealtime is vLLM's /v1/realtime transcription WebSocket, // which streams append-only text deltas from one running generation. DialectVLLMRealtime Dialect = "vllm-realtime" // DialectOpenAISpeech is /v1/audio/speech with a PCM stream. DialectOpenAISpeech Dialect = "openai-speech" // DialectSpeechSocket is openrealtime-incremental-speech/1, the // same-context synthesis WebSocket of the duplex-plan TTS services. DialectSpeechSocket Dialect = "speech-socket" // DialectFishNative is the Fish Speech /v1/tts server. DialectFishNative Dialect = "fish-native" // DialectPCMPost is a POST whose response body is the PCM stream, which // is what Deepgram, ElevenLabs, and Cartesia each do with their own field // names. DialectPCMPost Dialect = "pcm-post" )
type LLM ¶
type LLM struct {
Common
// FastModel and SlowModel are the default identities for the two phases.
//
// They are empty for a marketplace - OpenRouter, Groq, Together,
// SiliconFlow - because a marketplace serves other people's models and
// there is no default that is right for anyone. A provider that serves its
// own models has one, and it is a hint: see Reviewed.
FastModel string
SlowModel string
// Reasoning is the field this endpoint reads the reasoning switch from.
Reasoning openaicompat.ReasoningControl
// EffortNames overrides the portable effort vocabulary.
EffortNames map[continuation.Effort]string
// DisabledEffort is the effort level that means "do not reason".
DisabledEffort string
// MaxTokensField names the output-limit field.
MaxTokensField openaicompat.MaxTokensField
// ReasoningDelta names the streaming field carrying reasoning text.
ReasoningDelta openaicompat.ReasoningDeltaField
// Vision declares that the default models accept images.
Vision bool
// Headers are provider-required request headers.
Headers map[string]string
}
LLM is one language-model provider.
type LLMRequest ¶
type LLMRequest struct {
// Provider is the catalogue name.
Provider string
// Model overrides the catalogue default. It is required for an entry that
// has none.
Model string
// BaseURL overrides the catalogue endpoint.
BaseURL string
// APIKey overrides the environment lookup.
APIKey string
// KeyEnv overrides which environment variable is read. It exists so a
// deployment can run two profiles of one provider on separate keys.
KeyEnv string
Phase trajectory.Phase
Effort continuation.Effort
ToolAuthority continuation.ToolAuthority
SpeechAuthority continuation.SpeechAuthority
Reason Reason
// Vision overrides whether images are sent. Nil takes the catalogue's
// declaration, which is about the default models rather than the one that
// was actually configured.
Vision *bool
// RetainReasoning asks a provider that can return its reasoning to do so.
RetainReasoning bool
// Temperature is an explicit sampling temperature. Nil leaves the
// provider's default intact; a pointer is required because zero is the
// deterministic setting rather than an omitted value.
Temperature *float64
RequestTimeout time.Duration
}
LLMRequest is one resolved provider construction.
type ProbeResult ¶
type ProbeResult struct {
Provider string
Endpoint string
Models []string
// Defaults is what this entry names for each phase, checked against the
// listing above. A default that is not served is the failure this field
// exists to make visible: it is invisible in ordinary use, because the
// voice keeps answering while the background reasoner returns 404 on every
// turn, and it is the one part of the catalogue guaranteed to go stale.
Defaults []DefaultModel
}
ProbeResult is what a provider says it serves, and whether the catalogue's own defaults are among them.
func Probe ¶
func Probe(ctx context.Context, request LLMRequest) (ProbeResult, error)
Probe asks a provider to list its models, and checks this catalogue's own defaults against the answer.
It exists because the default models here are the one part of the catalogue that goes stale, and a reader with a key can get the truth in a second rather than trusting a constant compiled months ago. Checking the defaults is the same argument turned on ourselves: a compatibility claim that is not continuously checked decays, and so does a model name. It is a listing, not a health check: a provider that answers here may still refuse a completion.
func (ProbeResult) Stale ¶
func (result ProbeResult) Stale() []DefaultModel
Stale returns the declared defaults this provider does not serve.
type Reason ¶
type Reason string
Reason is what a phase asks of a provider's reasoning.
const ( // ReasonOff asks the provider not to reason. It is what the voice wants: // the fast phase answers the question that was asked, immediately. ReasonOff Reason = "off" // ReasonOn asks the provider to reason. ReasonOn Reason = "on" // ReasonDefault says nothing, leaving the endpoint's own default. ReasonDefault Reason = "default" )
type TTS ¶
type TTS struct {
Common
// Model is the default synthesis model.
Model string
// Voice is the default voice, where the vendor separates it from the
// model. Empty means the vendor either names the voice in the model or
// requires the deployment to choose one.
Voice string
// VoiceRequired reports that synthesis cannot start without a voice
// identifier, because the vendor puts it in the request path.
VoiceRequired bool
// SampleRates are the output rates the vendor serves. Empty means it will
// serve whatever is asked for.
SampleRates []uint32
}
TTS is one speech provider.
type TTSRequest ¶
type TTSRequest struct {
Provider string
Model string
Voice string
BaseURL string
APIKey string
KeyEnv string
Language string
// OutputSampleRateHz is the rate chunks reach the action plane at. The
// Realtime wire carries 24 kHz, so that is what the server asks for.
OutputSampleRateHz uint32
RequestTimeout time.Duration
Header http.Header
}
TTSRequest is one resolved speech construction.
type UnknownError ¶
UnknownError names the provider that was not found and the role it was looked up for, because "unknown provider" on its own tells an operator nothing about which of four flags they mistyped.
func (*UnknownError) Error ¶
func (err *UnknownError) Error() string
func (*UnknownError) Unwrap ¶
func (err *UnknownError) Unwrap() error
type Upstream ¶
type Upstream struct {
Common
// Model is the default realtime model.
Model string
// ModelQuery names the query parameter carrying the model. Empty selects
// "model"; Azure addresses a deployment instead.
ModelQuery string
// EventAliases renames this endpoint's server events onto the ones the
// mirror reads, which are OpenAI's current spellings.
EventAliases map[string]string
// Handoff is how a completed answer reaches this endpoint's voice.
Handoff upstream.Handoff
// AuthHeader overrides the Authorization: Bearer default.
AuthHeader string
// Verified records how far this entry has been checked against the real
// endpoint, as opposed to against a fake built from its documentation.
Verified Verification
}
Upstream is one remote realtime endpoint the upstream binding can run behind.
This role is deliberately narrower than the others. It lists realtime *model* APIs - an endpoint that owns perception, a voice, and action, and lacks only a second model reasoning alongside it. It does not list agent platforms such as Deepgram's Voice Agent or ElevenLabs Agents: those already run their own agent loop, and putting this binding's reasoner behind one would be two orchestrators arguing over the same conversation rather than a seam.
func LookupUpstream ¶
LookupUpstream resolves a realtime endpoint by name or alias.
type UpstreamProbe ¶
type UpstreamProbe struct {
Provider string
Dialect Dialect
URL string
Model string
// Connected reports that the socket opened and the endpoint accepted the
// credential. It is the first thing that can go wrong and the first thing
// worth reporting separately.
Connected bool
// Events counts each server event the endpoint sent, by name. This is the
// evidence that the catalogue's spellings match reality: an endpoint that
// sends response.audio.delta where the entry expects the current name
// shows up here as an unaliased event.
Events map[string]int
// Spoken is what the endpoint said, if it got that far.
Spoken string
// Failure is why the probe stopped, or empty on success.
Failure string
}
UpstreamProbe is what one realtime endpoint did when actually contacted.
func ProbeUpstream ¶
func ProbeUpstream(ctx context.Context, request UpstreamRequest, patience time.Duration) UpstreamProbe
ProbeUpstream contacts a realtime endpoint for real.
It exists because a fake server built from a vendor's documentation proves only that this code does what the documentation was read to say. It cannot catch a document that is wrong, a spelling that changed, or a field a vendor quietly requires. So the same dial path the binding uses is pointed at the real endpoint and asked for one short turn, and what comes back is reported by name.
type UpstreamRequest ¶
type UpstreamRequest struct {
Provider string
Model string
URL string
APIKey string
KeyEnv string
Header http.Header
}
UpstreamRequest is one resolved realtime-endpoint construction.
type UpstreamSettings ¶
type UpstreamSettings struct {
Dialect Dialect
URL string
Model string
Token string
Header http.Header
EventAliases map[string]string
Handoff upstream.Handoff
// Dial is set for an endpoint whose protocol has to be translated. Nil
// means the endpoint speaks the Realtime protocol itself.
Dial upstream.Dialer
}
UpstreamSettings is what the binding needs to reach an endpoint.
func ResolveUpstream ¶
func ResolveUpstream(request UpstreamRequest) (UpstreamSettings, error)
ResolveUpstream turns a provider name into everything the binding needs.
It returns settings rather than a connection because the binding dials at session start, not at configuration time - a server that could not start until a remote answered would be a server that a remote outage stops from booting.
type Verification ¶
type Verification string
Verification is how much of an entry is known to be true.
It exists because a fake server built from a vendor's documentation proves only that this code does what the documentation was read to say. That is worth having and it is not the same as working. Recording the difference in the table - rather than in a paragraph that rots - keeps the listing honest about which entries have actually been run.
Raising a level requires a credential for that vendor and the probe command; nobody should raise one from reading.
const ( // VerifiedLiveTurn means a real session completed a turn: the endpoint // heard something, answered, and its events arrived under the names this // catalogue expects. VerifiedLiveTurn Verification = "live-turn" // VerifiedReachable means the real endpoint answered on this URL and // evaluated a credential sent this way - so the address and the // authentication are right - but no turn has been run for want of a // working credential. The event names and the hand-off are still only as // good as the documentation. VerifiedReachable Verification = "reachable" // VerifiedDocumented means the entry is built from the vendor's // specification and has been run against a fake, and nothing else. VerifiedDocumented Verification = "documented" )