vercel/ai · error · NoSuchModelError

LMNT does not provide language models

Error message

LMNT does not provide language models

What it means

LMNT is a speech (TTS) provider only. Its provider object wires languageModel to a function that always throws NoSuchModelError with this message, so any attempt to load a language model from the LMNT provider fails immediately with the requested modelId echoed back.

Source

Thrown at packages/lmnt/src/lmnt-provider.ts:83

    new LMNTSpeechModel(modelId, {
      provider: `lmnt.speech`,
      url: ({ path }) => `https://api.lmnt.com${path}`,
      headers: getHeaders,
      fetch: options.fetch,
    });

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

  provider.specificationVersion = 'v4' as const;
  provider.speech = createSpeechModel;
  provider.speechModel = createSpeechModel;

  provider.languageModel = (modelId: string) => {
    throw new NoSuchModelError({
      modelId,
      modelType: 'languageModel',
      message: 'LMNT does not provide language models',
    });
  };

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

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

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use the provider's speech API instead: lmnt.speech(modelId) or lmnt.speechModel(modelId)
  2. Use a text-capable provider (openai, anthropic, etc.) for languageModel slots
  3. Check your model registry/config so LMNT is only mapped to speech endpoints

Example fix

// before
const result = await generateText({ model: lmnt('lmnt-model'), prompt: 'hi' });
// after
const result = await generateText({ model: openai('gpt-4o'), prompt: 'hi' });
const audio = await generateSpeech({ model: lmnt.speech('aurora'), text: 'hello' });
Defensive patterns

Strategy: type-guard

Validate before calling

// pick a provider that actually has language models
const languageModel = providerIsLMNT(configuredProvider)
  ? openai('gpt-4o')
  : configuredProvider(modelId);

Type guard

function isLMNT(p: unknown): boolean {
  return typeof p === 'function' && p === lmnt;
}
// or narrow by capability:
function hasLanguageModel(p: any): boolean {
  try { p.languageModel?.('probe'); return true; } catch { return false; }
}

Try / catch

try {
  await generateText({ model: lmnt(modelId), prompt });
} catch (e) {
  if (NoSuchModelError.isInstance(e) && e.modelType === 'languageModel') {
    // switch to a text provider or lmnt.speech(modelId)
  } else throw e;
}

Prevention

When it happens

Trigger: Calling lmnt('some-model-id') as a language model, e.g. lmnt.languageModel('x') or passing the LMNT provider where a LanguageModel is expected in generateText/streamText.

Common situations: Mistaking LMNT for a full-model provider, copy-pasting provider setup from OpenAI examples, or a registry/config wiring lmnt into the wrong model slot.

Related errors


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