> This page is for NeMo Relay, version v1.0.0.
> For other versions, use one of these documentation indexes:
> - Latest (v0.11.2) (default): https://docs.nvidia.com/nemo/relay/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/relay/dev/llms.txt
> - v1.0.0: https://docs.nvidia.com/nemo/relay/v1.0.0/llms.txt
> - v0.11.2: https://docs.nvidia.com/nemo/relay/v0.11.2/llms.txt
> - v0.10.4: https://docs.nvidia.com/nemo/relay/v0.10.4/llms.txt
> - v0.9.4: https://docs.nvidia.com/nemo/relay/v0.9.4/llms.txt
> - v0.8.4: https://docs.nvidia.com/nemo/relay/v0.8.4/llms.txt

> For clean Markdown of any page, append .md to the page URL. For a task-oriented documentation index, fetch https://docs.nvidia.com/nemo/relay/llms.txt. Use the documentation version matching the installed NeMo Relay package: latest follows the latest stable release, vX.Y.Z identifies a retained release snapshot, and dev documents development changes. Preserve the selected version when following links; do not mix examples or API contracts from different versions. Fetch the relevant section's /llms.txt before individual pages instead of loading a complete version index.

# Model Pricing Helpers

> Model pricing plugin configuration helpers.

Generated from `crates/node/dist/model_pricing.d.ts`.

Import from `nemo-relay-node/model_pricing`.

Model pricing plugin configuration helpers.

## Interfaces

### `CacheWriteRate`

Prompt-cache write price for a duration in seconds, or the default price without `duration`.

```ts
export interface CacheWriteRate {
    duration?: number;
    per_million: number;
}
```

### `TokenPricingRates`

Token rates per million tokens.

```ts
export interface TokenPricingRates {
    input_per_million: number;
    output_per_million: number;
    cache_read_per_million?: number;
    cache_write_rates?: CacheWriteRate[];
}
```

### `PromptCachePricing`

Prompt-cache accounting for a catalog entry.

```ts
export interface PromptCachePricing {
    read_accounting?: 'included_in_prompt_tokens' | 'separate';
}
```

### `TokenRateTier`

One prompt-token threshold tier.

```ts
export interface TokenRateTier {
    min_prompt_tokens?: number;
    max_prompt_tokens?: number;
    rates: TokenPricingRates;
}
```

### `PromptTokenThresholdRateSchedule`

Token rate schedule selected by prompt-token thresholds.

```ts
export interface PromptTokenThresholdRateSchedule {
    type: 'prompt_token_threshold';
    applies_to?: 'full_request';
    tiers: TokenRateTier[];
}
```

### `ModelPricing`

One model pricing catalog entry.

```ts
export interface ModelPricing {
    provider: string;
    model_id: string;
    aliases?: string[];
    currency?: string;
    unit?: 'per_token' | 'per_request' | 'per_second' | 'gpu_hour';
    rates?: TokenPricingRates;
    rate_schedule?: PromptTokenThresholdRateSchedule | JsonObject;
    prompt_cache: PromptCachePricing;
    pricing_as_of: string;
    pricing_source: string;
}
```

### `PricingCatalog`

Inline pricing catalog.

```ts
export interface PricingCatalog {
    version?: number;
    entries: Array<ModelPricing | JsonObject>;
}
```

### `InlineSource`

Pricing source holding an inline catalog.

```ts
export interface InlineSource {
    type: 'inline';
    catalog: PricingCatalog | JsonObject;
}
```

### `FileSource`

Pricing source read from a JSON file.

```ts
export interface FileSource {
    type: 'file';
    path: string;
}
```

### `PricingConfig`

Model pricing config.

```ts
export interface PricingConfig {
    sources?: PricingSource[];
}
```

## Functions

### `defaultConfig`

Creates a default model pricing config with no sources.

```ts
export declare function defaultConfig(): PricingConfig;
```

### `tokenRates`

Creates token rates with defaults applied.

```ts
export declare function tokenRates(config?: Partial<TokenPricingRates>): TokenPricingRates;
```

### `promptCache`

Creates prompt-cache accounting with defaults applied.

```ts
export declare function promptCache(config?: Partial<PromptCachePricing>): PromptCachePricing;
```

### `tokenRateTier`

Creates one rate tier.

```ts
export declare function tokenRateTier(rates: TokenPricingRates, config?: Omit<Partial<TokenRateTier>, 'rates'>): TokenRateTier;
```

### `promptTokenThresholdRateSchedule`

Creates a rate schedule from tiers.

```ts
export declare function promptTokenThresholdRateSchedule(tiers?: TokenRateTier[], config?: Omit<Partial<PromptTokenThresholdRateSchedule>, 'type' | 'tiers'>): PromptTokenThresholdRateSchedule;
```

### `catalogEntry`

Creates one catalog entry with defaults applied.

```ts
export declare function catalogEntry(config: Omit<ModelPricing, 'prompt_cache'> & Partial<ModelPricing>): ModelPricing;
```

### `inlineCatalog`

Creates an inline catalog from entries.

```ts
export declare function inlineCatalog(entries?: Array<ModelPricing | JsonObject>, config?: Omit<Partial<PricingCatalog>, 'entries'>): PricingCatalog;
```

### `inlineSource`

Creates a pricing source from an inline catalog.

```ts
export declare function inlineSource(catalog: PricingCatalog | JsonObject): InlineSource;
```

### `fileSource`

Creates a pricing source from a JSON file path.

```ts
export declare function fileSource(path: string): FileSource;
```

### `pricingConfig`

Creates a model pricing config from sources in precedence order.

```ts
export declare function pricingConfig(sources?: PricingSource[]): PricingConfig;
```

### `ComponentSpec`

Wraps model pricing config as a plugin component.

```ts
export declare function ComponentSpec(config: PricingConfig, { enabled }?: {
    enabled?: boolean;
}): ComponentSpecFor<'pricing'>;
```

### `validateConfig`

Validates model pricing config without activating it.

```ts
export declare function validateConfig(config: PricingConfig | JsonObject): ConfigReport;
```

### `parseConfig`

Validates an untyped model pricing document and returns it as a config; throws on error diagnostics.

```ts
export declare function parseConfig(document: JsonObject): PricingConfig;
```

## Type Aliases

### `PricingSource`

Pricing source.

```ts
export type PricingSource = InlineSource | FileSource | JsonObject;
```

## Constants

### `PRICING_PLUGIN_KIND`

Plugin kind of the model pricing component.

```ts
export declare const PRICING_PLUGIN_KIND = "pricing";
```

## Re-exports

* `Json`