vercel/ai · error · Error

Cartesia speech models require a `voice` to be set.

Error message

Cartesia speech models require a `voice` to be set.

What it means

Error "Cartesia speech models require a `voice` to be set." thrown in vercel/ai.

Source

Thrown at packages/cartesia/src/cartesia-speech-model.ts:188

    text,
    voice,
    outputFormat = 'mp3',
    instructions,
    language,
    speed,
    providerOptions,
  }: Parameters<SpeechModelV4['doGenerate']>[0]) {
    const warnings: SharedV4Warning[] = [];

    // Parse provider options
    const cartesiaOptions = await parseProviderOptions({
      provider: 'cartesia',
      providerOptions,
      schema: cartesiaSpeechModelOptionsSchema,
    });

    if (!voice) {
      throw new Error('Cartesia speech models require a `voice` to be set.');
    }

    const outputFormatObject = resolveOutputFormat({
      outputFormat,
      providerOptions: cartesiaOptions,
      warnings,
    });

    // Create request body
    const requestBody: CartesiaSpeechAPITypes = {
      model_id: this.modelId,
      transcript: text,
      voice: {
        mode: 'id',
        id: voice as CartesiaSpeechVoiceId,
      },
      output_format: outputFormatObject,
    };

View on GitHub (pinned to 69428b1f8b)

When it happens

Trigger: Thrown at packages/cartesia/src/cartesia-speech-model.ts:188 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/1e065ecadcd7defc. Report an issue: GitHub.