You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Support non-factory LanguageModelV2 class exports in dynamic provider loader #16793
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
The dynamic provider loader only recognizes npm packages that export a create* factory. Some packages (e.g. @augmentcode/auggie-sdk) export a LanguageModelV2 class directly — no factory wrapper. These fail to load.
Proposal: add a fallback that duck-types LanguageModelV2 classes (doGenerate + doStream on prototype) and wraps them in a minimal provider object. The create* path stays preferred; class detection is the fallback.
Constructor convention: Every standard Vercel AI SDK provider uses (modelId, config) as the constructor signature:
SDK
Class
Constructor
@ai-sdk/anthropic
AnthropicMessagesLanguageModel
(modelId, config)
@ai-sdk/openai
OpenAIChatLanguageModel
(modelId, config)
@ai-sdk/google
GoogleGenerativeAILanguageModel
(modelId, config)
@ai-sdk/openai-compatible
OpenAICompatibleChatLanguageModel
(modelId, config)
@gitlab/gitlab-ai-provider
GitLabAnthropicLanguageModel
(modelId, config)
@augmentcode/auggie-sdk
AugmentLanguageModel
(modelId, config)
@openrouter/ai-sdk-provider
OpenRouterChatLanguageModel
(modelId, settings, config)⚠️
ai-gateway-provider
AiGatewayChatLanguageModel
(models[], config)⚠️
The two outliers (OpenRouter, ai-gateway-provider) both export create* factories, so the class fallback would never trigger for them. Function.length can be used as a runtime guard to reject constructors that don't take exactly 2 args.
This unblocks Augment Code support (#10216) and future-proofs the loader for any SDK that ships a raw LanguageModelV2 without a factory.
Activity
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.