Documentation
¶
Overview ¶
Package openrouter adapts OpenRouter's JSON speech-to-text endpoint (https://openrouter.ai/api/v1/audio/transcriptions) to stt.STTProvider. OpenRouter is a routing gateway in front of vendor models; audio is sent base64-encoded. It needs an OpenRouter API key and public https egress.
Stability: Beta — API-checked; may change with a changelog callout.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶ added in v0.74.0
type Options struct {
// APIKey is the OpenRouter API key.
APIKey string
// Model is the OpenRouter model id. Empty selects the provider default.
Model string
}
Options configures New.
type Provider ¶
type Provider struct {
BaseURL string
APIKey string
Model string
Validation netsec.ValidationOptions
// contains filtered or unexported fields
}
Provider implements OpenRouter's JSON speech-to-text endpoint. OpenRouter is a cloud gateway, not a direct model provider, and its STT API accepts base64 audio rather than OpenAI's multipart Whisper shape.
func (*Provider) Capabilities ¶ added in v0.64.3
func (*Provider) Capabilities() []speechkit.Capability
Capabilities reports the speech-to-text baseline every provider satisfies.
func (*Provider) Health ¶ added in v0.64.3
Health issues an authenticated GET /models; a transport failure or non-200 status is returned as the error.
func (*Provider) Transcribe ¶ added in v0.64.3
func (p *Provider) Transcribe(ctx context.Context, audio []byte, opts stt.TranscribeOpts) (*stt.Result, error)
Transcribe implements stt.STTProvider: the audio is wrapped as WAV, base64-encoded and posted as JSON with opts.Model, else the configured Model. The response carries no language, so the result Language echoes the requested locale or "multi".