API-locale

HTTP su localhost:17500: API OpenAI-compatible, API Voicebox-compatible e API di gestione.

base · http://localhost:17500 auth · nessunanone CORS · Server:CorsOrigins
Prima chiamataFirst call
curl http://localhost:17500/health

curl http://localhost:17500/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"local-llm","messages":[
        {"role":"user","content":"Ciao!"}]}'

Risposta /health: stato, versione, uptime, hardware e modelli caricati. The /health reply: status, version, uptime, hardware and loaded models.

Endpoint

Tre famiglie di endpoint, un solo server.

Sicurezza: il server non applica autenticazione. Server:ApiKey e Server:AuthEnabled non sono usati dal codice: ogni client che raggiunge la porta può avviare i motori e leggere i modelli. Tienilo su localhost o dietro un reverse proxy. Security: the server applies no authentication. Server:ApiKey and Server:AuthEnabled are not used by the code: anything that reaches the port can start engines and read models. Keep it on localhost or behind a reverse proxy.

OpenAI-compatible

Prefisso /v1: modelli, chat e audio.

GET /v1/models

Elenco dei modelli esposti dal server: local-llm, parakeet-ultra, kokoro-82m. The models exposed by the server: local-llm, parakeet-ultra, kokoro-82m.

{
  "object": "list",
  "data": [
    { "id": "local-llm",     "object": "model", "owned_by": "local-ai-server" },
    { "id": "parakeet-ultra","object": "model", "owned_by": "local-ai-server" },
    { "id": "kokoro-82m",    "object": "model", "owned_by": "local-ai-server" }
  ]
}
POST /v1/chat/completions

Chat con il modello GGUF caricato. Con "stream": true la risposta arriva in text/event-stream token per token. Chat with the loaded GGUF model. With "stream": true the reply arrives as text/event-stream, token by token.

curl http://localhost:17500/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "local-llm",
    "messages": [
      { "role": "system", "content": "Sei un assistente breve." },
      { "role": "user",   "content": "Spiegami cosa fa questo server." }
    ],
    "max_tokens": 256,
    "stream": false
  }'
POST /v1/audio/transcriptions

Trascrizione di un file audio (multipart/form-data, campo file). Il campo language è opzionale: auto rileva la lingua, un codice la impone. Transcription of an audio file (multipart/form-data, file field). The language field is optional: auto detects it, a code forces it.

curl http://localhost:17500/v1/audio/transcriptions \
  -F file=@audio.wav \
  -F language=auto

{
  "text": "Il testo trascritto.",
  "success": true,
  "language": "it",
  "duration": 3210
}
POST /v1/audio/translations

Alias OpenAI-compatible: la stessa trascrizione, con l’inglese come lingua di destinazione. Parakeet rileva la lingua sorgente e restituisce il testo. OpenAI-compatible alias: the same transcription, with English as target language. Parakeet detects the source language and returns the text.

curl http://localhost:17500/v1/audio/translations \
  -F file=@audio.wav \
  -F language=auto
POST /v1/audio/speech

Sintesi vocale: JSON nel corpo, WAV 24 kHz mono in risposta. Voce, lingua e velocità vengono dal corpo oppure dai valori predefiniti del server. Speech synthesis: JSON body, 24 kHz mono WAV reply. Voice, language and speed come from the body or from the server defaults.

curl http://localhost:17500/v1/audio/speech \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kokoro-82m",
    "input": "Buongiorno!",
    "voice": "default",
    "language": "it",
    "speed": 1.0
  }' --output speech.wav
POST /v1/voice/chat

Chat vocale in modalità omni: audio in, audio fuori (multipart/form-data). Campi: file, chat_id, language, voice, speed, mode. Voice chat in omni mode: audio in, audio out (multipart/form-data). Fields: file, chat_id, language, voice, speed, mode.

curl http://localhost:17500/v1/voice/chat \
  -F file=@domanda.wav \
  -F chat_id=sessione-1 \
  -F language=it \
  -F voice=default \
  -F speed=1.0 \
  -F mode=omni

Voicebox-compatible

Profili, generazione e trascrizione alla root.

GET /profiles

Elenco dei profili vocali salvati: id, nome, file audio, lingua, provider e data di creazione. The stored voice profiles: id, name, audio file, language, provider and creation date.

curl http://localhost:17500/profiles

[
  {
    "id": 1,
    "name": "Voce predefinita",
    "voiceFile": "voices/default.wav",
    "language": "it",
    "provider": "kokoro",
    "createdAt": "2026-11-20T09:12:44.101Z"
  }
]
POST /generate

Sintesi vocale con audio in base64. profileId sceglie la voce, language la lingua, format il formato (wav). Speech synthesis with base64 audio. profileId picks the voice, language the language, format the format (wav).

curl http://localhost:17500/generate \
  -H "Content-Type: application/json" \
  -d '{ "text": "Buongiorno!", "profileId": "default", "language": "it", "format": "wav" }'

