getAdapter (tts/index.ts)

airi · server/apps/api/src/services/adapters/tts/index.ts · typescript · MIT
voice

Resolver for TTS provider adapters by stable ID.

// 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 { TtsAdapter, TtsAdapterId } from './types'

import { createBadRequestError } from '@proj-airi/http-error-shared'

import { azureAdapter } from './azure'
import { dashscopeCosyvoiceAdapter } from './dashscope-cosyvoice'
import { stepfunAdapter } from './stepfun'
import { volcengineAdapter } from './volcengine'

const ADAPTERS: Record<TtsAdapterId, TtsAdapter> = {
  'azure': azureAdapter,
  'dashscope-cosyvoice': dashscopeCosyvoiceAdapter,
  'stepfun': stepfunAdapter,
  'volcengine': volcengineAdapter,
}

/**
 * Resolves a TTS adapter by its stable id.
 *
 * Use when:
 * - The router has loaded a TTS model config slice an

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key