> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vlm.run/llms.txt
> Use this file to discover all available pages before exploring further.

# client.audio

> Learn how to process audio files with the VLM Run Node.js SDK

## Audio Predictions

The `audio` component provides methods for processing and analyzing audio files using VLM Run's models.

### Process Audio

```typescript theme={"theme":{"light":"github-light","dark":"dark-plus"}}
import { VlmRun } from "vlmrun";

const client = new VlmRun({
  apiKey: "your-api-key",
});

// Upload and process an audio file
const file = await client.files.upload({
  filePath: "path/to/audio.mp3",
});

// Process audio using file ID
const response = await client.audio.generate({
  fileId: file.id,
  domain: "audio.transcription",
});
```

### TypeScript Interfaces

```typescript theme={"theme":{"light":"github-light","dark":"dark-plus"}}
interface FilePredictionParams extends PredictionGenerateParams {
  batch?: boolean;
  fileId?: string;
  url?: string;
}
```

### Error Handling

```typescript theme={"theme":{"light":"github-light","dark":"dark-plus"}}
try {
  const response = await client.audio.generate({
    url: "invalid-url",
    model: "vlm-1",
  });
} catch (error) {
  if (error instanceof ApiError) {
    console.error("API Error:", error.message);
    // Handle API-specific errors
  } else {
    console.error("File system error:", error);
    // Handle local file system errors
  }
}
```

### Best Practices

1. **Audio Formats**

   * Supported formats: MP3, WAV
   * Ensure proper audio quality
   * Consider file size limits

2. **Performance**

   * Use URLs for remote audio files when possible
   * Handle timeouts appropriately
   * Consider audio length and complexity

3. **Error Handling**
   * Validate audio files before processing
   * Handle both API and file system errors
   * Implement proper error recovery
