Langfuse JS/TS SDKs
    Preparing search index...

    Interface Model

    Model definition used for transforming usage into USD cost and/or tokenization.

    Models can have either simple flat pricing or tiered pricing:

    • Flat pricing: Single price per usage type (legacy, but still supported)
    • Tiered pricing: Multiple pricing tiers with conditional matching based on usage patterns

    The pricing tiers approach is recommended for models with usage-based pricing variations. When using tiered pricing, the flat price fields (inputPrice, outputPrice, prices) are populated from the default tier for backward compatibility.

    interface Model {
        createdAt: string;
        id: string;
        inputPrice?: number;
        isLangfuseManaged: boolean;
        matchPattern: string;
        modelName: string;
        outputPrice?: number;
        prices: Record<string, ModelPrice>;
        pricingTiers: PricingTier[];
        startDate?: string;
        tokenizerConfig?: unknown;
        tokenizerId?: string;
        totalPrice?: number;
        unit?: ModelUsageUnit;
    }
    Index

    Properties

    createdAt: string

    Timestamp when the model was created

    id: string
    inputPrice?: number

    Deprecated. See 'prices' instead. Price (USD) per input unit

    isLangfuseManaged: boolean
    matchPattern: string

    Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use (?i)^modelname$

    modelName: string

    Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime

    outputPrice?: number

    Deprecated. See 'prices' instead. Price (USD) per output unit

    prices: Record<string, ModelPrice>

    Deprecated. Use 'pricingTiers' instead for models with usage-based pricing variations.

    This field shows prices by usage type from the default pricing tier. Maintained for backward compatibility. If the model uses tiered pricing, this field will be populated from the default tier's prices.

    pricingTiers: PricingTier[]

    Array of pricing tiers with conditional pricing based on usage thresholds.

    Pricing tiers enable accurate cost tracking for models that charge different rates based on usage patterns (e.g., different rates for high-volume usage, large context windows, or cached tokens).

    Each model must have exactly one default tier (isDefault=true, priority=0) that serves as a fallback. Additional conditional tiers can be defined with specific matching criteria.

    If this array is empty, the model uses legacy flat pricing from the inputPrice/outputPrice/totalPrice fields.

    startDate?: string

    Apply only to generations which are newer than this ISO date.

    tokenizerConfig?: unknown

    Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.

    tokenizerId?: string

    Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.

    totalPrice?: number

    Deprecated. See 'prices' instead. Price (USD) per total unit. Cannot be set if input or output price is set.

    Unit used by this model.