Sends TTS requests via Unspeech SDK, handling errors and returning audio payload.
// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
import type { Voice } from 'unspeech'
import type { TtsAdapterContext, TtsResult, TtsVoiceCatalogContext } from './types'
import { errorMessageFrom } from '@moeru/std'
import { createBadGatewayError, createInternalError } from '@proj-airi/http-error-shared'
import { generateSpeechResponse, listVoices, UnSpeechAPIError } from 'unspeech'
import { TtsUpstreamResponseError } from './types'
interface SendSpeechOptions {
ctx: TtsAdapterContext
model: string
input: string
voice: string
speed?: number
responseFormat: string
extraBody?: Record<string, unknown>
fallbackContentType: string
providerLabel: string
}
/**
*
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key