{"record":{"id":"9b01fb2ede7a1d48","repo":"vercel/ai","slug":"the-anthropic-model-function-cannot-be-called-with-9b01fb","errorCode":null,"errorMessage":"The Anthropic model function cannot be called with the new keyword.","messagePattern":"The Anthropic model function cannot be called with the new keyword\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google-vertex/src/anthropic/google-vertex-anthropic-provider.ts","lineNumber":235,"sourceCode":"      transformRequestBody: args => {\n        // Remove model from args and add anthropic version\n        const { model: _model, ...rest } = args;\n        return {\n          ...rest,\n          anthropic_version: 'vertex-2023-10-16',\n        };\n      },\n      // Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion\n      supportedUrls: () => ({}),\n      // force the use of JSON tool fallback for structured outputs since beta header isn't supported\n      supportsNativeStructuredOutput: false,\n      // Vertex Anthropic doesn't support strict mode on tool definitions.\n      supportsStrictTools: false,\n    });\n\n  const provider = function (modelId: GoogleVertexAnthropicModelId) {\n    if (new.target) {\n      throw new Error(\n        'The Anthropic model function cannot be called with the new keyword.',\n      );\n    }\n\n    return createChatModel(modelId);\n  };\n\n  provider.specificationVersion = 'v4' as const;\n  provider.languageModel = createChatModel;\n  provider.chat = createChatModel;\n  provider.messages = createChatModel;\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' });","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/google-vertex/src/anthropic/google-vertex-anthropic-provider.ts#L217-L253","documentation":"Error \"The Anthropic model function cannot be called with the new keyword.\" thrown in vercel/ai.","triggerScenarios":"Thrown at packages/google-vertex/src/anthropic/google-vertex-anthropic-provider.ts:235 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}