Skip to main content
POST
/
v1
/
tts
POST /v1/tts — Text-to-Speech API Reference
curl --request POST \
  --url https://api.example.com/v1/tts \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "<string>",
  "model": "<string>",
  "voice_id": "<string>"
}
'
{
  "success": true,
  "audio_url": "<string>",
  "duration_seconds": 123,
  "request_id": "<string>",
  "credits_used": 123
}

Documentation Index

Fetch the complete documentation index at: https://docs.artnex.app/llms.txt

Use this file to discover all available pages before exploring further.

The /v1/tts endpoint converts a text string into a natural-sounding audio file. You choose the voice model and an optional voice identifier; the API returns a URL to the generated audio file you can stream or download directly.

Endpoint

POST https://api.artnex.ai/v1/tts

Request parameters

text
string
required
The text to convert to speech. Plain text only — no HTML or SSML markup. Maximum 5,000 characters per request.
model
string
default:"tts-elevenlabs"
The speech synthesis model to use. Accepted values:
  • "tts-elevenlabs" — ElevenLabs voice synthesis (10 credits). High-quality, natural-sounding output. Best for narration, marketing, and content creation.
  • "kling-tts" — Kling voice synthesis (100 credits). Extended capabilities for longer-form audio.
voice_id
string
Identifier of the voice to use. Available voices depend on the chosen model. If omitted, the model’s default voice is used. Contact support for a full list of available voice IDs for your plan.

Response fields

success
boolean
required
true when the request completed successfully.
audio_url
string
required
Direct HTTPS URL to the generated audio file (MP3 format). The file is available for 24 hours; download it promptly if you need to keep it.
duration_seconds
number
Duration of the generated audio clip in seconds.
request_id
string
Unique identifier for this request, useful for support queries or logging.
credits_used
integer
Total credits deducted from your account balance for this request.

Credit costs

ModelCredits per request
tts-elevenlabs10
kling-tts100
Credit costs are fixed per request regardless of text length, up to the 5,000-character limit. Break very long content into multiple requests if needed.

Example requests

curl --request POST \
  --url https://api.artnex.ai/v1/tts \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "text": "Welcome to Artnex, the AI-powered creative platform built for modern creators.",
    "model": "tts-elevenlabs",
    "voice_id": "rachel"
  }'

Example response

{
  "success": true,
  "audio_url": "https://cdn.artnex.ai/tts/req_tts_abc123xyz/output.mp3",
  "duration_seconds": 4.8,
  "request_id": "req_tts_abc123xyz",
  "credits_used": 10
}

Error codes

HTTP statusError codeCause
400missing_textThe text field is absent or empty
400text_too_longThe text exceeds 5,000 characters
400invalid_modelThe model value is not "tts-elevenlabs" or "kling-tts"
400invalid_voice_idThe voice_id is not available for the selected model
401invalid_api_keyThe API key is missing, malformed, or revoked
402insufficient_creditsYour account does not have enough credits
429rate_limit_exceededYou have exceeded your plan’s daily request quota
Use tts-elevenlabs (10 credits) for the vast majority of use cases. Reserve kling-tts for workflows that specifically require its extended capabilities or voice characteristics.