Skip to content

Conversation

@AVtheking
Copy link
Contributor

Background

With the baseURL of createAnthropic and createGoogleGenerativeAI, we can use some providers that offer Anthropic or Gemini-compatible APIs. Therefore, we hope to pass in a custom provider name to make it easier to identify specific providers in logging and error tracking.

Summary

Added support for custom provider name in google and anthropic

Manual Verification

Wrote eg with telemetery for both google and anthropic to test the custom provider names

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Related Issues

Fixes #9911

Copy link
Collaborator

@gr2m gr2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet another great PR 🥇 thank you Ankit!

* Custom provider name
* Defaults to 'anthropic.messages'.
*/
name?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼 Aligns with what we implemented for OpenAI

const createChatModel = (modelId: AnthropicMessagesModelId) =>
new AnthropicMessagesLanguageModel(modelId, {
provider: 'anthropic.messages',
provider: providerName,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we do provider: ${providerName}.messages` to align with what we do in the OpenAI provider?

provider: `${providerName}.chat`,

I'd say no because unlike OpenAI, Anthropic only has the messages model

@gr2m gr2m merged commit 1742445 into vercel:main Nov 9, 2025
26 of 27 checks passed
vercel-ai-sdk bot pushed a commit that referenced this pull request Nov 9, 2025
…er name for anthropic and google (#10091)

## Background
With the baseURL of createAnthropic and createGoogleGenerativeAI, we can
use some providers that offer Anthropic or Gemini-compatible APIs.
Therefore, we hope to pass in a custom provider name to make it easier
to identify specific providers in logging and error tracking.

## Summary

Added support for custom provider name in google and anthropic

## Manual Verification
Wrote eg with telemetery for both google and anthropic to test the
custom provider names

## Related Issues

Fixes #9911

Co-authored-by: Gregor Martynus <[email protected]>
@vercel-ai-sdk vercel-ai-sdk bot removed the backport label Nov 9, 2025
@vercel-ai-sdk
Copy link
Contributor

vercel-ai-sdk bot commented Nov 9, 2025

✅ Backport PR created: #10107

vercel-ai-sdk bot added a commit that referenced this pull request Nov 9, 2025
…tom provider name for anthropic and google (#10107)

This is an automated backport of #10091 to the release-v5.0 branch.

Co-authored-by: ANKIT VARSHNEY <[email protected]>
Co-authored-by: Gregor Martynus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support custom provider name for anthropic and google provider

2 participants