Speechbase
PlatformGuides

Saved voices

Create reusable Voice records and reference them by UUID instead of repeating provider/model/voice on every call.

A Voice is a row in your organization's voice library that bundles a provider, model, provider-native voice ID, and any provider-specific options under a single Speechbase UUID. Reference it as voiceId on generateSpeech and the gateway resolves the full call for you.

When to use a Voice

Use a Voice when you have a voice-and-model combination you'll call repeatedly. Use the inline form (model + voice) for one-off calls or when the provider/voice changes per request.

Create a Voice

Dashboard

Go to Voices → New voice in the dashboard. Pick a provider, model, and voice, then save. The newly created row's id is the voiceId you'll use at synthesis time.

API

curl https://api.speechbase.ai/v1/voices \
  -X POST \
  -H "Authorization: Bearer $SPEECHBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Podcast narrator",
    "provider": "elevenlabs",
    "model": "eleven_v3",
    "voice_id": "JBFqnCBsd6RMkjVDRZzb",
    "tags": ["podcast"],
    "provider_options": { "stability": 0.5 }
  }'

Response:

{ "data": { "id": "550e8400-e29b-41d4-a716-446655440000", "title": "Podcast narrator", ... } }

Use a Voice on generateSpeech

SDK

import { generateSpeech } from "@speech-sdk/core";

const result = await generateSpeech({
  voiceId: "550e8400-e29b-41d4-a716-446655440000",
  text: "Hello from a saved voice.",
});

await result.write("hello.mp3");

The SDK reads SPEECHBASE_API_KEY from your environment. To override per-call:

import { generateSpeech, createSpeechGateway } from "@speech-sdk/core";

await generateSpeech({
  voiceId: "550e8400-...",
  text: "Hello",
  gateway: createSpeechGateway({ apiKey: "sb_..." }),
});

curl

curl https://api.speechbase.ai/v1/audio/speech \
  -X POST \
  -H "Authorization: Bearer $SPEECHBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "voiceId": "550e8400-e29b-41d4-a716-446655440000",
    "text": "Hello from a saved voice."
  }' \
  --output hello.mp3

Override providerOptions per call

Voice rows carry provider_options. To override one knob per call, pass providerOptions on the request — request keys win per-key (shallow merge).

await generateSpeech({
  voiceId: "550e8400-...",
  text: "Hello with extra stability.",
  providerOptions: { stability: 0.9 }, // overrides the stored 0.5
});

Errors

  • voice_not_found — the UUID doesn't belong to your organization. Check the id from GET /v1/voices.
  • voice_incomplete — the Voice row has no voice_id set. Update it via PUT /v1/voices/{voiceId} or in the dashboard.

In the SDK, both surface as VoiceResolutionError with a reason field.

On this page