Python client for the Primvoices API
Project description
Prim Voices API Python Client
A Python client for interacting with the Prim Voices API.
Installation
pip install primvoices
Usage
from primvoices import Client
from primvoices.models import ClientConfig
# Initialize the client
client = Client(ClientConfig(
api_key='your-api-key',
# Optional: override the base URL
# base_url='https://custom-api-url.com'
))
# Using context manager (recommended)
with Client(ClientConfig(api_key='your-api-key')) as primvoices:
# Your code here
pass
# Working with Voices
async def voice_examples():
# List all voices
voices = client.voices.list()
print('Your voices:', voices.data)
# List public voices
public_voices = client.voices.list_public()
print('Public voices:', public_voices.data)
# Create a new voice
new_voice = client.voices.create({
'name': 'My Custom Voice',
'sample_url': 'https://example.com/sample.wav',
'verified': True # Required: User must explicitly verify they have permission to use this voice
})
print('Created voice:', new_voice.data)
# Get a specific voice
voice = client.voices.retrieve('voice_id')
print('Voice details:', voice.data)
# Get a public voice
public_voice = client.voices.retrieve_public('public_voice_id')
print('Public voice details:', public_voice.data)
# Working with Generations
async def generation_examples():
# List all generations
generations = client.generations.list()
print('All generations:', generations.data)
# Create a new text-to-speech generation
new_generation = client.generations.create({
'voice_id': 'voice_id',
'text': 'Hello, this is a test generation.',
'quality': 'high',
'notes': 'Read in a friendly tone'
})
print('Created generation:', new_generation.data)
# Create a voice cloning generation
voice_clone = client.generations.create({
'voice_id': 'voice_id',
'source_url': 'https://example.com/source-audio.wav',
'quality': 'voice'
})
print('Created voice clone:', voice_clone.data)
# Get a specific generation
generation = client.generations.retrieve('generation_id')
print('Generation details:', generation.data)
API Resources
Voices
client.voices.list()- List all voices for the authenticated userclient.voices.list_public()- List all public voicesclient.voices.create(params)- Create a new voiceclient.voices.retrieve(voice_id)- Get a specific voiceclient.voices.retrieve_public(voice_id)- Get a specific public voiceclient.voices.delete(voice_id)- Delete a voice
Generations
client.generations.list()- List all generationsclient.generations.create(params)- Create a new generationclient.generations.retrieve(generation_id)- Get a specific generationclient.generations.delete(generation_id)- Delete a generation
Development
- Clone the repository
- Install dependencies:
pip install -e ".[dev]"
- Run tests:
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
primvoices-0.1.0.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file primvoices-0.1.0.tar.gz.
File metadata
- Download URL: primvoices-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1822c58437f2f89b1782bd23ae965e67d81e74552fc552ea71660d4bca366ff2
|
|
| MD5 |
3e9c3073ea7babfb4337844d4f495763
|
|
| BLAKE2b-256 |
c330ee5cc6fa1883851e578b5b52627875dff27d9eab336de65c86bbc6f572d9
|
File details
Details for the file primvoices-0.1.0-py3-none-any.whl.
File metadata
- Download URL: primvoices-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78b821d7d3c5232b600e1a0f60ebc4bfb1ef6d8208e71befaa1bbecaace72315
|
|
| MD5 |
1c271f36f6f33622015081c9a6bdd5a2
|
|
| BLAKE2b-256 |
066aa19c24aaaa1d79904f4445ba75738a27cf4c83b6e8f89045b87941a78228
|