Skip to content

OmniVoice API Reference

The omnivoice subpackage provides STT and TTS provider adapters.

STT Provider

NewSTTProvider

Creates a new STT provider with the given API key.

func NewSTTProvider(apiKey string) *STTProvider

NewSTTProviderFromEnv

Creates a new STT provider using OPENAI_API_KEY.

func NewSTTProviderFromEnv() (*STTProvider, error)

NewSTTProviderFromClient

Creates a provider from an existing OpenAI client.

func NewSTTProviderFromClient(client *Client) *STTProvider

Methods

Name

func (p *STTProvider) Name() string // Returns "openai"

Transcribe

func (p *STTProvider) Transcribe(ctx context.Context, audio []byte, config stt.TranscriptionConfig) (*stt.TranscriptionResult, error)

TranscribeFile

func (p *STTProvider) TranscribeFile(ctx context.Context, filePath string, config stt.TranscriptionConfig) (*stt.TranscriptionResult, error)

TranscribeURL

Returns ErrURLTranscriptionNotSupported (OpenAI doesn't support URL transcription).

func (p *STTProvider) TranscribeURL(ctx context.Context, url string, config stt.TranscriptionConfig) (*stt.TranscriptionResult, error)

TTS Provider

NewTTSProvider

Creates a new TTS provider with the given API key.

func NewTTSProvider(apiKey string) *TTSProvider

NewTTSProviderFromEnv

Creates a new TTS provider using OPENAI_API_KEY.

func NewTTSProviderFromEnv() (*TTSProvider, error)

NewTTSProviderFromClient

Creates a provider from an existing OpenAI client.

func NewTTSProviderFromClient(client *Client) *TTSProvider

Methods

Name

func (p *TTSProvider) Name() string // Returns "openai"

ListVoices

func (p *TTSProvider) ListVoices(ctx context.Context) ([]tts.Voice, error)

GetVoice

func (p *TTSProvider) GetVoice(ctx context.Context, voiceID string) (*tts.Voice, error)

Synthesize

func (p *TTSProvider) Synthesize(ctx context.Context, text string, config tts.SynthesisConfig) (*tts.SynthesisResult, error)

SynthesizeStream

func (p *TTSProvider) SynthesizeStream(ctx context.Context, text string, config tts.SynthesisConfig) (<-chan tts.StreamChunk, error)

Constants

Voice Constants

const (
    VoiceAlloy   = "alloy"
    VoiceAsh     = "ash"
    VoiceBallad  = "ballad"
    VoiceCoral   = "coral"
    VoiceEcho    = "echo"
    VoiceFable   = "fable"
    VoiceOnyx    = "onyx"
    VoiceNova    = "nova"
    VoiceSage    = "sage"
    VoiceShimmer = "shimmer"
    VoiceVerse   = "verse"
    VoiceMarin   = "marin"
    VoiceCedar   = "cedar"
)

Model Constants

const (
    ModelTTS1   = "tts-1"
    ModelTTS1HD = "tts-1-hd"
)

Errors

var ErrURLTranscriptionNotSupported = errors.New("openai: URL transcription not supported")