{
  "success": true,
  "audioBase64": "UklGRi...",
  "mimeType": "audio/wav",
  "sampleRate": 24000,
  "durationMs": 1180,
  "transcript": "Buongiorno!"
}
POST /transcribe

Trascrizione Voicebox-compatible: multipart/form-data con il campo file. Voicebox-compatible transcription: multipart/form-data with the file field.

curl http://localhost:17500/transcribe \
  -F file=@audio.wav

{
  "success": true,
  "text": "Il testo trascritto.",
  "language": "it",
  "durationMs": 3210
}

Gestione

Prefisso /api: impostazioni, motori, modelli, attività.

MetodoMethodPercorsoPathCosa faWhat it does
GET/api/settingsLegge le impostazioni correnti e il percorso del file.Reads the current settings and the file path.
PUT/api/settingsSalva le impostazioni e riavvia i motori se cambiano i provider.Saves the settings and restarts the engines if the providers changed.
GET/api/servicesStato di LLM, STT e TTS con hardware e modelli caricati.LLM, STT and TTS status with hardware and loaded models.
POST/api/services/{name}/startAvvia un motore (llm, stt, tts).Starts an engine (llm, stt, tts).
POST/api/services/{name}/stopFerma un motore e libera la memoria.Stops an engine and frees the memory.
POST/api/services/{name}/reloadRicarica un motore.Reloads an engine.
PUT/api/services/{name}/startupImposta l’avvio automatico del motore.Sets the auto-start mode of an engine.
GET/api/llm/modelsElenco dei modelli GGUF trovati in models/.The GGUF models found in models/.
POST/api/llm/selectSceglie il modello GGUF attivo.Selects the active GGUF model.
GET/api/tts/infoMotore TTS attivo, voci, lingue e provider (CPU/CUDA).Active TTS engine, voices, languages and provider (CPU/CUDA).
GET/api/tts/qwen/voicesVoci predefinite e clonate di Qwen3-TTS.Preset and cloned voices of Qwen3-TTS.
POST/api/tts/qwen/download-baseScarica in background il modello Base (~5,5 GB) per il voice cloning.Downloads the Base model (~5.5 GB) in the background for voice cloning.
GET/api/activity?take=80Le operazioni recenti con durata e motore.Recent operations with duration and engine.
GET/api/defaultsVoce, lingua, velocità e prompt di sistema predefiniti.Default voice, language, speed and system prompt.
PUT/api/defaultsSalva i valori predefiniti (anche in appsettings.json).Saves the defaults (also to appsettings.json).
GET/api/configConfigurazione effettiva del server (percorsi, modelli, porte).Effective server configuration (paths, models, ports).

Servizio

Stato, informazioni e dashboard.

GET /health

Stato del server: versione, uptime, modalità di calcolo (CPU/CUDA), VRAM e modelli caricati. Server status: version, uptime, compute mode (CPU/CUDA), VRAM and loaded models.

{
  "status": "ok",
  "version": "1.0.0",
  "uptime": "2026-11-26T15:04:21.123Z",
  "hardware": {
    "llmMode": "CUDA",
    "sttMode": "CUDA",
    "ttsMode": "CUDA",
    "gpuAvailable": true,
    "gpuName": "NVIDIA GeForce RTX 4060",
    "vramTotalMb": 4096,
    "vramFreeMb": 2810,
    "cpuThreads": 16
  },
  "models": [
    { "name": "LLM (GGUF)", "type": "chat", "provider": "CUDA", "loaded": true, "status": "ready" },
    { "name": "Parakeet Ultra", "type": "stt", "provider": "CUDA", "loaded": true, "status": "ready" },
    { "name": "Kokoro", "type": "tts", "provider": "cuda", "loaded": true, "status": "ready" }
  ]
}
GET / · /api/info · /i18n/{lang}.json

/ serve la dashboard web, /api/info restituisce il nome e la versione del servizio, /i18n/{lang}.json i testi bilingui della dashboard (it o en). / serves the web dashboard, /api/info returns the service name and version, /i18n/{lang}.json the bilingual dashboard texts (it or en).

curl http://localhost:17500/api/info

{
  "service": "AiLocalVoiceServer",
  "version": "1.0.0",
  "status": "ok",
  "llm": { "loaded": true,  "model": "Qwen3-4B-Instruct-Q4_K_M.gguf", "provider": "CUDA" },
  "stt": { "loaded": true,  "model": "parakeet-ultra",               "provider": "CUDA" },
  "tts": { "loaded": true,  "engine": "kokoro",                      "provider": "cuda" }
}

Riferimento completo

Il riferimento in testo, in italiano e in inglese, vive nel repository. The full text reference, in Italian and English, lives in the repository.

OpenAPI: il server espone anche lo schema OpenAPI generato da ASP.NET Core: http://localhost:17500/openapi/v1.json. OpenAPI: the server also exposes the OpenAPI schema generated by ASP.NET Core: http://localhost:17500/openapi/v1.json.