Skip to content

Conversation

@Kylejeong2
Copy link
Member

@Kylejeong2 Kylejeong2 commented Jan 28, 2026

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.

  • New Features
    • Registered gateway and createGateway in AISDKProviders and AISDKProvidersWithAPIKey.

Written for commit d93762a. Summary will update on new commits. Review in cubic

@changeset-bot
Copy link

changeset-bot bot commented Jan 28, 2026

⚠️ No Changeset found

Latest commit: d93762a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

This PR adds support for Vercel AI Gateway as an LLM provider. The implementation adds gateway and createGateway imports from the "ai" package (Vercel AI SDK v5) and registers them in both the default provider map (AISDKProviders) and the custom provider map (AISDKProvidersWithAPIKey).

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 gateway/model-name with optional client configuration. The gateway provider will route requests through Vercel's AI Gateway infrastructure, enabling access to newer open source models that may not have dedicated inference providers.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change adds exactly 3 lines following the established pattern used by all other AI SDK providers in the codebase. The implementation is consistent with recent similar additions (ollama, perplexity, deepseek). No logical errors, security issues, or breaking changes introduced.
  • No files require special attention

Important Files Changed

Filename Overview
packages/core/lib/v3/llm/LLMProvider.ts Added Vercel AI Gateway support by importing gateway and createGateway from ai package and registering them in provider maps

Sequence Diagram

sequenceDiagram
    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
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

Edit Code Review Agent Settings | Greptile

cubic-dev-ai[bot]

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants