API Endpoints¶
Complete reference for WakeBuilder's REST API and WebSocket endpoints.
Base URL¶
All endpoints are relative to this base URL.
Authentication¶
Currently, WakeBuilder does not require authentication. For production deployment, implement authentication at the reverse proxy level.
Health & Info¶
Health Check¶
Returns the current health status of the API.
Response:
API Info¶
Returns detailed API and system information.
Response:
{
"name": "WakeBuilder API",
"version": "0.1.0",
"description": "Wake word training platform API",
"docs_url": "/docs",
"system": {
"python_version": "3.12.0",
"torch_version": "2.0.0",
"cuda_available": true,
"device": "cuda"
}
}
Training Endpoints¶
Start Training¶
Starts a new wake word training job.
Request (multipart/form-data):
| Field | Type | Required | Description |
|---|---|---|---|
wake_word | string | Yes | Wake word text |
audio_files | file[] | Yes | Voice recordings (1-5) |
model_type | string | No | Model type (default: "ast") |
batch_size | int | No | Batch size (default: 32) |
learning_rate | float | No | Learning rate (default: 0.0001) |
num_epochs | int | No | Max epochs (default: 100) |
early_stopping | int | No | Patience epochs (default: 8) |
dropout | float | No | Dropout rate (default: 0.5) |
label_smoothing | float | No | Label smoothing (default: 0.1) |
mixup_alpha | float | No | Mixup alpha (default: 0.5) |
use_focal_loss | bool | No | Enable focal loss |
focal_alpha | float | No | Focal alpha (default: 0.5) |
focal_gamma | float | No | Focal gamma (default: 2.0) |
use_attention | bool | No | Enable attention |
use_se_block | bool | No | Enable SE block |
use_tcn | bool | No | Enable TCN |
use_tts_positives | bool | No | Generate TTS samples |
use_real_negatives | bool | No | Use cached negatives |
use_hard_negatives | bool | No | Generate hard negatives |
target_positive_samples | int | No | Target sample count |
negative_ratio | float | No | Negative:positive ratio |
hard_negative_ratio | float | No | Hard negative ratio |
Response:
Get Training Status¶
Returns the current status of a training job.
Response:
{
"job_id": "abc123",
"status": "training",
"phase": "Training classifier",
"progress": 45.5,
"current_epoch": 23,
"total_epochs": 50,
"metrics": {
"train_loss": 0.234,
"val_loss": 0.198,
"val_accuracy": 0.956,
"val_f1": 0.923
},
"data_stats": {
"recordings": 3,
"positive_samples": 5000,
"negative_samples": 10000,
"train_size": 11250,
"val_size": 3750
},
"elapsed_time": "5m 23s"
}
Download Model¶
Downloads the trained model as a ZIP file.
Response:
Binary ZIP file containing:
{wake_word}.pt- Model weights{wake_word}.json- Metadata{wake_word}.onnx- ONNX export (if available)
Delete Job¶
Deletes a completed or failed training job.
Response:
List Jobs¶
Lists all training jobs.
Response:
{
"jobs": [
{
"job_id": "abc123",
"wake_word": "jarvis",
"status": "completed",
"created_at": "2026-01-06T15:00:00Z"
}
]
}
Model Endpoints¶
List Models¶
Lists all available wake word models.
Query Parameters:
| Param | Type | Description |
|---|---|---|
type | string | Filter by type: "custom", "default", "all" |
Response:
{
"models": [
{
"id": "jarvis",
"wake_word": "jarvis",
"type": "custom",
"created_at": "2026-01-06T15:00:00Z",
"accuracy": 0.971,
"f1_score": 0.943,
"threshold": 0.65
}
],
"total": 1
}
Get Model Details¶
Returns detailed information about a specific model.
Response:
{
"id": "jarvis",
"wake_word": "jarvis",
"type": "custom",
"created_at": "2026-01-06T15:00:00Z",
"threshold": 0.65,
"metrics": {
"accuracy": 0.971,
"f1_score": 0.943,
"precision": 0.952,
"recall": 0.934
},
"training_config": {
"batch_size": 32,
"learning_rate": 0.0001,
"dropout": 0.5
},
"trainable_params": 234567,
"has_onnx": true
}
Download Model¶
Downloads the model as a ZIP file.
Delete Model¶
Deletes a model.
Response:
Testing Endpoints¶
Test with File¶
Tests a model with an uploaded audio file.
Request (multipart/form-data):
| Field | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | Model to test |
audio | file | Yes | Audio file |
threshold | float | No | Detection threshold |
Response:
{
"detected": true,
"confidence": 0.892,
"threshold": 0.65,
"model_id": "jarvis",
"processing_time_ms": 156
}
WebSocket Testing¶
Real-time audio testing via WebSocket.
Client → Server:
Server → Client:
{
"type": "detection",
"detected": true,
"confidence": 0.87,
"threshold": 0.65,
"timestamp": "2026-01-06T15:30:00Z"
}
Set Device¶
Sets the inference device (CPU or GPU).
Request:
Get Device Info¶
Returns current device information.
Response:
Cache Endpoints¶
Get Cache Info¶
Returns negative data cache status.
Response:
Build Cache¶
Starts building the negative data cache.
Query Parameters:
| Param | Type | Description |
|---|---|---|
max_workers | int | Parallel workers (default: 4) |
Response:
Clear Cache¶
Clears the negative data cache.
Response:
Error Responses¶
All error responses follow this format:
Common Error Codes¶
| Status | Error Type | Description |
|---|---|---|
| 400 | validation_error | Invalid input |
| 404 | not_found | Resource not found |
| 409 | conflict | Resource already exists |
| 500 | internal_error | Server error |
Rate Limits¶
Currently, no rate limits are enforced. For production, implement rate limiting at the reverse proxy level.