Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.60db.ai/llms.txt

Use this file to discover all available pages before exploring further.

Installation

npm install 60db

Initialization

import { SixtyDBClient } from "60db";

// Simple initialization
const client = new SixtyDBClient("your-api-key");

Text-to-Speech

Basic TTS

const audio = await client.textToSpeech({
  text: 'Hello, world!',
  voice_id: 'default-voice',
  enhance: true,
  speed: 1.0,
  language:"en-us"
});

### Get all voices
const voices = await client.getVoices();

### Get all lanuages
const lanuages = await client.getLanguages();

### audio is an ArrayBuffer containing the audio data

Speech-to-Text

Transcribe Audio

const file = document.querySelector('input[type="file"]').files[0];

const result = await client.speechToText(file, {
  language: "en",
});

console.log(result.text);

With Context Refinement

Supply a context string to enable server-side LLM polishing — proper nouns, filler removal, and punctuation are cleaned on the response text:
const result = await client.speechToText(file, {
  language: "hi",
  diarize: true,
  context:
    "Cricket coaching session. Players: Arjun Mehta, Ishaan Verma. Discussing batting technique.",
});
Omit context entirely to skip refinement. Note: this is the REST shape — the WebSocket streaming endpoint takes a {general, text, terms} object instead.

Get Supported Languages

const languages = await client.getLanguages();
console.log(languages);

Voice Management

List All Voices

const voices = await client.getVoices();
voices.forEach((voice) => {
  console.log(`${voice.name} (${voice.id})`);
});

Get Specific Voice

const voice = await client.getVoice("voice-id");
console.log(voice);

Create Custom Voice

const files = [file1, file2, file3]; // File objects

const newVoice = await client.createVoice({
  name: "My Custom Voice",
  files: files,
  description: "A custom voice for my brand",
});

console.log("Created voice:", newVoice.id);

Update Voice

await client.updateVoice("voice-id", {
  name: "Updated Voice Name",
  description: "Updated description",
});

Delete Voice

await client.deleteVoice("voice-id");

Authentication

Sign Up

const user = await client.signUp({
  email: "[email protected]",
  password: "secure-password",
  name: "John Doe",
});

Sign In

const session = await client.signIn({
  email: "[email protected]",
  password: "secure-password",
});

console.log("Token:", session.token);

Get Profile

const profile = await client.getProfile();
console.log(profile);

Update Profile

await client.updateProfile({
  name: "Jane Doe",
  company: "Acme Inc",
});

Workspace Management

List Workspaces

const workspaces = await client.getWorkspaces();

Create Workspace

const workspace = await client.createWorkspace({
  name: "My Workspace",
  description: "Team workspace",
});

Billing

Get Available Plans

const plans = await client.getPlans();
plans.forEach((plan) => {
  console.log(`${plan.name}: $${plan.price}/month`);
});

Get Current Plan

const currentPlan = await client.getCurrentPlan();
console.log("Current plan:", currentPlan.name);

Subscribe to Plan

await client.subscribe("plan-id");

Analytics

Get Usage Statistics

const usage = await client.getUsage();
console.log("Characters used:", usage.characters);
console.log("API calls:", usage.api_calls);

API Key Management

List API Keys

const apiKeys = await client.getApiKeys();

Create API Key

const newKey = await client.createApiKey("Production Key");
console.log("New API key:", newKey.key);

Delete API Key

await client.deleteApiKey("key-id");

Webhooks

List Webhooks

const webhooks = await client.getWebhooks();

Create Webhook

const webhook = await client.createWebhook({
  url: "https://example.com/webhook",
  events: ["tts.completed", "stt.completed"],
});

Delete Webhook

await client.deleteWebhook("webhook-id");

Error Handling

try {
  const audio = await client.textToSpeech({
    text: "Hello, world!",
    voice_id: "invalid-voice",
  });
} catch (error) {
  if (error.response) {
    // API error
    console.error("API Error:", error.response.status);
    console.error("Message:", error.response.data.message);
  } else {
    // Network or other error
    console.error("Error:", error.message);
  }
}

TypeScript Types

The SDK includes full TypeScript type definitions:
import { SixtyDBClient, SixtyDBConfig, TTSResponse } from "60db";