-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: adding AI Gateway support #1627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: adding AI Gateway support #1627
Conversation
|
Greptile OverviewGreptile SummaryThis PR adds support for Vercel AI Gateway as an LLM provider. The implementation adds The change follows the established pattern used by other AI SDK providers like ollama, perplexity, and deepseek. Users can now specify models using the format Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant LLMProvider
participant getAISDKLanguageModel
participant AIGateway as AI Gateway (gateway/createGateway)
participant Model as Language Model
User->>LLMProvider: getClient("gateway/model-name", clientOptions)
LLMProvider->>LLMProvider: detect "/" in modelName
LLMProvider->>LLMProvider: extract subProvider="gateway", subModelName="model-name"
LLMProvider->>getAISDKLanguageModel: (subProvider, subModelName, clientOptions)
alt clientOptions has valid values
getAISDKLanguageModel->>AIGateway: createGateway(clientOptions)
AIGateway-->>getAISDKLanguageModel: provider function
getAISDKLanguageModel->>AIGateway: provider(subModelName)
AIGateway-->>getAISDKLanguageModel: LanguageModelV2
else no valid clientOptions
getAISDKLanguageModel->>AIGateway: gateway(subModelName)
AIGateway-->>getAISDKLanguageModel: LanguageModelV2
end
getAISDKLanguageModel-->>LLMProvider: LanguageModelV2
LLMProvider->>LLMProvider: new AISdkClient(model, logger)
LLMProvider-->>User: LLMClient instance
User->>Model: Make API calls through gateway
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
why
New open source models are released, and don't necessarily have a great inference provider at all times. Seeing as we're already using the AI-SDK, it makes sense to add support for the AI Gateway.
what changed
Added Vercel AI Gateway as a provider to the llm providers list.
test plan
Testing with Evals
Summary by cubic
Adds Vercel AI Gateway as a provider in LLMProvider so model calls can route through the gateway, making it easier to support new/open-source models.
Written for commit d93762a. Summary will update on new commits. Review in cubic