🚀 Introducing MARS8 Series — Four Powerful Variants | Available on All Major Clouds | Learn about the model here
🚀 Introducing MARS8 Series — Four Powerful Variants | Available on All Major Clouds | Learn about the model here
Retrieve AI-generated voice interpretations and select your preferred vocal style from multiple audio options using run_id.
curl --request GET \
--url https://client.camb.ai/apis/text-to-voice-result/{run_id} \
--header 'x-api-key: <api-key>'{
"previews": [
"<string>"
]
}Documentation Index
Fetch the complete documentation index at: https://docs.camb.ai/llms.txt
Use this file to discover all available pages before exploring further.
/text-to-voice endpoint, our system analyzes your parameters and creates not just one, but two distinct voice interpretations based on your description. This approach gives you the opportunity to compare different vocal realizations and select the one that best matches your intended use case.
run_id that was provided when you initially submitted your voice generation request. This identifier uniquely references your specific generation task and allows you to access its results once processing is complete.
The endpoint follows this structure:
GET /text-to-voice-result/{run_id}
{run_id} should be replaced with your actual run identifier. For example:
GET /text-to-voice-result/8827
Retrieve and evaluate your preview samples
Create a permanent voice profile
/voices/create-custom-voice endpoint to establish a permanent voice profile based on that preview.import requests
BASE_URL = "https://client.camb.ai/apis"
def create_voice_from_preview(run_id, preview_index=0):
"""
Converts temporary preview into permanent custom voice
This function performs a complete workflow:
1. Retrieves the specified preview audio using the run_id
2. Downloads the selected preview to a local file
3. Creates a permanent voice clone from this sample
Parameters:
run_id (int): The unique identifier of your voice generation task
preview_index (int): Which preview to use (0 or 1, corresponding to the two previews)
Returns:
dict: Response from the custom voice creation API
"""
# Retrieve preview URL from the results endpoint
preview_res = requests.get(f"{BASE_URL}/text-to-voice-result/{run_id}")
preview_url = preview_res.json()['previews'][preview_index]
# Download the selected audio sample to a local file
audio_file = requests.get(preview_url).content
with open("voice_sample.mp3", "wb") as f:
f.write(audio_file)
# Create a permanent custom voice using the downloaded sample
files = {'file': open('voice_sample.mp3', 'rb')}
data = {
'voice_name': 'My Campaign Voice', # Choose a descriptive name for your voice
'gender': 1, # Male (matches preview characteristics)
'age': 35 # Estimated vocal age
}
creation_res = requests.post(
f"{BASE_URL}/create-custom-voice",
files=files,
data=data,
headers={"x-api-key": API_KEY}
)
return creation_res.json()
# Example usage
voice_profile = create_voice_from_preview(run_id=8827, preview_index=1)
print(f"New voice ID: {voice_profile['voice_id']}")
The x-api-key is a custom header required for authenticating requests to our API. Include this header in your request with the appropriate API key value to securely access our endpoints. You can find your API key(s) in the 'API' section of our studio website.
The unique identifier for the run, which was generated during the text to voice creation process and returned upon task completion. The unique identifier for the run, which was generated during the creation process and returned upon task completion.
Successful Response
An array of two distinct URL strings, each pointing to a unique voice sample generated from your text prompt. These samples represent different voice interpretations based on your description, allowing you to compare options before selecting your preferred voice for further use.
curl --request GET \
--url https://client.camb.ai/apis/text-to-voice-result/{run_id} \
--header 'x-api-key: <api-key>'{
"previews": [
"<string>"
]
}