vercel/ai · error · NoSuchModelError

AI_NoSuchModelError

AI_NoSuchModelError

Error message

Cartesia does not provide language models

What it means

The Cartesia provider implements only speech, speechModel, and realtime; its languageModel() factory unconditionally throws NoSuchModelError with the message 'Cartesia does not provide language models'. Cartesia is a voice/TTS service, so text-generation lookups through this provider can never succeed.

Source

Thrown at packages/cartesia/src/cartesia-provider.ts:168

    },
  ) as RealtimeFactoryV4;

  const provider = function (modelId: CartesiaSpeechModelId) {
    return {
      speech: createSpeechModel(modelId),
    };
  };

  provider.specificationVersion = 'v4' as const;
  provider.transcription = createTranscriptionModel;
  provider.transcriptionModel = createTranscriptionModel;
  provider.speech = createSpeechModel;
  provider.speechModel = createSpeechModel;
  provider.experimental_realtime = experimentalRealtimeFactory;

  // Required ProviderV4 methods that are not supported
  provider.languageModel = (modelId: string) => {
    throw new NoSuchModelError({
      modelId,
      modelType: 'languageModel',
      message: 'Cartesia does not provide language models',
    });
  };

  provider.embeddingModel = (modelId: string) => {
    throw new NoSuchModelError({
      modelId,
      modelType: 'embeddingModel',
      message: 'Cartesia does not provide embedding models',
    });
  };
  provider.textEmbeddingModel = provider.embeddingModel;

  provider.imageModel = (modelId: string) => {
    throw new NoSuchModelError({
      modelId,

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use cartesia.speech(modelId) for TTS or cartesia.experimental_realtime for realtime voice.
  2. Use a dedicated LLM provider (openai, anthropic, google, etc.) for generateText/streamText.
  3. Combine providers: Cartesia for speech, another provider for text.

Example fix

// before
await generateText({ model: cartesia('sonic-2') });

// after
await generateText({ model: openai('gpt-4o') });
const audio = await generateSpeech({ model: cartesia.speech('sonic-2'), text: 'Hello' });
Defensive patterns

Strategy: validation

Validate before calling

const supportsText = 'languageModel' in cartesia && !(cartesia as any).__noLLM;
// Simply: never use cartesia(...) / cartesia.languageModel(...); use cartesia.speech(...) or cartesia.experimental_realtime(...).

Try / catch

try {
  await generateText({ model: cartesia('sonic-2') });
} catch (e) {
  if (NoSuchModelError.isInstance(e)) {
    console.error('Use cartesia.speech(modelId) or another provider for LLMs.');
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling cartesia('some-id'), cartesia.languageModel(id), cartesia.textEmbeddingModel-like LLM lookups, or passing the provider where a LanguageModel is expected (generateText, streamText, ToolLoopAgent, etc.).

Common situations: Mistaking Cartesia for an LLM provider because it appears in the provider list; copy-pasting provider setup code and swapping only the package name.

Related errors


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