Class AgentModelPricingService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConfigurationServiceprotected static final Stringprotected static final Stringprotected final tools.jackson.databind.ObjectMapper -
Constructor Summary
ConstructorsConstructorDescriptionAgentModelPricingService(ConfigurationService configurationService, tools.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected List<AgentModelPrice> fetchStored(String tenantId) The price entries actually stored for the given tenant (no default-tenant fallback).protected ConfigurationPropertyfindProperty(String tenantId, String modelPrefix) protected AgentModelPricegetPricesForTenant(String tenantId, boolean merge) Returns the agent model prices for the given tenant.protected static List<AgentModelPrice> mergeEffective(List<AgentModelPrice> defaults, List<AgentModelPrice> tenant) Merges default-tenant prices with the tenant's own, keyed by model prefix (tenant overrides/adds).protected Stringsave(String tenantId, AgentModelPrice price) protected StringtoJson(AgentModelPrice price) Serializes the price fields (the model prefix is the configuration property name, not part of the value).
-
Field Details
-
NAMESPACE
- See Also:
-
DEFAULT_TENANT
- See Also:
-
configurationService
-
objectMapper
protected final tools.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
AgentModelPricingService
public AgentModelPricingService(ConfigurationService configurationService, tools.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
getPricesForTenant
Returns the agent model prices for the given tenant.When
mergeistrue, the default-tenant prices are merged with the tenant's own (the tenant's entries override/add, matched by model prefix). This is the effective list to price tokens against, used by the dashboard cost result mappers (AgentCostByModel/Total/ByDateQueryResultMapper) and the RESTagent-model-pricesread endpoint, so a tenant inherits the default prices unless it overrides them.When
mergeisfalse, only the entries actually stored for this tenant are returned, without the default-tenant fallback. This is what the pricing editor (Control/Hub pricing pages, via the RESTagent-model-prices?raw=trueparameter) needs: inherited default-tenant prices live under the default tenant and cannot be edited/deleted through a tenant view, so they must not appear in the editable list. -
fetchStored
The price entries actually stored for the given tenant (no default-tenant fallback). -
get
-
save
-
delete
-
findProperty
-
normalize
-
toJson
Serializes the price fields (the model prefix is the configuration property name, not part of the value). -
fromJson
-
mergeEffective
protected static List<AgentModelPrice> mergeEffective(List<AgentModelPrice> defaults, List<AgentModelPrice> tenant) Merges default-tenant prices with the tenant's own, keyed by model prefix (tenant overrides/adds).
-