vercel/ai · error · NoSuchModelError

LMNT does not provide image models

Error message

LMNT does not provide image models

What it means

LMNT does not offer image generation; its imageModel accessor unconditionally throws NoSuchModelError with this message. The provider deliberately rejects image-model requests to surface the capability mismatch clearly.

Source

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

  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',
      message: 'LMNT does not provide image models',
    });
  };

  return provider as LMNTProvider;
}

/**
 * Default LMNT provider instance.
 */
export const lmnt = createLMNT();

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use an image-capable provider (openai.image, luma.image, etc.) for generateImage
  2. Reserve LMNT for TTS via lmnt.speech(modelId)
  3. Correct any config/registry entries mapping LMNT to image endpoints

Example fix

// before
const { image } = await generateImage({ model: lmnt.imageModel('x'), prompt: 'cat' });
// after
const { image } = await generateImage({ model: luma.image('photon-1'), prompt: 'cat' });
Defensive patterns

Strategy: type-guard

Validate before calling

// ensure the image provider supports images
if (providerIsLMNT(imageProvider)) {
  imageProvider = luma.image('photon-1');
}

Type guard

function supportsImages(p: any): boolean {
  try { p.imageModel?.('probe'); return true; } catch { return false; }
}

Try / catch

try {
  await generateImage({ model: lmnt.imageModel(id), prompt });
} catch (e) {
  if (NoSuchModelError.isInstance(e) && e.modelType === 'imageModel') {
    // fall back to an image-capable provider
  } else throw e;
}

Prevention

When it happens

Trigger: Calling lmnt.imageModel('some-model') or passing LMNT where an ImageModel is expected, e.g. in generateImage.

Common situations: Wiring LMNT into an image slot in a model registry, or assuming one provider handles all modalities after switching providers in example code.

Related errors


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