Lunos

Documentation

🔊 Audio Generation

The Audio Generation API allows you to convert text into natural-sounding speech using advanced AI models from OpenAI, Google, and more. This is ideal for accessibility, voice assistants, content narration, and more. You can customize the voice, output format, and speed to fit your needs.

Note: You need an API key to use this endpoint. See the Quickstart Guide to get started.

Voice Options by Model

Tip: The available voice options depend on the selected model. Choose a voice that best fits your use case and language.

OpenAI Voices

For OpenAI TTS models (e.g., openai/tts, openai/tts-hd), use one of the following voices:

Voice NameDescription / Style
alloyWarm, balanced
echoSmooth, clear
fableNarrative, expressive
onyxDeep, serious
novaBright, crisp
shimmerCheerful, lively

Google Voices

For Google TTS models (e.g., google/gemini-2.5-flash-preview-tts), use one of the following voices. Styles are shown in both English and Indonesian for clarity:

Voice NameStyle (EN)Style (ID)Description / Notes
ZephyrBrightCerahClear and cheerful
PuckUpbeatUpbeatEnergetic, lively
CharonInformativeInformatifNeutral, factual
KoreFirmTegasStrong, confident
FenrirHappySenangJoyful, positive
LedaYouthfulMudaYoung-sounding
OrusFirmTegasStrong, confident
AoedeBreezyBreezyLight, easygoing
CallirrhoeRelaxedSantaiCasual, laid-back
AutonoeBrightCerahClear and cheerful
EnceladusBreathyBerbisikSoft, airy
IapetusClearJelasDistinct, easy to understand
UmbrielRelaxedSantaiCasual, laid-back
AlgiebaSmoothLembutSoft, flowing
DespinaSmoothLembutSoft, flowing
ErinomeClearJernihDistinct, easy to understand
AlgenibGravellyBerbatuRough, textured
RasalgethiInformativeInformatifNeutral, factual
LaomedeiaUpbeatUpbeatEnergetic, lively
AchernarSoftLembutGentle, mild
AlnilamCorporatePerusahaanProfessional, formal
SchedarEvenRataBalanced, steady
GacruxMatureDewasaAdult, experienced
PulcherrimaContinueTeruskanOngoing, persistent (ambiguous)
AchirdFriendlyRamahWelcoming, kind
ZubenelgenubiCasualKasualInformal, relaxed
VindemiatrixGentleLembutSoft, tender
SadachbiaLivelyCeriaFull of life, spirited
SadaltagerKnowledgeableBerpengetahuanWise, informed
SulafatWarmHangatFriendly, inviting

How to Generate Audio (Step-by-Step)

  1. Choose your preferred client library or use cURL for direct API calls.
  2. Set your API key and endpoint URL.
  3. Configure the request parameters (text, model, voice, format, etc.).
  4. Send the request and receive the audio file in your chosen format.

Example: Using OpenAI Library

Generate speech from text using the OpenAI Node.js library:

1const response = await openai.audio.speech.create({
2  model: 'tts-1',
3  input: 'Hello, this is a test.',
4  voice: 'alloy',
5  response_format: 'mp3',
6});
7// Save response.audio to file
Parameters:
  • model: The speech model to use (e.g., tts-1).
  • input: The text you want to convert to speech.
  • voice: The voice style (e.g., alloy).
  • response_format: Output format (mp3, wav, etc.).

Example: Using Lunos Client

Generate speech using the official Lunos client:

1const client = new LunosClient({ apiKey: 'YOUR_API_KEY' });
2const response = await client.audio.textToSpeech({
3  text: 'Hello, this is a test.',
4  voice: 'alloy',
5  model: 'openai/tts',
6  response_format: 'mp3',
7  speed: 1.0,
8  appId: 'my-audio-app-v1.0',
9});
10// Save response.audioBuffer to file
Parameters:
  • text: The text to synthesize.
  • voice: Voice style (see Model Discovery).
  • model: Model ID (e.g., openai/tts).
  • response_format: Output format.
  • speed: Adjusts the speech speed (1.0 = normal).

Example: Using cURL

Direct API call for maximum control:

1curl -X POST   https://api.lunos.tech/v1/audio/generations   -H "Content-Type: application/json"   -H "Authorization: Bearer YOUR_API_KEY"   -H "X-App-ID: my-audio-app-v1.0"   -d '{
2    "model": "openai/tts",
3    "input": "Hello, this is a test.",
4    "voice": "alloy",
5    "response_format": "mp3"
6  }'   --output output.mp3

App Tracking: The X-App-ID header allows you to track audio generation usage per application. This helps with analytics, billing, and performance monitoring across different apps.

Example Response

1// Binary audio data is returned. Example headers:
2// Content-Type: audio/mpeg
3// Content-Disposition: attachment; filename="audio-1623168000.mp3"

Important: Your API key is sensitive. Never share it publicly or commit it to version control.

Best Practices & Tips

  • Choose the right voice and model for your use case (see Model Discovery).
  • Use speed to fine-tune the pace of speech for accessibility or user preference.
  • Check the Content-Type header to determine the audio format in the response.
  • Batch requests if you need to generate multiple audio files efficiently.

Troubleshooting

  • Authentication error: Verify your API key and permissions.
  • Unexpected output: Check your model and voice parameters.
  • Request issues: Ensure your request payload matches the API specification.