fix rb ai gateway integration

This commit is contained in:
Ramnique Singh 2025-12-01 11:59:13 +05:30
parent 8feb4f1425
commit ab617e63b5
9 changed files with 165 additions and 81 deletions

View file

@ -1,4 +1,5 @@
import { ProviderV2 } from "@ai-sdk/provider";
import { createGateway } from "ai";
import { createOpenAI } from "@ai-sdk/openai";
import { createGoogleGenerativeAI } from "@ai-sdk/google";
import { createAnthropic } from "@ai-sdk/anthropic";
@ -28,9 +29,9 @@ export async function getProvider(name: string = ""): Promise<ProviderV2> {
const { apiKey, baseURL, headers } = providerConfig;
switch (providerConfig.flavor) {
case "rowboat [free]":
providerMap[name] = createOpenAICompatible({
name: "rowboat [free]",
baseURL: "https://ai-gateway.rowboatlabs.com/v1",
providerMap[name] = createGateway({
apiKey: "rowboatx",
baseURL: "https://ai-gateway.rowboatlabs.com/v1/ai",
});
break;
case "openai":
@ -40,6 +41,13 @@ export async function getProvider(name: string = ""): Promise<ProviderV2> {
headers,
});
break;
case "aigateway":
providerMap[name] = createGateway({
apiKey,
baseURL,
headers
});
break;
case "anthropic":
providerMap[name] = createAnthropic({
apiKey,
@ -65,7 +73,7 @@ export async function getProvider(name: string = ""): Promise<ProviderV2> {
name,
apiKey,
baseURL : baseURL || "",
headers
headers,
});
break;
case "openrouter":