vercel/ai · error · Error

The Groq model function cannot be called with the new keywor

Error message

The Groq model function cannot be called with the new keyword.

What it means

Error "The Groq model function cannot be called with the new keyword." thrown in vercel/ai.

Source

Thrown at packages/groq/src/groq-provider.ts:100

          environmentVariableName: 'GROQ_API_KEY',
          description: 'Groq',
        })}`,
        ...options.headers,
      },
      `ai-sdk/groq/${VERSION}`,
    );

  const createChatModel = (modelId: GroqChatModelId) =>
    new GroqChatLanguageModel(modelId, {
      provider: 'groq.chat',
      url: ({ path }) => `${baseURL}${path}`,
      headers: getHeaders,
      fetch: options.fetch,
    });

  const createLanguageModel = (modelId: GroqChatModelId) => {
    if (new.target) {
      throw new Error(
        'The Groq model function cannot be called with the new keyword.',
      );
    }

    return createChatModel(modelId);
  };

  const createTranscriptionModel = (modelId: GroqTranscriptionModelId) => {
    return new GroqTranscriptionModel(modelId, {
      provider: 'groq.transcription',
      url: ({ path }) => `${baseURL}${path}`,
      headers: getHeaders,
      fetch: options.fetch,
    });
  };

  const provider = function (modelId: GroqChatModelId) {
    return createLanguageModel(modelId);

View on GitHub (pinned to 69428b1f8b)

When it happens

Trigger: Thrown at packages/groq/src/groq-provider.ts:100 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/e0ef071bac332d88. Report an issue: GitHub.