Implementation:Helicone Helicone Unified Provider Registry
| Knowledge Sources | |
|---|---|
| Domains | Provider Integration, AI Gateway, Configuration |
| Last Updated | 2026-02-14 06:32 GMT |
Overview
A centralized registry of LLM provider API configurations that maps each supported provider to its base URL, authentication format, default endpoint template, body mapper, and required environment variables.
Description
The providers.ts module defines providerConfigs, a record mapping each Provider (OpenAI, Azure, Anthropic, Bedrock, Google Gemini, Google Vertex AI, OpenRouter, DeepSeek) to a ProviderConfig object. Each configuration includes:
- baseUrl: The provider's API base URL, potentially containing placeholder tokens like
{REGION},{ENDPOINT}, or{DEPLOYMENT} - authHeaderConfig: The authentication header name and optional value prefix (e.g.,
Authorization: Bearervsx-api-key) - defaultMapper: The body mapper name for request/response transformation (e.g.,
"openai-chat","anthropic-chat","gemini-chat") - defaultEndpoint: The API endpoint path template
- envVars: Required environment variable names for authentication
- defaultHeaders: Optional static headers (e.g., Anthropic's
anthropic-version)
The module exports getProviderConfig for simple lookups and buildProviderUrl for constructing fully resolved URLs by replacing placeholder tokens ({REGION}, {PROJECT}, {LOCATION}, {ENDPOINT}, {DEPLOYMENT}, {modelString}) with provided values.
Usage
Use this module when constructing API requests to any supported LLM provider, particularly in the playground and unified model layer.
Code Reference
Source Location
- Repository: Helicone
- File: packages/cost/unified/providers.ts
Signature
export const providerConfigs: Record<Provider, ProviderConfig>
export function getProviderConfig(provider: Provider): ProviderConfig
export function buildProviderUrl(
provider: Provider,
modelString?: string,
providerSettings?: {
region?: string;
project?: string;
location?: string;
endpoint?: string;
deployment?: string;
}
): string
Import
import {
providerConfigs,
getProviderConfig,
buildProviderUrl,
} from "@helicone/cost/unified/providers";
I/O Contract
| Provider | Base URL | Auth Header | Default Mapper | Default Endpoint |
|---|---|---|---|---|
| OPENAI | https://api.openai.com
|
Authorization: Bearer
|
openai-chat | /v1/chat/completions
|
| AZURE | https://{ENDPOINT}/openai/deployments/{DEPLOYMENT}
|
api-key
|
openai-chat | /chat/completions?api-version=2024-10-21
|
| ANTHROPIC | https://api.anthropic.com
|
x-api-key
|
anthropic-chat | /v1/messages
|
| BEDROCK | https://bedrock-runtime.{REGION}.amazonaws.com
|
Authorization
|
anthropic-chat | /model/{modelString}/invoke
|
| GOOGLE_GEMINI | https://generativelanguage.googleapis.com
|
x-goog-api-key
|
gemini-chat | /v1beta/models/{modelString}:generateContent
|
| GOOGLE_VERTEXAI | https://{REGION}-aiplatform.googleapis.com
|
Authorization: Bearer
|
gemini-chat | /v1/projects/{PROJECT}/locations/{LOCATION}/publishers/google/models/{modelString}:generateContent
|
| OPENROUTER | https://api.openrouter.ai
|
Authorization: Bearer
|
openai-chat | /api/v1/chat/completions
|
| DEEPSEEK | https://api.deepseek.com
|
Authorization: Bearer
|
openai-chat | /chat/completions
|
| Function | Parameters | Returns | Description |
|---|---|---|---|
getProviderConfig
|
provider: Provider
|
ProviderConfig
|
Returns the full configuration for a provider |
buildProviderUrl
|
provider: Provider, modelString?: string, providerSettings?: object
|
string
|
Constructs a fully resolved URL with all placeholders replaced |
Usage Examples
import { getProviderConfig, buildProviderUrl } from "@helicone/cost/unified/providers";
// Get OpenAI config
const config = getProviderConfig("OPENAI");
console.log(config.baseUrl); // "https://api.openai.com"
console.log(config.defaultEndpoint); // "/v1/chat/completions"
// Build a Vertex AI URL with all placeholders resolved
const url = buildProviderUrl("GOOGLE_VERTEXAI", "gemini-pro", {
region: "us-central1",
project: "my-project",
location: "us-central1",
});
// "https://us-central1-aiplatform.googleapis.com/v1/projects/my-project/locations/us-central1/publishers/google/models/gemini-pro:generateContent"
// Build an Azure URL
const azureUrl = buildProviderUrl("AZURE", undefined, {
endpoint: "my-resource.openai.azure.com",
deployment: "gpt-4-deployment",
});
// "https://my-resource.openai.azure.com/openai/deployments/gpt-4-deployment/chat/completions?api-version=2024-10-21"