{"record":{"id":"b2431171b0d02d60","repo":"vercel/ai","slug":"ai-nosuchmodelerror-b24311","errorCode":"AI_NoSuchModelError","errorMessage":"Cartesia does not provide language models","messagePattern":"Cartesia does not provide language models","errorType":"exception","errorClass":"NoSuchModelError","httpStatus":null,"severity":"error","filePath":"packages/cartesia/src/cartesia-provider.ts","lineNumber":168,"sourceCode":"    },\n  ) as RealtimeFactoryV4;\n\n  const provider = function (modelId: CartesiaSpeechModelId) {\n    return {\n      speech: createSpeechModel(modelId),\n    };\n  };\n\n  provider.specificationVersion = 'v4' as const;\n  provider.transcription = createTranscriptionModel;\n  provider.transcriptionModel = createTranscriptionModel;\n  provider.speech = createSpeechModel;\n  provider.speechModel = createSpeechModel;\n  provider.experimental_realtime = experimentalRealtimeFactory;\n\n  // Required ProviderV4 methods that are not supported\n  provider.languageModel = (modelId: string) => {\n    throw new NoSuchModelError({\n      modelId,\n      modelType: 'languageModel',\n      message: 'Cartesia does not provide language models',\n    });\n  };\n\n  provider.embeddingModel = (modelId: string) => {\n    throw new NoSuchModelError({\n      modelId,\n      modelType: 'embeddingModel',\n      message: 'Cartesia does not provide embedding models',\n    });\n  };\n  provider.textEmbeddingModel = provider.embeddingModel;\n\n  provider.imageModel = (modelId: string) => {\n    throw new NoSuchModelError({\n      modelId,","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/cartesia/src/cartesia-provider.ts#L150-L186","documentation":"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.","triggerScenarios":"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.).","commonSituations":"Mistaking Cartesia for an LLM provider because it appears in the provider list; copy-pasting provider setup code and swapping only the package name.","solutions":["Use cartesia.speech(modelId) for TTS or cartesia.experimental_realtime for realtime voice.","Use a dedicated LLM provider (openai, anthropic, google, etc.) for generateText/streamText.","Combine providers: Cartesia for speech, another provider for text."],"exampleFix":"// before\nawait generateText({ model: cartesia('sonic-2') });\n\n// after\nawait generateText({ model: openai('gpt-4o') });\nconst audio = await generateSpeech({ model: cartesia.speech('sonic-2'), text: 'Hello' });","handlingStrategy":"validation","validationCode":"const supportsText = 'languageModel' in cartesia && !(cartesia as any).__noLLM;\n// Simply: never use cartesia(...) / cartesia.languageModel(...); use cartesia.speech(...) or cartesia.experimental_realtime(...).","typeGuard":null,"tryCatchPattern":"try {\n  await generateText({ model: cartesia('sonic-2') });\n} catch (e) {\n  if (NoSuchModelError.isInstance(e)) {\n    console.error('Use cartesia.speech(modelId) or another provider for LLMs.');\n  }\n  throw e;\n}","preventionTips":["Remember Cartesia = speech + realtime only; pick an LLM provider for text generation.","Never pass the provider object itself as a model argument.","Add a unit test asserting provider capability expectations in your app bootstrap."],"tags":["provider-capability","wrong-model-type","configuration"],"backgroundTag":"no-such-language-model","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}