Class PricingTierCondition.Builder

java.lang.Object
com.langfuse.client.resources.commons.types.PricingTierCondition.Builder
All Implemented Interfaces:
PricingTierCondition._FinalStage, PricingTierCondition.CaseSensitiveStage, PricingTierCondition.OperatorStage, PricingTierCondition.UsageDetailPatternStage, PricingTierCondition.ValueStage
Enclosing class:
PricingTierCondition

  • Method Details

    • from

      Specified by:
      from in interface PricingTierCondition.UsageDetailPatternStage
    • usageDetailPattern

      public PricingTierCondition.OperatorStage usageDetailPattern(@NotNull String usageDetailPattern)

      Regex pattern to match against usage detail keys. All matching keys' values are summed for threshold comparison.

      Examples:

      • "^input" matches "input", "input_tokens", "input_cached", etc.
      • "^(input|prompt)" matches both "input_tokens" and "prompt_tokens"
      • "_cache$" matches "input_cache", "output_cache", etc.

      The pattern is case-insensitive by default. If no keys match, the sum is treated as zero.

      Regex pattern to match against usage detail keys. All matching keys' values are summed for threshold comparison.

      Examples:

      • "^input" matches "input", "input_tokens", "input_cached", etc.
      • "^(input|prompt)" matches both "input_tokens" and "prompt_tokens"
      • "_cache$" matches "input_cache", "output_cache", etc.

      The pattern is case-insensitive by default. If no keys match, the sum is treated as zero.

      Specified by:
      usageDetailPattern in interface PricingTierCondition.UsageDetailPatternStage
      Returns:
      Reference to this so that method calls can be chained together.
    • operator

      public PricingTierCondition.ValueStage operator(@NotNull PricingTierOperator operator)

      Comparison operator to apply between the summed value and the threshold.

      • gt: greater than (sum > threshold)
      • gte: greater than or equal (sum >= threshold)
      • lt: less than (sum < threshold)
      • lte: less than or equal (sum <= threshold)
      • eq: equal (sum == threshold)
      • neq: not equal (sum != threshold)

      Comparison operator to apply between the summed value and the threshold.

      • gt: greater than (sum > threshold)
      • gte: greater than or equal (sum >= threshold)
      • lt: less than (sum < threshold)
      • lte: less than or equal (sum <= threshold)
      • eq: equal (sum == threshold)
      • neq: not equal (sum != threshold)
      Specified by:
      operator in interface PricingTierCondition.OperatorStage
      Returns:
      Reference to this so that method calls can be chained together.
    • value

      public PricingTierCondition.CaseSensitiveStage value(double value)

      Threshold value for comparison. For token-based pricing, this is typically the token count threshold (e.g., 200000 for a 200K token threshold).

      Threshold value for comparison. For token-based pricing, this is typically the token count threshold (e.g., 200000 for a 200K token threshold).

      Specified by:
      value in interface PricingTierCondition.ValueStage
      Returns:
      Reference to this so that method calls can be chained together.
    • caseSensitive

      public PricingTierCondition._FinalStage caseSensitive(boolean caseSensitive)

      Whether the regex pattern matching is case-sensitive. Default is false (case-insensitive matching).

      Whether the regex pattern matching is case-sensitive. Default is false (case-insensitive matching).

      Specified by:
      caseSensitive in interface PricingTierCondition.CaseSensitiveStage
      Returns:
      Reference to this so that method calls can be chained together.
    • build

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

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

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