{"record":{"id":"c197a5edeb4f4f3b","repo":"vercel/ai","slug":"imagemodel-c197a5","errorCode":null,"errorMessage":"imageModel","messagePattern":"imageModel","errorType":"exception","errorClass":"NoSuchModelError","httpStatus":null,"severity":"error","filePath":"packages/deepseek/src/deepseek-provider.ts","lineNumber":120,"sourceCode":"      baseURL,\n      headers: getHeaders,\n      fetch: options.fetch,\n    });\n\n  const provider = (modelId: DeepSeekChatModelId) =>\n    createLanguageModel(modelId);\n\n  provider.specificationVersion = 'v4' as const;\n  provider.languageModel = createLanguageModel;\n  provider.chat = createLanguageModel;\n  provider.files = createFiles;\n\n  provider.embeddingModel = (modelId: string) => {\n    throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n  };\n  provider.textEmbeddingModel = provider.embeddingModel;\n  provider.imageModel = (modelId: string) => {\n    throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n  };\n\n  return provider;\n}\n\nexport const deepSeek = createDeepSeek();\n","sourceCodeStart":102,"sourceCodeEnd":127,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/deepseek/src/deepseek-provider.ts#L102-L127","documentation":"The DeepSeek provider does not support image models; its imageModel factory unconditionally throws NoSuchModelError with modelType 'imageModel'. DeepSeek offers no image generation API, so the stub enforces that contract loudly.","triggerScenarios":"Calling generateImage() with a DeepSeek model, or calling deepseek.imageModel('some-id') directly.","commonSituations":"Generic multi-provider pipelines that route image generation to whichever provider is configured, or developers exploring the provider API assuming image support exists.","solutions":["Use an image-capable provider for generateImage (e.g. @ai-sdk/openai with dall-e/gpt-image, @ai-sdk/google, @ai-sdk/amazon-bedrock).","Configure a dedicated image provider separate from the chat provider.","Guard image-generation code paths to check provider support before resolving the model."],"exampleFix":"// before\nawait generateImage({ model: deepseek.imageModel('img'), prompt });\n\n// after\nimport { createOpenAI } from '@ai-sdk/openai';\nconst openai = createOpenAI({ apiKey: openaiKey });\nawait generateImage({ model: openai.image('gpt-image-1'), prompt });","handlingStrategy":"validation","validationCode":"function supportsImages(provider: unknown): boolean {\n  return typeof (provider as any)?.imageModel === 'function' &&\n    !/deepseek/i.test((provider as any)?.provider ?? '');\n}","typeGuard":"function isImageCapable(p: any): p is { imageModel: (id: string) => unknown } {\n  return typeof p?.imageModel === 'function';\n}","tryCatchPattern":"try {\n  await generateImage({ model: provider.imageModel(id), prompt });\n} catch (e) {\n  if (NoSuchModelError.isInstance(e) && e.modelType === 'imageModel') {\n    throw new Error('DeepSeek cannot generate images; use an image provider.');\n  }\n  throw e;\n}","preventionTips":["Route image generation only to providers documented as image-capable.","Maintain a capability map in config rather than one provider for all tasks.","Add unit tests asserting which model types each configured provider supports."],"tags":["provider-capability","image-generation","no-such-model"],"backgroundTag":"provider-does-not-support-model-type","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}