{"record":{"id":"1790d142ab564b96","repo":"vercel/ai","slug":"no-such-embeddingmodel-modelid-1790d1","errorCode":null,"errorMessage":"No such embeddingModel: ${modelId}","messagePattern":"No such embeddingModel: (.+?)","errorType":"exception","errorClass":"NoSuchModelError","httpStatus":null,"severity":"error","filePath":"packages/zai/src/zai-provider.ts","lineNumber":93,"sourceCode":"      `ai-sdk/zai/${VERSION}`,\n    );\n\n  const createLanguageModel = (modelId: ZaiChatModelId) =>\n    new ZaiChatLanguageModel(modelId, {\n      provider: 'zai.chat',\n      baseURL,\n      headers: getHeaders,\n      fetch: options.fetch,\n    });\n\n  const provider = (modelId: ZaiChatModelId) => createLanguageModel(modelId);\n\n  provider.specificationVersion = 'v4' as const;\n  provider.languageModel = createLanguageModel;\n  provider.chat = createLanguageModel;\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 zai = createZai();\n","sourceCodeStart":75,"sourceCodeEnd":104,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/zai/src/zai-provider.ts#L75-L104","documentation":"The z.ai (Zhipu) provider does not implement embedding models; its embeddingModel/textEmbeddingModel factories unconditionally throw NoSuchModelError with modelType 'embeddingModel'. Any attempt to obtain an embedding model from @ai-sdk/zai triggers this, since the provider only supports language models.","triggerScenarios":"zai.embeddingModel('embedding-3') or zai.textEmbeddingModel('...') called directly; embed()/embedMany() with model: zai('some-model'); generic provider-selection code mapping 'zai' to an embedding request.","commonSituations":"Assuming every AI SDK provider supports embeddings; migrating an embedding pipeline from openai/mistral to zai; capability-agnostic model factory code in multi-provider apps.","solutions":["Use a provider with embedding support (e.g. @ai-sdk/openai textEmbeddingModel) for embed/embedMany.","Keep zai for chat/language models only and split your model configuration by capability.","Add an explicit capability check or registry so embedding requests never route to zai."],"exampleFix":"// before\nconst { embedding } = await embed({ model: zai.textEmbeddingModel('embedding-3'), value });\n\n// after\nimport { createOpenAI } from '@ai-sdk/openai';\nconst openai = createOpenAI();\nconst { embedding } = await embed({ model: openai.textEmbeddingModel('text-embedding-3-small'), value });","handlingStrategy":"fallback","validationCode":"const ZAI_SUPPORTS_EMBEDDINGS = false;\nfunction getEmbeddingModel(preferred: 'zai' | 'openai') {\n  return preferred === 'zai' && !ZAI_SUPPORTS_EMBEDDINGS\n    ? openai.textEmbeddingModel('text-embedding-3-small')\n    : /* other */ null;\n}","typeGuard":"function supportsEmbeddings(provider: any): boolean {\n  return typeof provider?.textEmbeddingModel === 'function' && provider.specificationVersion != null &&\n    !/NoSuchModelError/.test(provider.textEmbeddingModel.toString());\n}","tryCatchPattern":"try {\n  return await embed({ model: zai.textEmbeddingModel(id), value });\n} catch (e) {\n  if (NoSuchModelError.isInstance(e)) {\n    return await embed({ model: openai.textEmbeddingModel('text-embedding-3-small'), value });\n  }\n  throw e;\n}","preventionTips":["Route embedding workloads only to providers that document embedding support.","Maintain a provider capability matrix in your app config.","Add compile-time narrowing: never accept `zai` as an embedding model source in your wrapper's types."],"tags":["zai","embeddings","no-such-model","provider-capability"],"backgroundTag":"model-not-supported-by-provider","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}