Class PricingTier.Builder

java.lang.Object
com.langfuse.client.resources.commons.types.PricingTier.Builder
All Implemented Interfaces:
PricingTier._FinalStage, PricingTier.IdStage, PricingTier.IsDefaultStage, PricingTier.NameStage, PricingTier.PriorityStage
Enclosing class:
PricingTier

  • Method Details

    • from

      public PricingTier.Builder from(PricingTier other)
      Specified by:
      from in interface PricingTier.IdStage
    • id

      public PricingTier.NameStage id(@NotNull String id)

      Unique identifier for the pricing tier

      Unique identifier for the pricing tier

      Specified by:
      id in interface PricingTier.IdStage
      Returns:
      Reference to this so that method calls can be chained together.
    • name

      public PricingTier.IsDefaultStage name(@NotNull String name)

      Name of the pricing tier for display and identification purposes.

      Examples: "Standard", "High Volume Tier", "Large Context", "Extended Context Tier"

      Name of the pricing tier for display and identification purposes.

      Examples: "Standard", "High Volume Tier", "Large Context", "Extended Context Tier"

      Specified by:
      name in interface PricingTier.NameStage
      Returns:
      Reference to this so that method calls can be chained together.
    • isDefault

      public PricingTier.PriorityStage isDefault(boolean isDefault)

      Whether this is the default tier. Every model must have exactly one default tier with priority 0 and no conditions.

      The default tier serves as a fallback when no conditional tiers match, ensuring cost calculation always succeeds. It typically represents the base pricing for standard usage patterns.

      Whether this is the default tier. Every model must have exactly one default tier with priority 0 and no conditions.

      The default tier serves as a fallback when no conditional tiers match, ensuring cost calculation always succeeds. It typically represents the base pricing for standard usage patterns.

      Specified by:
      isDefault in interface PricingTier.IsDefaultStage
      Returns:
      Reference to this so that method calls can be chained together.
    • priority

      public PricingTier._FinalStage priority(int priority)

      Priority for tier matching evaluation. Lower numbers = higher priority (evaluated first).

      The default tier must always have priority 0. Conditional tiers should have priority 1, 2, 3, etc.

      Example ordering:

      • Priority 0: Default tier (no conditions, always matches as fallback)
      • Priority 1: High usage tier (e.g., >200K tokens)
      • Priority 2: Medium usage tier (e.g., >100K tokens)

      This ensures more specific conditions are checked before general ones.

      Priority for tier matching evaluation. Lower numbers = higher priority (evaluated first).

      The default tier must always have priority 0. Conditional tiers should have priority 1, 2, 3, etc.

      Example ordering:

      • Priority 0: Default tier (no conditions, always matches as fallback)
      • Priority 1: High usage tier (e.g., >200K tokens)
      • Priority 2: Medium usage tier (e.g., >100K tokens)

      This ensures more specific conditions are checked before general ones.

      Specified by:
      priority in interface PricingTier.PriorityStage
      Returns:
      Reference to this so that method calls can be chained together.
    • prices

      public PricingTier._FinalStage prices(String key, Double value)

      Prices (USD) by usage type for this tier.

      Common usage types: "input", "output", "total", "request", "image" Prices are specified in USD per unit (e.g., per token, per request, per second).

      Example: {"input": 0.000003, "output": 0.000015} means $3 per million input tokens and $15 per million output tokens.

      Specified by:
      prices in interface PricingTier._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • putAllPrices

      public PricingTier._FinalStage putAllPrices(Map<String,Double> prices)

      Prices (USD) by usage type for this tier.

      Common usage types: "input", "output", "total", "request", "image" Prices are specified in USD per unit (e.g., per token, per request, per second).

      Example: {"input": 0.000003, "output": 0.000015} means $3 per million input tokens and $15 per million output tokens.

      Specified by:
      putAllPrices in interface PricingTier._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • prices

      public PricingTier._FinalStage prices(Map<String,Double> prices)

      Prices (USD) by usage type for this tier.

      Common usage types: "input", "output", "total", "request", "image" Prices are specified in USD per unit (e.g., per token, per request, per second).

      Example: {"input": 0.000003, "output": 0.000015} means $3 per million input tokens and $15 per million output tokens.

      Specified by:
      prices in interface PricingTier._FinalStage
    • addAllConditions

      public PricingTier._FinalStage addAllConditions(List<PricingTierCondition> conditions)

      Array of conditions that must ALL be met for this tier to match (AND logic).

      The default tier must have an empty conditions array. Conditional tiers should have one or more conditions that define when this tier's pricing applies.

      Multiple conditions enable complex matching scenarios (e.g., "high input tokens AND low output tokens").

      Specified by:
      addAllConditions in interface PricingTier._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • addConditions

      public PricingTier._FinalStage addConditions(PricingTierCondition conditions)

      Array of conditions that must ALL be met for this tier to match (AND logic).

      The default tier must have an empty conditions array. Conditional tiers should have one or more conditions that define when this tier's pricing applies.

      Multiple conditions enable complex matching scenarios (e.g., "high input tokens AND low output tokens").

      Specified by:
      addConditions in interface PricingTier._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • conditions

      public PricingTier._FinalStage conditions(List<PricingTierCondition> conditions)

      Array of conditions that must ALL be met for this tier to match (AND logic).

      The default tier must have an empty conditions array. Conditional tiers should have one or more conditions that define when this tier's pricing applies.

      Multiple conditions enable complex matching scenarios (e.g., "high input tokens AND low output tokens").

      Specified by:
      conditions in interface PricingTier._FinalStage
    • build

      public PricingTier build()
      Specified by:
      build in interface PricingTier._FinalStage
    • additionalProperty

      public PricingTier.Builder additionalProperty(String key, Object value)
      Specified by:
      additionalProperty in interface PricingTier._FinalStage
    • additionalProperties

      public PricingTier.Builder additionalProperties(Map<String,Object> additionalProperties)
      Specified by:
      additionalProperties in interface PricingTier._FinalStage