Class CreateModelRequest

java.lang.Object
com.langfuse.client.resources.models.types.CreateModelRequest

public final class CreateModelRequest extends Object
  • Method Details

    • getModelName

      public String getModelName()
      Returns:
      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
    • getMatchPattern

      public String getMatchPattern()
      Returns:
      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$
    • getStartDate

      public Optional<OffsetDateTime> getStartDate()
      Returns:
      Apply only to generations which are newer than this ISO date.
    • getUnit

      public Optional<ModelUsageUnit> getUnit()
      Returns:
      Unit used by this model.
    • getInputPrice

      public Optional<Double> getInputPrice()
      Returns:
      Deprecated. Use 'pricingTiers' instead. Price (USD) per input unit. Creates a default tier if pricingTiers not provided.
    • getOutputPrice

      public Optional<Double> getOutputPrice()
      Returns:
      Deprecated. Use 'pricingTiers' instead. Price (USD) per output unit. Creates a default tier if pricingTiers not provided.
    • getTotalPrice

      public Optional<Double> getTotalPrice()
      Returns:
      Deprecated. Use 'pricingTiers' instead. Price (USD) per total units. Cannot be set if input or output price is set. Creates a default tier if pricingTiers not provided.
    • getPricingTiers

      public Optional<List<PricingTierInput>> getPricingTiers()
      Returns:
      Optional. Array of pricing tiers for this model.

      Use pricing tiers for all models - both those with threshold-based pricing variations and those with simple flat pricing:

      • For models with standard flat pricing: Create a single default tier with your prices (e.g., one tier with isDefault=true, priority=0, conditions=[], and your standard prices)

      • For models with threshold-based pricing: Create a default tier plus additional conditional tiers (e.g., default tier for standard usage + high-volume tier for usage above certain thresholds)

      Requirements:

      • Cannot be provided with flat prices (inputPrice/outputPrice/totalPrice) - use one approach or the other
      • Must include exactly one default tier with isDefault=true, priority=0, and conditions=[]
      • All tier names and priorities must be unique within the model
      • Each tier must define at least one price

      If omitted, you must provide flat prices instead (inputPrice/outputPrice/totalPrice), which will automatically create a single default tier named "Standard".

    • getTokenizerId

      public Optional<String> getTokenizerId()
      Returns:
      Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.
    • getTokenizerConfig

      public Optional<Object> getTokenizerConfig()
      Returns:
      Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • getAdditionalProperties

      public Map<String,Object> getAdditionalProperties()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • builder

      public static CreateModelRequest.ModelNameStage builder()