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

# Introduction

> VoxNexus API Documentation Overview

## Welcome to VoxNexus API

VoxNexus provides powerful voice service APIs, including Text-to-Speech (TTS), Speech-to-Text (STT), and Text Translation capabilities. We offer two types of API interfaces:

* **REST API**: Suitable for standard request-response scenarios, supporting both synchronous and streaming responses
* **WebSocket API**: Ideal for real-time bidirectional communication scenarios, providing low-latency real-time voice processing

## API Playground

All API endpoints support interactive testing through the API Playground. You can:

* **Test REST API endpoints** directly in your browser
* **Try WebSocket connections** with real-time message exchange
* **View request/response examples** for each endpoint
* **Authenticate** using your API key in the playground interface

<Note>
  The API Playground is available for all endpoints in the REST API and WebSocket API sections. Simply navigate to any endpoint page to access the interactive playground.
</Note>

## Authentication

All API endpoints require authentication. VoxNexus supports multiple authentication methods:

### REST API Authentication

Use the `X-Api-Key` header in your request:

```bash theme={null}
X-Api-Key: YOUR_API_KEY
```

### WebSocket API Authentication

For WebSocket connections, you can authenticate using either method:

**Option 1: Query Parameter (Recommended)**

```
wss://api.voxnexus.ai/v1/tts/realtime?token=YOUR_API_KEY
```

**Option 2: Header**

```bash theme={null}
X-Api-Key: YOUR_API_KEY
```

<Note>
  Query parameter authentication is recommended for WebSocket connections as some WebSocket clients don't support custom headers.
</Note>

API Keys can be obtained and managed in the [Dashboard](https://voxnexus.ai/dashboard).

## Base URLs

* **REST API**: `https://api.voxnexus.ai`
* **WebSocket API**: `wss://api.voxnexus.ai`

## Rate Limiting

API requests are subject to rate limiting and quota management. When limits are exceeded, the API returns a `429` status code.

## Error Handling

All error responses follow a unified format:

```json theme={null}
{
  "error": "Error description",
  "code": "Error code",
  "details": "Detailed error information (optional)",
  "request_id": "Request ID (optional)"
}
```

## Quick Start

### REST API Example

```bash theme={null}
curl -X POST https://api.voxnexus.ai/v1/tts \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello, this is a test message",
    "model_id": "vn-tts-basic",
    "voice_id": "vn-xiaoxiao"
  }'
```

### WebSocket API Example

```javascript theme={null}
// Connect with token as query parameter (recommended)
const ws = new WebSocket('wss://api.voxnexus.ai/v1/tts/realtime?token=YOUR_API_KEY');

ws.onopen = () => {
  // Send initialization message
  ws.send(JSON.stringify({
    type: 'init',
    model_id: 'vn-tts-basic',
    voice_id: 'vn-xiaoxiao'
  }));
};

ws.onmessage = (event) => {
  const message = JSON.parse(event.data);
  console.log('Received:', message.type);
};
```

## Related Resources

* [Quick Start Guide](/quickstart)
* [API Support](mailto:support@voxnexus.ai)
* [Dashboard](https://voxnexus.ai/dashboard)
