File size: 1,861 Bytes
1477a90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import "../shared/index.tsp";
import "../meters/index.tsp";
import "./unitcost.tsp";
import "@typespec/json-schema";

using TypeSpec.JsonSchema;

namespace Features;

/**
 * Reference to a meter associated with a feature.
 */
@friendlyName("FeatureMeterReference")
model FeatureMeterReference {
  /**
   * The ID of the meter to associate with this feature.
   */
  @visibility(Lifecycle.Read, Lifecycle.Create)
  @summary("Meter ID")
  id: Shared.ULID;

  /**
   * Filters to apply to the dimensions of the meter.
   */
  @maxProperties(10)
  @summary("Meter dimensions filters")
  filters?: Record<Shared.QueryFilterStringMapItem>;
}

/**
 * A capability or billable dimension offered by a provider.
 */
@friendlyName("Feature")
model Feature {
  ...Shared.ResourceWithKey;

  /**
   * The meter that the feature is associated with and based on which usage is
   * calculated. If not specified, the feature is static.
   */
  @summary("Meter reference")
  @visibility(Lifecycle.Read, Lifecycle.Create)
  meter?: FeatureMeterReference;

  /**
   * Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or
   * "llm" to look up cost from the LLM cost database based on meter group-by
   * properties.
   */
  @summary("Unit cost")
  @visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
  unit_cost?: FeatureUnitCost;
}

/**
 * Request body for updating a feature. Currently only the unit_cost field can be
 * updated.
 */
@friendlyName("UpdateFeatureRequest")
model FeatureUpdateRequest {
  /**
   * Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or
   * "llm" to look up cost from the LLM cost database based on meter group-by
   * properties. Set to `null` to clear the existing unit cost; omit to leave it
   * unchanged.
   */
  @summary("Unit cost")
  unit_cost?: FeatureUnitCost | null;
}