Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rlm/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def get_client(

backend_kwargs.setdefault("base_url", "https://openrouter.ai/api/v1")
return OpenAIClient(**backend_kwargs)
elif backend == "vercel":
from rlm.clients.openai import OpenAIClient

backend_kwargs.setdefault("base_url", "https://ai-gateway.vercel.sh/v1")
return OpenAIClient(**backend_kwargs)
elif backend == "litellm":
from rlm.clients.litellm import LiteLLMClient

Expand All @@ -54,5 +59,5 @@ def get_client(
return AzureOpenAIClient(**backend_kwargs)
else:
raise ValueError(
f"Unknown backend: {backend}. Supported backends: ['openai', 'vllm', 'portkey', 'openrouter', 'litellm', 'anthropic', 'azure_openai', 'gemini']"
f"Unknown backend: {backend}. Supported backends: ['openai', 'vllm', 'portkey', 'openrouter', 'litellm', 'anthropic', 'azure_openai', 'gemini', 'vercel']"
)
3 changes: 3 additions & 0 deletions rlm/clients/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# Load API keys from environment variables
DEFAULT_OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
DEFAULT_OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY")
DEFAULT_VERCEL_API_KEY = os.getenv("AI_GATEWAY_API_KEY")
DEFAULT_PRIME_INTELLECT_BASE_URL = "https://api.pinference.ai/api/v1/"


Expand All @@ -35,6 +36,8 @@ def __init__(
api_key = DEFAULT_OPENAI_API_KEY
elif base_url == "https://openrouter.ai/api/v1":
api_key = DEFAULT_OPENROUTER_API_KEY
elif base_url == "https://ai-gateway.vercel.sh/v1":
api_key = DEFAULT_VERCEL_API_KEY

# For vLLM, set base_url to local vLLM server address.
self.client = openai.OpenAI(api_key=api_key, base_url=base_url)
Expand Down
10 changes: 9 additions & 1 deletion rlm/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
from typing import Any, Literal

ClientBackend = Literal[
"openai", "portkey", "openrouter", "vllm", "litellm", "anthropic", "azure_openai", "gemini"
"openai",
"portkey",
"openrouter",
"vercel",
"vllm",
"litellm",
"anthropic",
"azure_openai",
"gemini",
]
EnvironmentType = Literal["local", "prime", "modal"]

Expand Down