@devvai/devv-code-backend
Version:
Backend SDK for Devv Code - Provides authentication, data management, email and AI capabilities
56 lines (55 loc) • 2 kB
TypeScript
import type { TextToSpeechOptions, TextToSpeechResponse, SpeechToTextOptions, SpeechToTextResponse } from './types';
/**
* DevvElevenLabs - Complete ElevenLabs API integration
*
* Provides professional Text-to-Speech and Speech-to-Text capabilities
* using ElevenLabs services. API key is handled automatically by the backend.
*
* Features:
* - Text-to-Speech: Convert text to natural-sounding speech
* - Speech-to-Text: Transcribe audio with word-level timestamps
*
* Usage:
* ```typescript
* const elevenlabs = new DevvElevenLabs();
*
* // Text to Speech
* const ttsResult = await elevenlabs.textToSpeech({
* text: "Hello, world!"
* });
*
* // Speech to Text (with URL)
* const sttResult = await elevenlabs.speechToText({
* audio_url: "https://example.com/audio.mp3"
* });
*
* // Speech to Text (with file upload using Devv upload service)
* import { upload } from '@devvai/devv-code-backend';
*
* const audioFile = new File([audioBlob], "recording.mp3");
* const uploadResult = await upload.uploadFile(audioFile);
* if (!upload.isErrorResponse(uploadResult)) {
* const sttResult = await elevenlabs.speechToText({
* audio_url: uploadResult.link
* });
* }
* ```
*
* Note: Authentication required. Make sure you are logged in via auth.verifyOTP()
* For file uploads, use the Devv upload service (upload.uploadFile) to get audio URLs.
* For detailed documentation, see: https://elevenlabs.io/docs
*/
export declare class DevvElevenLabs {
/**
* Convert text to speech using ElevenLabs
* @param options Text-to-speech configuration options
* @returns Audio file URL and metadata
*/
textToSpeech(options: TextToSpeechOptions): Promise<TextToSpeechResponse>;
/**
* Transcribe audio to text using ElevenLabs
* @param options Speech-to-text configuration options
* @returns Transcription with word-level timing information
*/
speechToText(options: SpeechToTextOptions): Promise<SpeechToTextResponse>;
}