UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

52 lines 2.59 kB
import { qn as SpeechProviderPlugin } from "./types-C0dQmare.js"; //#region src/tts/openai-compatible-speech-provider.d.ts type OpenAiCompatibleSpeechProviderBaseConfig = { apiKey?: string; baseUrl?: string; model: string; voice: string; speed?: number; responseFormat?: string; }; /** Normalized config shape for OpenAI-compatible speech HTTP providers. */ type OpenAiCompatibleSpeechProviderConfig<ExtraConfig extends Record<string, unknown> = Record<string, never>> = OpenAiCompatibleSpeechProviderBaseConfig & ExtraConfig; /** Base URL normalization policy for providers that share OpenAI-style endpoints. */ type OpenAiCompatibleSpeechProviderBaseUrlPolicy = { kind: "trim-trailing-slash"; } | { kind: "canonical"; aliases?: readonly string[]; allowCustom?: boolean; }; /** Extra config field to forward into the JSON body under an optional request key. */ type OpenAiCompatibleSpeechProviderExtraJsonBodyField<ExtraConfig extends Record<string, unknown>> = { configKey: Extract<keyof ExtraConfig, string>; requestKey?: string; }; /** Factory options for a speech provider backed by /audio/speech-compatible HTTP APIs. */ type OpenAiCompatibleSpeechProviderOptions<ExtraConfig extends Record<string, unknown> = Record<string, never>> = { id: string; label: string; autoSelectOrder: number; models: readonly string[]; voices: readonly string[]; defaultModel: string; defaultVoice: string; defaultBaseUrl: string; envKey: string; responseFormats: readonly string[]; defaultResponseFormat: string; voiceCompatibleResponseFormats: readonly string[]; baseUrlPolicy?: OpenAiCompatibleSpeechProviderBaseUrlPolicy; normalizeModel?: (value: string | undefined, fallback: string) => string; configKey?: string; extraHeaders?: Record<string, string>; readExtraConfig?: (raw: Record<string, unknown> | undefined) => ExtraConfig; extraJsonBodyFields?: readonly OpenAiCompatibleSpeechProviderExtraJsonBodyField<ExtraConfig>[]; apiErrorLabel?: string; missingApiKeyError?: string; }; /** Build a complete SpeechProviderPlugin for OpenAI-compatible speech endpoints. */ declare function createOpenAiCompatibleSpeechProvider<ExtraConfig extends Record<string, unknown> = Record<string, never>>(options: OpenAiCompatibleSpeechProviderOptions<ExtraConfig>): SpeechProviderPlugin; //#endregion export { createOpenAiCompatibleSpeechProvider as a, OpenAiCompatibleSpeechProviderOptions as i, OpenAiCompatibleSpeechProviderConfig as n, OpenAiCompatibleSpeechProviderExtraJsonBodyField as r, OpenAiCompatibleSpeechProviderBaseUrlPolicy as t };