Metering-Rating API Data Model Documentation

Overview

The Metering-Rating API data model is designed to manage and track product usage, customer information, billing plans, and metering data. This model is crucial for applications that need to monitor usage-based billing and customer contract management.

Objects and Their Attributes

Product

  • ID: Unique identifier for the product (e.g., p-9689371).
  • Name: Name of the product (e.g., Prompt).
  • Relationships: Each Product is associated with multiple ProductItems.

ProductItem

  • ID: Unique identifier for the product item (e.g., pi-9689371).
  • Name: Name of the product item (e.g., prompt_lite_en).
  • Relationships:
    • Each ProductItem is related to a Meter.
    • A ProductItem is part of a Product.

Meter

  • ID: Unique identifier for the meter (e.g., m-tokens-567711).
  • Name: Name of the meter (e.g., tokens).
  • Type: Type of the meter (e.g., sum).
  • Relationships:
    • Meters are associated with ProductItems.
    • Meters are linked to Plans and MeterData.

Account

  • ID: Unique identifier for the account (e.g., a-688184).
  • Relationships: An Account is linked to Product and MeterData.

Plan

  • ID: Unique identifier for the plan (e.g., pl-688184).
  • Name: Name of the plan (e.g., Business).
  • Charges: Charges associated with the plan, mapped to meters (e.g., m-tokens-567711: 0.012).
  • Relationships:
    • A Plan is associated with Contracts and Products.
    • Each Plan includes several Meters.

Contract

  • ID: Unique identifier for the contract (e.g., ct-688184).
  • StartDate: Start date of the contract (e.g., 2023-01-01).
  • EndDate: End date of the contract (e.g., 2024-12-31).
  • Relationships: A Contract is linked to a Customer and a Plan.

Customer

  • ID: Unique identifier for the customer (e.g., c-688184).
  • Name: Name of the customer (e.g., John Doe).
  • Relationships: A Customer is linked to Contracts and MeterData.

MeterData

  • Meter: Identifier for the meter (e.g., m-tokens-567).
  • Value: Value or usage recorded by the meter.
  • Customer: Identifier for the customer associated with the meter reading.
  • Relationships:
    • MeterData is associated with an Account, a Customer, and a Meter.

Relationships

  • An Account can have multiple Products.
  • Each Product can include several ProductItems, and each ProductItem is linked to a Meter.
  • Contracts are established between a Customer and a Plan.
  • Plans define the billing structure and are associated with both Products and Meters.
  • MeterData records the usage data for Meters and is linked to Accounts and Customers.

Conclusion

The Metering-Rating API data model is integral for managing complex relationships between products, customers, and usage-based billing plans. It enables efficient tracking of metered usage, facilitating accurate and flexible billing mechanisms.

Also see.