export type PublicIdentity = {id: string, display_name?: string | undefined, email?: string | undefined, metadata?: Array<{[key: string]: unknown}> | undefined, logo_url?: string | undefined, tags?: Array | undefined}; export type PublicContact = {id: string, display_name?: string | undefined, email?: string | undefined, metadata?: Array<{[key: string]: unknown}> | undefined, logo_url?: string | undefined, tags?: Array | undefined}; export type CreateApiV2RouterAudioSpeechArgs = {body: {input: string, model: string, voice: string, response_format?: ('mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm') | undefined, speed?: number | undefined, name?: string | undefined, fallback_on_codes?: Array | undefined, fallbacks?: Array<{model: string}> | undefined, retry?: ({count?: number | undefined, on_codes?: Array | undefined}) | undefined, load_balancer?: ({type: 'weight_based', models: Array<{model: string, weight?: number | undefined}>}) | undefined, timeout?: {call_timeout: number} | undefined, orq?: ({retry?: ({count?: number | undefined, on_codes?: Array | undefined}) | undefined, fallbacks?: Array<{model: string}> | undefined, fallback_on_codes?: Array | undefined, name?: string | undefined, identity?: PublicIdentity | undefined, contact?: PublicContact | undefined, thread?: ({id: string, tags?: Array | undefined}) | undefined, load_balancer?: ({type: 'weight_based', models: Array<{model: string, weight?: number | undefined}>}) | undefined, timeout?: {call_timeout: number} | undefined}) | undefined}}; export type CreateApiV2RouterAudioSpeechOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create speech * * POST /v2/router/audio/speech */ export const createApiV2RouterAudioSpeech = async (args: CreateApiV2RouterAudioSpeechArgs, options?: CreateApiV2RouterAudioSpeechOptions) => { const {baseUrl = "https://my.orq.ai", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/router/audio/speech${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };