Implementation:Helicone Helicone ModelProviderConfig
| Knowledge Sources | |
|---|---|
| Domains | Model Registry, Pricing, TypeScript |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
Concrete TypeScript interface and endpoint definition pattern for per-model-per-provider pricing and deployment configuration, provided by the packages/cost/models/types.ts module and exemplified by packages/cost/models/authors/*/endpoints.ts files.
Description
The ModelProviderConfig interface defines the full specification for a model served by a particular provider. It extends BaseConfig (which provides pricing, context length, max completion tokens, PTB enablement, version, and unsupported parameters) with provider-specific fields: the provider's model ID string, provider name, author, supported parameters, optional plugin support, rate limits, a map of endpoint deployment configurations, and flags for cross-region support, priority, quantization, response format, explicit routing, and model ID aliases.
The ModelPricing interface within each configuration defines a single pricing tier with threshold, input and output token rates, optional cache multipliers (cached input fraction, 5-minute write premium, 1-hour write premium), cache storage per hour, thinking token rate, per-request fee, per-modality pricing (image, audio, video, file), and web search cost.
Endpoint definitions are stored in endpoints.ts files within the author/model directory structure. Each file exports an endpoints object keyed by "modelName:providerName" composite strings, with values conforming to ModelProviderConfig. The TypeScript satisfies operator is used to enforce type safety while preserving literal types for key inference.
Usage
Use these types and patterns when:
- Adding a new model's provider-specific configuration
- Updating pricing tiers for an existing model-provider combination
- Adding regional deployment endpoints to an existing configuration
- Declaring parameter or plugin support for a model-provider pair
Code Reference
Source Location
- Repository: Helicone
- File:
packages/cost/models/types.ts(lines 132-219) - Example:
packages/cost/models/authors/anthropic/claude-opus-4/endpoints.ts
Signature
export interface ModelPricing {
threshold: number;
input: number;
output: number;
cacheMultipliers?: {
cachedInput: number;
write5m?: number;
write1h?: number;
};
cacheStoragePerHour?: number;
thinking?: number;
request?: number;
image?: ModalityPricing;
audio?: ModalityPricing;
video?: ModalityPricing;
file?: ModalityPricing;
web_search?: number;
}
export interface ModelProviderConfig extends BaseConfig {
providerModelId: string;
provider: ModelProviderName;
author: AuthorName;
supportedParameters: StandardParameter[];
supportedPlugins?: PluginId[];
rateLimits?: RateLimits;
endpointConfigs: Record<string, EndpointConfig>;
crossRegion?: boolean;
priority?: number;
quantization?: "fp4" | "fp8" | "fp16" | "bf16" | "int4";
responseFormat?: ResponseFormat;
requireExplicitRouting?: boolean;
providerModelIdAliases?: string[];
}
export interface EndpointConfig extends UserEndpointConfig {
providerModelId?: string;
pricing?: ModelPricing[];
contextLength?: number;
maxCompletionTokens?: number;
ptbEnabled?: boolean;
version?: string;
rateLimits?: RateLimits;
priority?: number;
}
Import
import type { ModelProviderConfig, ModelPricing, EndpointConfig } from "packages/cost/models/types";
import type { ModelProviderName } from "packages/cost/models/providers";
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| providerModelId | string |
Yes | The provider-specific model identifier (e.g., "claude-opus-4-20250514" for Anthropic, "anthropic.claude-opus-4-20250514-v1:0" for Bedrock)
|
| provider | ModelProviderName |
Yes | The canonical provider name from the provider registry |
| author | AuthorName |
Yes | The model author's identifier |
| pricing | ModelPricing[] |
Yes | Array of pricing tiers ordered by threshold |
| contextLength | number |
Yes | Context window size in tokens for this provider's deployment |
| maxCompletionTokens | number |
Yes | Maximum output tokens for this provider's deployment |
| ptbEnabled | boolean |
Yes | Whether this configuration is enabled for PTB (Provider Token Billing) routing |
| supportedParameters | StandardParameter[] |
Yes | Which API parameters this model-provider combination supports |
| endpointConfigs | Record<string, EndpointConfig> |
Yes | Map of deployment region/ID to per-deployment overrides; use "*" for a single global endpoint
|
Outputs
| Name | Type | Description |
|---|---|---|
| endpoints | Record<string, ModelProviderConfig> |
The exported object from each endpoints.ts file, keyed by "modelName:providerName" composite strings
|
Usage Examples
Basic Usage
import { ModelProviderName } from "../../../providers";
import type { ModelProviderConfig } from "../../../types";
// Define endpoints for a model across multiple providers
export const endpoints = {
"claude-opus-4:anthropic": {
providerModelId: "claude-opus-4-20250514",
provider: "anthropic",
author: "anthropic",
version: "20250514",
pricing: [
{
threshold: 0,
input: 0.000015, // $15 per 1M input tokens
output: 0.000075, // $75 per 1M output tokens
web_search: 0.01, // $10 per 1K searches
cacheMultipliers: {
cachedInput: 0.1, // 10% of input rate
write5m: 1.25, // 125% of input rate
write1h: 2.0, // 200% of input rate
},
},
],
contextLength: 200000,
maxCompletionTokens: 32000,
supportedParameters: [
"max_tokens", "temperature", "stop",
"reasoning", "include_reasoning",
"tools", "tool_choice",
],
supportedPlugins: ["web"],
ptbEnabled: true,
responseFormat: "ANTHROPIC",
endpointConfigs: {
"*": {}, // Single global endpoint
},
},
"claude-opus-4:bedrock": {
provider: "bedrock",
author: "anthropic",
providerModelId: "anthropic.claude-opus-4-20250514-v1:0",
crossRegion: true,
pricing: [
{
threshold: 0,
input: 0.000015,
output: 0.000075,
cacheMultipliers: { cachedInput: 0.1, write5m: 1.25 },
},
],
contextLength: 200000,
maxCompletionTokens: 32000,
supportedParameters: [
"max_tokens", "temperature", "stop",
"reasoning", "include_reasoning",
"tools", "tool_choice", "top_p", "top_k",
],
ptbEnabled: true,
responseFormat: "ANTHROPIC",
endpointConfigs: {
"us-east-1": {}, // Region-specific endpoint
},
},
} satisfies Partial<
Record<`${"claude-opus-4"}:${ModelProviderName}`, ModelProviderConfig>
>;