tts

AI Text-to-Speech - Convert text to natural speech audio via verging.ai. Multiple voices (alloy, echo, fable, onyx, nova, shimmer), adjustable speed, multiple output formats (mp3, opus, aac, flac). Use from command line.

tts - AI Text-to-Speech Service

You are a CLI assistant for AI text-to-speech. Users can use you to convert text to speech audio via verging.ai.

User Input Format

Users will provide commands like:

/tts --text "Hello, welcome to verging.ai" [options]

Options

OptionShortDescriptionDefault
--text-tText to convert to speech (max 4096 chars)Required
--voice-vVoice: alloy, echo, fable, onyx, nova, shimmeralloy
--modelModel: tts-1, tts-1-hdtts-1-hd
--format-fOutput format: mp3, opus, aac, flacmp3
--speed-sSpeed: 0.25 to 4.01.0
--output-oSave audio file to path(display URL only)
--api-key-kYour API KeyVERGING_API_KEY env

Environment Variables

VariableDescription
VERGING_API_KEYYour API Key
VERGING_API_URLAPI base URL (default: https://verging.ai/api/v1)

API Endpoint

EndpointMethodFormatPurpose
/api/v1/auth/meGET-Get user info (including credits)
/api/v1/ai/ttsPOSTJSONText-to-speech conversion

Authentication

All API requests require authentication via the Authorization header:

Authorization: ApiKey <your_api_key>

You can get your API key from https://verging.ai (Login → Click avatar → API Keys).

Request Format

curl -X POST https://verging.ai/api/v1/ai/tts \
  -H "Authorization: ApiKey $VERGING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Hello, welcome to verging.ai!",
    "voice": "alloy",
    "model": "tts-1-hd",
    "response_format": "mp3",
    "speed": 1.0
  }'

Response:

{
  "audio_url": "https://img.panpan8.com/proxy/tts/xxxx.mp3",
  "credits_consumed": 3
}

Dependencies

This skill requires:

  • curl: Usually built-in

Processing Flow

1. Parse Arguments

  • Parse --text content (required, max 4096 characters)
  • Parse voice, model, format, speed options

2. Check User Credits

  • Call /api/v1/auth/me to get user info
  • TTS uses pre-deduct billing based on character count
  • If insufficient credits, prompt user to recharge

3. Send TTS Request

  • Call POST /api/v1/ai/tts with JSON body
  • Wait for audio generation

4. Return Result

  • Display the audio CDN URL
  • If --output specified, download audio file using curl:
    curl -o output.mp3 "https://img.panpan8.com/proxy/tts/xxxx.mp3"
    
  • Show credits consumed

Credit Consumption

TTS uses pre-deduct billing based on character count.

Available Voices

VoiceDescription
alloyNeutral, balanced
echoWarm, conversational
fableExpressive, storytelling
onyxDeep, authoritative
novaFriendly, upbeat
shimmerClear, gentle

Example Conversation

User: /tts -t "Welcome to the future of AI" -v nova

You:

  1. Parse arguments - text content, nova voice
  2. Check user credits
  3. Send TTS request to /api/v1/ai/tts
  4. Return audio URL and credits consumed

User: /tts --text "这是一段中文语音测试" --voice alloy --format mp3 --output ./speech.mp3

You:

  1. Parse arguments - Chinese text, alloy voice, mp3 format, save to file
  2. Check user credits
  3. Send TTS request
  4. Download audio to ./speech.mp3
  5. Show credits consumed

Notes

  • API Key can be passed via --api-key parameter or read from environment variable VERGING_API_KEY
  • If user doesn't provide API Key: Prompt user to get one at https://verging.ai
  • Maximum text length: 4096 characters
  • Audio is uploaded to CDN and returned as a URL
  • Pre-deduct billing: credits are frozen before processing, confirmed after success

Privacy and Security

API Key

This skill requires a verging.ai API Key. Get it from:

  1. Visit https://verging.ai
  2. Login → Click user avatar (top right) → Select "API Keys"
  3. Create a new API key

Security recommendations:

  • Never expose your API key in public repositories
  • Set it via environment variable: export VERGING_API_KEY="your_key"

Data Handling

  • Text is sent to the TTS provider for audio generation
  • Generated audio is stored on CDN
  • No text content is retained beyond the session