AI Voice Generator Agent Skill — Text to Speech via AI Pass API
AI Voice Generator Agent Skill — Text to Speech via AI Pass API
This skill enables AI agents to convert text to speech audio using AI Pass TTS API.
Setup
- Create AI Pass account: aipass.one — $1 free credit on signup
- Get API key: Developer Dashboard → API Keys
- Set env:
export AIPASS_API_KEY="your-key"
API Reference
Endpoint: POST https://aipass.one/apikey/v1/audio/speech
Auth: Authorization: Bearer $AIPASS_API_KEY
Returns: Binary MP3 audio
Python Implementation
import os, requests
AIPASS_API_KEY = os.environ["AIPASS_API_KEY"]
def text_to_speech(
text: str,
voice: str = "nova",
model: str = "tts-1",
output_path: str = "output.mp3"
) -> str:
"""
Convert text to speech and save as MP3.
Args:
text: Text to convert (max ~4000 chars per request)
voice: alloy|echo|fable|onyx|nova|shimmer
model: tts-1 (fast) or tts-1-hd (high quality)
output_path: Where to save the MP3 file
Returns:
Path to saved MP3 file
"""
response = requests.post(
"https://aipass.one/apikey/v1/audio/speech",
headers={
"Authorization": f"Bearer {AIPASS_API_KEY}",
"Content-Type": "application/json"
},
json={
"model": model,
"input": text,
"voice": voice
},
timeout=60
)
if response.status_code != 200:
raise Exception(f"TTS failed: {response.status_code} {response.text}")
with open(output_path, "wb") as f:
f.write(response.content)
return output_path
# Example usage
if __name__ == "__main__":
# Generate audio
path = text_to_speech(
text="Welcome to AI Pass. The universal AI wallet for all your artificial intelligence needs.",
voice="nova",
model="tts-1",
output_path="welcome.mp3"
)
print(f"Audio saved to: {path}")
Bash / curl Example
curl -s -X POST https://aipass.one/apikey/v1/audio/speech \
-H "Authorization: Bearer $AIPASS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "Hello! This is a test of the AI Pass text-to-speech system.",
"voice": "nova"
}' --output output.mp3
echo "Saved to output.mp3"
Available Voices
| Voice | Character |
|---|---|
nova |
Warm, friendly female — great for most content |
alloy |
Neutral, clear — versatile and professional |
echo |
Warm male — natural conversation |
fable |
Expressive with British flair |
onyx |
Deep, authoritative |
shimmer |
Clear, upbeat female |
Multilingual Support
The TTS API handles multilingual text automatically. Write in Spanish, French, Japanese — the voice adapts:
# Works in any language
text_to_speech(
text="Bonjour, bienvenue sur AI Pass!",
voice="fable",
output_path="french_welcome.mp3"
)
Related Resources
Skill File
# AI Voice Generator Skill
## Description
Convert text to speech using AI Pass TTS API (OpenAI tts-1).
## Auth
API key required: https://aipass.one/panel/developer.html → API Keys
Authorization: Bearer $AIPASS_API_KEY
## Endpoint
POST https://aipass.one/apikey/v1/audio/speech
## Parameters
- input: text to convert (required)
- voice: alloy|echo|fable|onyx|nova|shimmer
- model: tts-1 (standard) or tts-1-hd (high quality)
## Response
Binary MP3 audio data
## Live App
https://aipass.one/apps/voice-gen
Download Skill File