Versions in this module Expand all Collapse all v1 v1.2.0 Sep 3, 2026 v1.1.0 Sep 3, 2026 Changes in this version + const ModelQwen3TTSVCRealtimePrev + const ModelQwen3TTSVDRealtimePrev + const ModelQwenAudioRealtimeFlash + const ModelQwenAudioRealtimePlus + func MiniMaxModels() []string + func SupportsVoiceClone(model string) bool + func SupportsVoiceDesign(model string) bool + func VoiceCloneTargetModels() []string + func VoiceDesignTargetModels() []string v1.0.0 Aug 27, 2026 v0 v0.2.0 Aug 27, 2026 Changes in this version + const EmotionAngry + const EmotionCalm + const EmotionDisgusted + const EmotionFearful + const EmotionHappy + const EmotionSad + const EmotionSurprised + const EmotionWhisper + const LanguageAuto + const LanguageChinese + const LanguageEnglish + const LanguageFrench + const LanguageGerman + const LanguageItalian + const LanguageJapanese + const LanguageKorean + const LanguagePortuguese + const LanguageRussian + const LanguageSpanish + const ModelCosyVoiceV1 + const ModelCosyVoiceV2 + const ModelCosyVoiceV35Flash + const ModelCosyVoiceV35Plus + const ModelCosyVoiceV3Flash + const ModelCosyVoiceV3Plus + const ModelMiniMaxSpeech02HD + const ModelMiniMaxSpeech02Turbo + const ModelMiniMaxSpeech28HD + const ModelMiniMaxSpeech28Turbo + const ModelQwen3TTSFlash + const ModelQwen3TTSFlashRealtime + const ModelQwen3TTSInstructFlash + const ModelQwen3TTSInstructFlashRealtime + const ModelQwen3TTSVC + const ModelQwen3TTSVCRealtime + const ModelQwen3TTSVD + const ModelQwen3TTSVDRealtime + const ModelQwenAudioTTSFlash + const ModelQwenAudioTTSPlus + const ModelQwenTTS + const ModelQwenTTSLatest + const ModelQwenTTSRealtime + const ModelSambertZhichu + const ModelSambertZhide + const ModelSambertZhijia + const ModelSambertZhinan + const ModelSambertZhiqi + const ModelSambertZhiru + const SensitiveNone + const SensitivePorn + const SensitiveSevere + const Version + const VoiceAiden + const VoiceAlek + const VoiceAndre + const VoiceArthur + const VoiceBella + const VoiceBellona + const VoiceBodega + const VoiceBunny + const VoiceChelsie + const VoiceCherry + const VoiceDolce + const VoiceDylan + const VoiceEldricSage + const VoiceElias + const VoiceEmilien + const VoiceEric + const VoiceEthan + const VoiceJada + const VoiceJennifer + const VoiceKai + const VoiceKaterina + const VoiceKiki + const VoiceLenn + const VoiceLi + const VoiceLongAnFengYue + const VoiceLongAnHuan + const VoiceLongAnLingXi + const VoiceLongAnLingXin + const VoiceLongAnLuFeng + const VoiceLongAnXiaoXin + const VoiceLongAnYuanFei + const VoiceLongChuanShu + const VoiceLongHuoHuo + const VoiceLongJieLiDou + const VoiceLongPaoPao + const VoiceLoongEva + const VoiceLoongJohn + const VoiceLoongMary + const VoiceMaia + const VoiceMarcus + const VoiceMia + const VoiceMochi + const VoiceMomo + const VoiceMoon + const VoiceNeil + const VoiceNini + const VoiceNofish + const VoiceOnoAnna + const VoicePeter + const VoicePip + const VoiceRadioGol + const VoiceRocky + const VoiceRoy + const VoiceRyan + const VoiceSeren + const VoiceSerena + const VoiceSohee + const VoiceSonrisa + const VoiceStella + const VoiceSunny + const VoiceVincent + const VoiceVivian + var ErrInvalidCredential = errors.New("voicecraftali: credential provider returned an empty credential") + var ErrInvalidParam = errors.New("voicecraftali: invalid parameter") + var ErrNoCredential = errors.New("voicecraftali: no credential configured") + var ErrPoolClosed = errors.New("voicecraftali: pool closed") + var ErrSSMLSingleSend = errors.New("voicecraftali: SSML mode allows only one text submission") + var ErrSessionClosed = errors.New("voicecraftali: session closed") + var ErrSessionFinished = errors.New("voicecraftali: session already finished") + var ErrStreamTruncated = errors.New("voicecraftali: sse stream ended before the completion marker") + var ErrTextTooLong = errors.New("voicecraftali: text exceeds length limit") + var ErrUnknownClient = errors.New("voicecraftali: unknown client name") + var ErrUnsupportedOperation = errors.New("voicecraftali: operation not supported by this protocol") + func CodeDescription(code Code) string + func DataURLMIME(dataURL string) string + func EscapeSSMLText(s string) string + func Retryable(err error) bool + func SupportsSSML(model string) bool + func VoiceStatusDescription(s VoiceStatus) string + type AudioFormat string + const FormatFLAC + const FormatMP3 + const FormatOpus + const FormatPCM + const FormatWAV + type AudioRef struct + Data []byte + ExpiresAt time.Time + ID string + URL string + func (a *AudioRef) Download(ctx context.Context, c *Client) ([]byte, error) + type Client struct + func New(opts ...Option) (*Client, error) + func (c *Client) CloneMiniMaxVoice(ctx context.Context, params *MiniMaxCloneParams) (*MiniMaxCloneResult, error) + func (c *Client) CreateQwenVoice(ctx context.Context, params *CreateQwenVoiceParams) (*QwenVoice, error) + func (c *Client) CreateVoice(ctx context.Context, params *CreateVoiceParams) (string, error) + func (c *Client) DeleteDesignedQwenVoice(ctx context.Context, voice string) error + func (c *Client) DeleteQwenVoice(ctx context.Context, voice string) error + func (c *Client) DeleteVoice(ctx context.Context, voiceID string) error + func (c *Client) DesignQwenVoice(ctx context.Context, params *DesignQwenVoiceParams) (*DesignedQwenVoice, error) + func (c *Client) DesignVoice(ctx context.Context, params *DesignVoiceParams) (*DesignedVoice, error) + func (c *Client) GetDesignedQwenVoice(ctx context.Context, voice string) (*DesignedQwenVoiceDetail, error) + func (c *Client) GetVoice(ctx context.Context, voiceID string) (*VoiceDetail, error) + func (c *Client) ListDesignedQwenVoices(ctx context.Context, params *ListVoicesParams) (*DesignedQwenVoiceList, error) + func (c *Client) ListQwenVoices(ctx context.Context, params *ListVoicesParams) (*QwenVoiceList, error) + func (c *Client) ListVoices(ctx context.Context, params *ListVoicesParams) ([]VoiceSummary, error) + func (c *Client) NewRealtimeSession(ctx context.Context, params *RealtimeParams, opts ...SessionOption) (*Session, error) + func (c *Client) NewSambertSession(ctx context.Context, params *SambertParams, opts ...SessionOption) (*Session, error) + func (c *Client) NewSynthesisSession(ctx context.Context, params *SynthesisParams, opts ...SessionOption) (*Session, error) + func (c *Client) StreamHTTP(ctx context.Context, params *HTTPSynthesisParams, text string, ...) (*SynthesisResult, error) + func (c *Client) StreamMiniMax(ctx context.Context, params *MiniMaxParams, text string, ...) (*MiniMaxResult, error) + func (c *Client) StreamQwenTTS(ctx context.Context, params *QwenTTSParams, text string, ...) (*SynthesisResult, error) + func (c *Client) Synthesize(ctx context.Context, params *SynthesisParams, text string) ([]byte, error) + func (c *Client) SynthesizeHTTP(ctx context.Context, params *HTTPSynthesisParams, text string) (*SynthesisResult, error) + func (c *Client) SynthesizeMiniMax(ctx context.Context, params *MiniMaxParams, text string) (*MiniMaxResult, error) + func (c *Client) SynthesizeQwenTTS(ctx context.Context, params *QwenTTSParams, text string) (*SynthesisResult, error) + func (c *Client) SynthesizeRealtime(ctx context.Context, params *RealtimeParams, text string) ([]byte, error) + func (c *Client) SynthesizeSambert(ctx context.Context, params *SambertParams, text string) ([]byte, error) + func (c *Client) UpdateVoice(ctx context.Context, voiceID, audioURL string) error + type Code string + const CodeAccessDenied + const CodeAccessDeniedSnake + const CodeAccessDeniedUnpurchased + const CodeAllocationQuotaFreeTierOnly + const CodeArrearage + const CodeBadRequestEmptyInput + const CodeBadRequestEmptyModel + const CodeBadRequestEmptyParameters + const CodeBadRequestIllegalInput + const CodeBadRequestResourceNotExist + const CodeBadRequestTooLarge + const CodeBadRequestVoiceNotFound + const CodeClientDisconnect + const CodeCommodityNotPurchased + const CodeConflict + const CodeDataInspectionFailed + const CodeDataInspectionFailedSnake + const CodeEndpointAccessDenied + const CodeInsufficientQuota + const CodeInternalError + const CodeInternalErrorAlgo + const CodeInternalErrorSnake + const CodeInternalErrorTimeout + const CodeInvalidAPIKey + const CodeInvalidAPIKeySnake + const CodeInvalidInputLength + const CodeInvalidParameter + const CodeInvalidParameterDataInspection + const CodeInvalidRequestError + const CodeInvalidValue + const CodeLimitBurstRate + const CodeLimitRequests + const CodeLimitRequestsSnake + const CodeModelAccessDenied + const CodeModelNotFound + const CodeModelNotFoundSnake + const CodeModelNotSupported + const CodeModelServiceFailed + const CodeModelUnavailable + const CodeNotAuthorized + const CodeNotFound + const CodePostpaidBillOverdue + const CodePrepaidBillOverdue + const CodeRequestTimeOut + const CodeResourceExhausted + const CodeResponseTimeout + const CodeServiceUnavailableError + const CodeSystemError + const CodeThrottling + const CodeThrottlingAllocationQuota + const CodeThrottlingBurstRate + const CodeThrottlingConcurrency + const CodeThrottlingRateQuota + const CodeUnsupportedOperation + const CodeWorkspaceAccessDenied + const CodeWorkspaceNotFound + func ErrorCode(err error) Code + type CreateQwenVoiceParams struct + Audio *QwenVoiceAudio + Language string + PreferredName string + TargetModel string + type CreateVoiceParams struct + EnablePreprocess bool + EnableVolumeNormalization *bool + LanguageHints []string + MaxPromptAudioLength float64 + Prefix string + TargetModel string + URL string + type Credential struct + ExpiresAt time.Time + Value string + type CredentialProvider func(ctx context.Context) (Credential, error) + type DesignQwenVoiceParams struct + Language string + PreferredName string + Preview *PreviewOptions + PreviewText string + TargetModel string + VoicePrompt string + type DesignVoiceParams struct + LanguageHints []string + Prefix string + Preview *PreviewOptions + PreviewText string + TargetModel string + VoicePrompt string + type DesignedQwenVoice struct + Preview *PreviewAudio + TargetModel string + Voice string + type DesignedQwenVoiceDetail struct + GmtCreate string + GmtModified string + Language string + TargetModel string + Voice string + type DesignedQwenVoiceList struct + PageIndex int + PageSize int + TotalCount int + Voices []DesignedQwenVoiceSummary + type DesignedQwenVoiceSummary struct + GmtCreate string + GmtModified string + Language string + PreviewText string + TargetModel string + Voice string + VoicePrompt string + type DesignedVoice struct + Preview *PreviewAudio + TargetModel string + VoiceID string + type EventError struct + Code Code + EventID string + Message string + func (e *EventError) Error() string + type HTTPError struct + Code Code + Message string + RequestID string + RetryAfter time.Duration + StatusCode int + func (e *HTTPError) Error() string + type HTTPSynthesisParams struct + AIGCPropagateID string + AIGCPropagator string + BitRate int + EnableAIGCTag bool + EnableMarkdownFilter bool + EnableSSML bool + Format AudioFormat + HotFix *HotFix + Instruction string + LanguageHints []string + Model string + Pitch float64 + Rate float64 + SampleRate int + Seed int + Voice string + Volume *int + WordTimestampEnabled bool + type HandshakeError struct + StatusCode int + URL string + func (e *HandshakeError) Error() string + func (e *HandshakeError) Unwrap() error + type HotFix struct + Pronunciation []map[string]string + Replace []map[string]string + type ListVoicesParams struct + PageIndex int + PageSize int + Prefix string + type MiniMaxAudioSetting struct + Bitrate int + Channel int + ForceCBR bool + Format AudioFormat + SampleRate int + type MiniMaxCloneParams struct + AIGCWatermark bool + AudioURL string + ClonePrompt *MiniMaxClonePrompt + LanguageBoost string + Model string + NeedNoiseReduction bool + NeedVolumeNormalization bool + Text string + VoiceID string + type MiniMaxClonePrompt struct + PromptAudio string + PromptText string + type MiniMaxCloneResult struct + DemoAudioURL string + InputSensitive bool + InputSensitiveType int + RequestID string + Usage *Usage + VoiceID string + type MiniMaxExtraInfo struct + AudioChannel int + AudioFormat string + AudioLength int + AudioSampleRate int + AudioSize int + Bitrate int + UsageCharacters int + WordCount int + type MiniMaxParams struct + AudioSetting MiniMaxAudioSetting + ExcludeAggregatedAudio bool + LanguageBoost string + Model string + PronunciationTone []string + SubtitleEnable bool + TimbreWeights []MiniMaxTimbreWeight + VoiceSetting MiniMaxVoiceSetting + type MiniMaxResult struct + ExtraInfo *MiniMaxExtraInfo + TraceID string + type MiniMaxTimbreWeight struct + VoiceID string + Weight int + type MiniMaxVoiceSetting struct + Emotion string + LatexRead bool + Pitch *int + Speed float64 + TextNormalization bool + VoiceID string + Vol float64 + type Option func(*config) error + func WithAPIKey(key string) Option + func WithAudioBuffer(frames int) Option + func WithBaseURL(raw string) Option + func WithCredentialProvider(p CredentialProvider) Option + func WithCredentialRefresh(skew, timeout time.Duration) Option + func WithDataInspection() Option + func WithDedicatedEndpoint() Option + func WithHTTPClient(hc *http.Client) Option + func WithHandshakeTimeout(d time.Duration) Option + func WithReadIdleTimeout(d time.Duration) Option + func WithRegion(r Region) Option + func WithUserAgent(ua string) Option + func WithWorkspaceID(id string) Option + func WithWriteTimeout(d time.Duration) Option + type Phoneme struct + BeginTime int + EndTime int + Text string + Tone int + type Pool struct + func NewPool(client *Client, opts ...PoolOption) *Pool + func (p *Pool) Close() error + func (p *Pool) IdleCount() int + func (p *Pool) NewSynthesisSession(ctx context.Context, params *SynthesisParams, opts ...SessionOption) (*Session, error) + type PoolOption func(*Pool) + func WithPoolIdleTimeout(d time.Duration) PoolOption + func WithPoolMaxIdle(n int) PoolOption + type PreviewAudio struct + Data []byte + Format AudioFormat + SampleRate int + type PreviewOptions struct + ResponseFormat AudioFormat + SampleRate int + type Progress struct + OriginalText string + Sentence *Sentence + Type string + type Protocol string + const ProtocolRealtime + const ProtocolSambert + const ProtocolSynthesis + type QwenTTSParams struct + Instructions string + LanguageType string + Model string + OptimizeInstructions bool + Voice string + type QwenVoice struct + FallbackMode bool + FallbackReason string + TargetModel string + Voice string + type QwenVoiceAudio struct + Data []byte + MIME string + type QwenVoiceList struct + PageIndex int + PageSize int + TotalCount int + Voices []QwenVoiceSummary + type QwenVoiceSummary struct + GmtCreate string + GmtModified string + Language string + TargetModel string + Voice string + type RealtimeMode string + const ModeCommit + const ModeServerCommit + type RealtimeParams struct + BitRate int + Instructions string + LanguageType string + Mode RealtimeMode + Model string + OptimizeInstructions bool + PitchRate float64 + ResponseFormat AudioFormat + SampleRate int + SpeechRate float64 + Voice string + Volume *int + type Region string + const RegionBeijing + const RegionSingapore + type Registry struct + func NewRegistry(shared []Option, entries ...RegistryEntry) (*Registry, error) + func (r *Registry) Client(name string) (*Client, error) + func (r *Registry) Names() []string + type RegistryEntry struct + Name string + Options []Option + type SambertParams struct + Format AudioFormat + Model string + PhonemeTimestampEnabled bool + Pitch float64 + Rate float64 + SampleRate int + Text string + Volume *int + WordTimestampEnabled bool + type Sentence struct + BeginTime int + EndTime int + Index int + Words []Word + type Session struct + func (s *Session) Cancel(ctx context.Context) error + func (s *Session) CancelResponse(ctx context.Context) error + func (s *Session) Close() error + func (s *Session) Commit(ctx context.Context) error + func (s *Session) Finish(ctx context.Context) error + func (s *Session) Flush(ctx context.Context) error + func (s *Session) ID() string + func (s *Session) Protocol() Protocol + func (s *Session) Read() ([]byte, error) + func (s *Session) ReadContext(ctx context.Context) ([]byte, error) + func (s *Session) SendText(ctx context.Context, text string) error + func (s *Session) Stream(ctx context.Context, handler func(audio []byte) error) error + func (s *Session) Usage() *Usage + type SessionOption func(*sessionConfig) + func WithProgress(fn func(Progress)) SessionOption + type SynthesisParams struct + AIGCPropagateID string + AIGCPropagator string + BitRate int + EnableAIGCTag bool + EnableMarkdownFilter bool + EnableSSML bool + Format AudioFormat + HotFix *HotFix + Instruction string + LanguageHints []string + Model string + Pitch float64 + Rate float64 + SampleRate int + Seed int + Voice string + Volume *int + WordTimestampEnabled bool + type SynthesisResult struct + Audio AudioRef + RequestID string + Usage *Usage + type TaskFailedError struct + Code Code + Message string + TaskID string + func (e *TaskFailedError) Error() string + type Usage struct + Characters int + InputTokens int + OutputTokens int + TotalTokens int + type ValidationError struct + Field string + Reason string + func (e *ValidationError) Error() string + func (e *ValidationError) Is(target error) bool + type VoiceDetail struct + GmtCreate string + GmtModified string + PreviewText string + ResourceLink string + Status VoiceStatus + TargetModel string + VoicePrompt string + func (v *VoiceDetail) Designed() bool + type VoiceStatus string + const VoiceStatusDeploying + const VoiceStatusOK + const VoiceStatusUndeployed + func (s VoiceStatus) Usable() bool + type VoiceSummary struct + GmtCreate string + GmtModified string + PreviewText string + Status VoiceStatus + VoiceID string + VoicePrompt string + func (v *VoiceSummary) Designed() bool + type Word struct + BeginIndex int + BeginTime int + EndIndex int + EndTime int + Phonemes []Phoneme + Text string