Audio uses the same API key and model IDs returned by GET /v1/models.
Key points
- Speech is priced by Unicode characters.
- Transcription and translation use multipart/form-data.
- Duration is rounded up to seconds with a one-second minimum.
- Failed requests are not charged.
Generate speech or transcribe audio#
Use the OpenAI-compatible audio routes with an API key. Speech returns an audio file; transcription and translation accept multipart audio and return JSON text.
curl https://api.xpncore.com/v1/audio/speech \
-H "Authorization: Bearer $XPNCORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"AUDIO_MODEL_ID","input":"Hello from XPNCORE","voice":"alloy","response_format":"wav"}' \
-o speech.wavAudio models are listed by GET /v1/models with audio.speech, audio.transcriptions or audio.translations.
Voices#
Each text-to-speech model has its own voices. Call GET /v1/audio/voices?model= with your API key to list them: each voice has an id, a name and a kind (preset for the model's own voices, cloned for a cloned one), plus gender, region and language when the model says. The list holds the presets, the voices an administrator shares and your account's own. can_clone says whether the model can clone a voice right now.
curl "https://api.xpncore.com/v1/audio/voices?model=AUDIO_MODEL_ID" \
-H "Authorization: Bearer $XPNCORE_API_KEY"Send a voice's id as voice when you call /v1/audio/speech. OpenAI's six standard names (alloy, echo, fable, onyx, nova, shimmer) always work; each stands for one of the model's presets. The Models page lists each model's presets on its “Voices” tab too, with no API key.
Your own voices#
On a model that can clone voices (can_clone is true), send POST /v1/audio/voices as multipart with model, name, consent=true and a file holding a 3–8 second clip of at most 20 MB. Add denoise=true to clean up noise first. consent=true confirms you may use the voice in the clip. The answer's id is your new voice.
# Clone a voice from a 3-8 second clip; the answer's id is your new voice
curl https://api.xpncore.com/v1/audio/voices \
-H "Authorization: Bearer $XPNCORE_API_KEY" \
-F model=AUDIO_MODEL_ID \
-F name="My voice" \
-F consent=true \
-F [email protected]
# Delete it
curl -X DELETE https://api.xpncore.com/v1/audio/voices/VOICE_ID \
-H "Authorization: Bearer $XPNCORE_API_KEY"An account keeps up to 5 voices of its own, and only that account's API keys can use them. Delete one with DELETE /v1/audio/voices/{id}. Chat AI creates and deletes these voices too.
Audio parameters#
Speech accepts JSON with model, input and voice. Upload routes use multipart/form-data with model and file; language and prompt are optional.
curl https://api.xpncore.com/v1/audio/transcriptions \
-H "Authorization: Bearer $XPNCORE_API_KEY" \
-F [email protected] \
-F model=AUDIO_MODEL_ID \
-F language=enAudio pricing#
Speech is charged by Unicode character count using the model’s speech price per million characters. Transcription and translation are charged by measured audio duration, rounded up to whole seconds with a minimum of one second. Failed requests are not charged.
Audio errors#
Use a model that declares the requested audio capability. Invalid multipart fields, unsupported audio formats, insufficient funds and upstream failures return the standard error object; an upstream failure releases the hold.