python typescript javascript

Cleanvoice AI SDKs

Official SDKs for integrating Cleanvoice AI into your applications. Choose your preferred language:

Need more control? Our SDKs wrap the REST API - refer to the API docs for detailed parameter descriptions and advanced configuration options.

Python SDK

Installation {#python-installation}

pip install cleanvoice-sdk

Quick Start

from cleanvoice import CleanvoiceClient

# Initialize client
client = CleanvoiceClient(api_key="your-api-key")

# Upload and process audio
result = client.process_audio("path/to/audio.wav")
print(f"Job ID: {result.job_id}")

# Check status
status = client.get_job_status(result.job_id)
print(f"Status: {status}")

Authentication

# Option 1: Pass API key directly
client = CleanvoiceClient(api_key="your-api-key")

# Option 2: Use environment variable
# Set CLEANVOICE_API_KEY in your environment
client = CleanvoiceClient()

Get your API key: Visit app.cleanvoice.ai to generate your API key.

Processing Audio

Basic Processing

# Process with default settings
result = client.process_audio("audio.wav")

Advanced Processing

# Custom processing options
result = client.process_audio(
    file_path="audio.wav",
    remove_filler_words=True,
    remove_silence=True,
    enhance_speech=True,
    studio_sound="nightly",  # Recommended: "nightly", deprecated: True
    language="en"  # Auto-detect if not specified
)

📖 Full Options Reference: See API Processing Options for all available parameters and their descriptions.

Batch Processing

# Process multiple files
files = ["file1.wav", "file2.mp3", "file3.m4a"]
results = client.process_batch(files)

for result in results:
    print(f"Job {result.job_id}: {result.status}")

Job Management

Check Job Status

# Get current status
status = client.get_job_status(job_id)
print(f"Status: {status.status}")  # processing, completed, failed

# Wait for completion
final_status = client.wait_for_completion(job_id, timeout=300)

Get Results

# Download processed audio
audio_data = client.download_audio(job_id)
with open("processed_audio.wav", "wb") as f:
    f.write(audio_data)

# Get processing metadata
metadata = client.get_job_metadata(job_id)
print(f"Original duration: {metadata.original_duration}s")
print(f"Processed duration: {metadata.processed_duration}s")

Error Handling

from cleanvoice import CleanvoiceError, QuotaExceededError

try:
    result = client.process_audio("audio.wav")
except QuotaExceededError:
    print("Monthly quota exceeded")
except CleanvoiceError as e:
    print(f"API error: {e.message}")

🔍 Error Details: See API Error Codes for complete error reference.


Node.js SDK

Installation {#nodejs-installation}

npm install @cleanvoice/cleanvoice-sdk

Quick Start

import { CleanvoiceClient } from '@cleanvoice/cleanvoice-sdk';

// Initialize client
const client = new CleanvoiceClient({ apiKey: 'your-api-key' });

// Process audio
const result = await client.processAudio('path/to/audio.wav');
console.log(`Job ID: ${result.jobId}`);

// Check status
const status = await client.getJobStatus(result.jobId);
console.log(`Status: ${status}`);

Authentication

// Option 1: Pass API key directly
const client = new CleanvoiceClient({ 
  apiKey: 'your-api-key' 
});

// Option 2: Use environment variable
// Set CLEANVOICE_API_KEY in your environment
const client = new CleanvoiceClient();

Processing Audio

Basic Processing

// Process with default settings
const result = await client.processAudio('audio.wav');

Advanced Processing

// Custom processing options
const result = await client.processAudio('audio.wav', {
  removeFillerWords: true,
  removeSilence: true,
  enhanceSpeech: true,
  studioSound: 'nightly',  // Recommended: 'nightly', deprecated: true
  language: 'en'  // Auto-detect if not specified
});

📖 Full Options Reference: See API Processing Options for all available parameters and their descriptions.

Batch Processing

// Process multiple files
const files = ['file1.wav', 'file2.mp3', 'file3.m4a'];
const results = await client.processBatch(files);

results.forEach(result => {
  console.log(`Job ${result.jobId}: ${result.status}`);
});

Job Management

Check Job Status

// Get current status
const status = await client.getJobStatus(jobId);
console.log(`Status: ${status.status}`); // processing, completed, failed

// Wait for completion with timeout
const finalStatus = await client.waitForCompletion(jobId, { timeout: 300000 });

Get Results

// Download processed audio
const audioBuffer = await client.downloadAudio(jobId);
await fs.writeFile('processed_audio.wav', audioBuffer);

// Get processing metadata
const metadata = await client.getJobMetadata(jobId);
console.log(`Original duration: ${metadata.originalDuration}s`);
console.log(`Processed duration: ${metadata.processedDuration}s`);

Error Handling

import { CleanvoiceError, QuotaExceededError } from '@cleanvoice/cleanvoice-sdk';

try {
  const result = await client.processAudio('audio.wav');
} catch (error) {
  if (error instanceof QuotaExceededError) {
    console.log('Monthly quota exceeded');
  } else if (error instanceof CleanvoiceError) {
    console.log(`API error: ${error.message}`);
  }
}

TypeScript Support

Full TypeScript definitions are included:

interface ProcessingOptions {
  removeFillerWords?: boolean;
  removeSilence?: boolean;
  enhanceSpeech?: boolean;
  studioSound?: 'false' | 'true' | 'nightly';  // 'nightly' recommended, 'true' deprecated
  language?: string;
  // ... see API docs for full list
}

interface JobResult {
  jobId: string;
  status: 'processing' | 'completed' | 'failed';
  originalDuration?: number;
  processedDuration?: number;
}

SDK Comparison

Feature Python SDK Node.js SDK REST API
Installation pip install npm install Direct HTTP
Async Support ✅ (async/await) ✅ (Promises)
TypeScript
Batch Processing Manual
Error Handling Custom exceptions Custom errors HTTP codes
File Upload Automatic Automatic Manual multipart

Getting Help