vercel/ai · error · Error
The Cohere model function cannot be called with the new keyw
Error message
The Cohere model function cannot be called with the new keyword.
What it means
Error "The Cohere model function cannot be called with the new keyword." thrown in vercel/ai.
Source
Thrown at packages/cohere/src/cohere-provider.ts:141
const createEmbeddingModel = (modelId: CohereEmbeddingModelId) =>
new CohereEmbeddingModel(modelId, {
provider: 'cohere.textEmbedding',
baseURL,
headers: getHeaders,
fetch: options.fetch,
});
const createRerankingModel = (modelId: CohereRerankingModelId) =>
new CohereRerankingModel(modelId, {
provider: 'cohere.reranking',
baseURL,
headers: getHeaders,
fetch: options.fetch,
});
const provider = function (modelId: CohereChatModelId) {
if (new.target) {
throw new Error(
'The Cohere model function cannot be called with the new keyword.',
);
}
return createChatModel(modelId);
};
provider.specificationVersion = 'v4' as const;
provider.languageModel = createChatModel;
provider.embedding = createEmbeddingModel;
provider.embeddingModel = createEmbeddingModel;
provider.textEmbedding = createEmbeddingModel;
provider.textEmbeddingModel = createEmbeddingModel;
provider.reranking = createRerankingModel;
provider.rerankingModel = createRerankingModel;
provider.imageModel = (modelId: string) => {
throw new NoSuchModelError({ modelId, modelType: 'imageModel' });View on GitHub (pinned to 69428b1f8b)
When it happens
Trigger: Thrown at packages/cohere/src/cohere-provider.ts:141 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/49ffc229cee455e8.
Report an issue: GitHub.