- Python
- TypeScript
def voices_update(client: Cartesia, *args: str) -> None:
"""Update a voice."""
import sys
if len(args) < 2:
print("Usage: voices_update <voice_id> <name>")
sys.exit(1)
voice_id, *name_parts = args
voice = client.voices.update(voice_id, name=" ".join(name_parts))
print(voice)
async function voicesUpdate(client: Cartesia, args: string[]): Promise<void> {
const [voiceId, ...nameParts] = args;
if (!voiceId || nameParts.length === 0) {
console.error('Usage: voicesUpdate <voiceId> <name>');
process.exit(1);
}
const voice = await client.voices.update(voiceId, { name: nameParts.join(' ') });
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_update <voice_id> "Updated Name"
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 voicesUpdate <voice_id> "Updated Name"