- Python
- TypeScript
def voices_get(client: Cartesia, *args: str) -> "Voice":
"""Get a specific voice."""
voice_id = args[0] if args else "6ccbfb76-1fc6-48f7-b71d-91ac6298247b"
voice = client.voices.get(voice_id)
if hasattr(voice, "embedding"):
voice.embedding = ["..."] # pyright: ignore[reportAttributeAccessIssue]
print(voice)
return voice
async function voicesGet(client: Cartesia, args: string[]): Promise<void> {
const voiceId = args[0] ?? '6ccbfb76-1fc6-48f7-b71d-91ac6298247b';
const voice = await client.voices.get(voiceId);
if ('embedding' in voice) {
console.log({ ...voice, embedding: ['...'] });
} else {
console.log(voice);
}
}
Run this example
- Python
- TypeScript
git clone --branch v3.2.0 https://github.com/cartesia-ai/cartesia-python
cd cartesia-python
uv sync
CARTESIA_API_KEY=YOUR_KEY uv run examples/examples.py voices_get [voice_id]
git clone --branch v3.2.0 https://github.com/cartesia-ai/cartesia-js
cd cartesia-js
pnpm i
CARTESIA_API_KEY=YOUR_KEY pnpm tsn examples/node_examples.ts voicesGet [voice_id]