OpenAI TTS Adapter (tts/openai.ts)

Patter · libraries/typescript/src/tts/openai.ts · typescript · MIT
ai, voice, lang:typescript, tag:ai-voice

A TypeScript wrapper for the OpenAI Text-to-Speech API. Use it to integrate high-quality voice generation into AI pipelines with support for custom voices and speed multipliers.

// Source: https://github.com/PatterAI/Patter | License: MIT | Copyright 2026 Patter Contributors
// Provided via justclaw.it.com; keep this notice with the code.
/** OpenAI TTS for Patter pipeline mode. */
import { OpenAITTS as _OpenAITTS } from "../providers/openai-tts";

/** Constructor options for the OpenAI `TTS` adapter. */
export interface OpenAITTSOptions {
  /** API key. Falls back to OPENAI_API_KEY env var when omitted. */
  apiKey?: string;
  voice?: string;
  model?: string;
  /** Voice-direction prompt (only honoured for gpt-4o-mini-tts and newer). */
  instructions?: string;
  /** Speech speed multiplier, must be in [0.25, 4.0] when set. */
  speed?: number;
  /**
   * Enable anti-aliasing LPF ahead of the 3:2 decimation. Defaults to
   * ``true`` (matches the provider defaul

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

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

Get a free API key