Skip to main content
Glama
t3ase

Mood-Based Music & Quote MCP Server

by t3ase
elevenLabsClient.ts927 B
// src/clients/elevenLabsClient.ts import { config } from "../config/env"; const ELEVEN_BASE_URL = "https://api.elevenlabs.io/v1"; export async function synthesizeTextToSpeech(text: string, voiceId?: string) { const apiKey = config.elevenLabs.apiKey; const vid = voiceId || config.elevenLabs.voiceId; if (!apiKey || !vid) { throw new Error("ElevenLabs API key or voice ID not configured"); } const res = await fetch(`${ELEVEN_BASE_URL}/text-to-speech/${vid}`, { method: "POST", headers: { "xi-api-key": apiKey, "Content-Type": "application/json" }, body: JSON.stringify({ text, model_id: "eleven_multilingual_v2" }) }); if (!res.ok) { throw new Error(`ElevenLabs error: ${res.status} ${res.statusText}`); } const buf = Buffer.from(await res.arrayBuffer()); return buf; } // alias for old code export const synthesizeVoice = synthesizeTextToSpeech;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/t3ase/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server