TTS adapter for Alibaba DashScope Cosyvoice, sending requests and retrieving voice catalog via UnSpeech.
// 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 { TtsAdapter, TtsAdapterContext, TtsInput, TtsResult, TtsVoiceCatalogContext } from './types'
import { createBadRequestError } from '@proj-airi/http-error-shared'
import { audioMimeFromFormat } from './audio-format'
import { listVoicesViaUnSpeech, sendSpeechViaUnSpeech } from './unspeech'
/**
* Default cosyvoice audio format. Mirrors the OpenAI `mp3` default expected by
* downstream consumers.
*/
const DEFAULT_COSYVOICE_FORMAT = 'mp3'
/**
* Default cosyvoice model id. v1 was dropped from the official "REST-supported
* models" list (the official list now starts at v2 and run
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key