Skip to content
Join our SlackContact usGet started

Create Rate Card

rate_cards.create(RateCardCreateParams**kwargs) -> RateCardResource
post/rate-cards

Create Rate Card

ParametersExpand Collapse
billing_interval: Literal["monthly", "yearly"]

How often the customer will be billed for this rate card.

Accepts one of the following:
"monthly"
"yearly"
name: str

The name of the rate card displayed to the customer.

description: Optional[str]

The description of the rate card displayed to the customer.

fixed_rates: Optional[Iterable[FixedRate]]

The fixed rates of the rate card. These are billed at the start of each billing cycle.

name: str

The name of the rate displayed to the customer.

price: FixedRatePrice

Flat price is a price that linearly scales with the quantity.

Accepts one of the following:
class FlatPriceInput:

Flat price is a price that linearly scales with the quantity.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
ValueUnionMember0 = float
ValueUnionMember1 = str
price_type: Optional[Literal["flat"]]
Accepts one of the following:
"flat"
class PackagePriceInput:

Package price is a price that is charged for a fixed number of units. For example, $10 per 1000 units. If the quantity is not a multiple of the package units, the rounding behavior will be applied.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
ValueUnionMember0 = float
ValueUnionMember1 = str
package_units: int
rounding_behavior: Literal["round_up", "round_down"]
Accepts one of the following:
"round_up"
"round_down"
price_type: Optional[Literal["package"]]
Accepts one of the following:
"package"
description: Optional[str]

The description of the rate displayed to the customer.

metadata: Optional[Dict[str, str]]
usage_based_rates: Optional[Iterable[UsageBasedRate]]

The usage based rates of the rate card. These are billed at the end of each billing cycle.

Accepts one of the following:
class UsageBasedRateCreateSimpleUsageBasedRateRequest:
name: str

The name of the rate displayed to the customer.

price: UsageBasedRateCreateSimpleUsageBasedRateRequestPrice

Flat price is a price that linearly scales with the quantity.

Accepts one of the following:
class FlatPriceInput:

Flat price is a price that linearly scales with the quantity.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
ValueUnionMember0 = float
ValueUnionMember1 = str
price_type: Optional[Literal["flat"]]
Accepts one of the following:
"flat"
class PackagePriceInput:

Package price is a price that is charged for a fixed number of units. For example, $10 per 1000 units. If the quantity is not a multiple of the package units, the rounding behavior will be applied.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
ValueUnionMember0 = float
ValueUnionMember1 = str
package_units: int
rounding_behavior: Literal["round_up", "round_down"]
Accepts one of the following:
"round_up"
"round_down"
price_type: Optional[Literal["package"]]
Accepts one of the following:
"package"
pricing_metric_id: str

The ID of the pricing metric to use for this rate.

usage_based_rate_type: Literal["simple"]
Accepts one of the following:
"simple"
description: Optional[str]

The description of the rate displayed to the customer.

included_units: Optional[int]

The number of units included in the rate before the price is applied.

minimum0
class UsageBasedRateCreateDimensionalUsageBasedRateRequest:
dimensions: Iterable[UsageBasedRateCreateDimensionalUsageBasedRateRequestDimension]

The dimensions of the rate.

key: str

The name of the dimension. This is used to identify the dimension in the pricing matrix.

values: SequenceNotStr[str]

A list of possible values for the dimension.

description: Optional[str]

The description of the dimension.

name: str

The name of the rate displayed to the customer.

pricing_matrix: UsageBasedRateCreateDimensionalUsageBasedRateRequestPricingMatrix

The pricing matrix of the rate.

cells: Iterable[UsageBasedRateCreateDimensionalUsageBasedRateRequestPricingMatrixCell]
dimension_coordinates: Dict[str, str]

A key-value mapping of dimension keys and values to identify the price for a given set of dimension values.

price: UsageBasedRateCreateDimensionalUsageBasedRateRequestPricingMatrixCellPrice

The price for the cell.

Accepts one of the following:
class FlatPriceInput:

Flat price is a price that linearly scales with the quantity.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
ValueUnionMember0 = float
ValueUnionMember1 = str
price_type: Optional[Literal["flat"]]
Accepts one of the following:
"flat"
class PackagePriceInput:

Package price is a price that is charged for a fixed number of units. For example, $10 per 1000 units. If the quantity is not a multiple of the package units, the rounding behavior will be applied.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
ValueUnionMember0 = float
ValueUnionMember1 = str
package_units: int
rounding_behavior: Literal["round_up", "round_down"]
Accepts one of the following:
"round_up"
"round_down"
price_type: Optional[Literal["package"]]
Accepts one of the following:
"package"
pricing_metric_id: str

The ID of the pricing metric to use for this rate.

usage_based_rate_type: Literal["dimensional"]
Accepts one of the following:
"dimensional"
description: Optional[str]

The description of the rate displayed to the customer.

included_units: Optional[int]

The number of units included in the rate before the price is applied.

minimum0
ReturnsExpand Collapse
class RateCardResource:
id: str

The ID of the rate card.

billing_interval: Literal["monthly", "yearly"]

How often the customer will be billed for this rate card.

Accepts one of the following:
"monthly"
"yearly"
created_at: datetime

The date and time the rate card was created.

formatdate-time
fixed_rates: List[FixedRate]

The fixed rates of the rate card.

id: str
description: Optional[str]
name: str
price: FixedRatePrice

Flat price is a price that linearly scales with the quantity.

Accepts one of the following:
class FlatPriceOutput:

Flat price is a price that linearly scales with the quantity.

amount: AmountOutput
currency_code: str

The currency code of the amount.

value: str

The value of the amount in the smallest unit of the currency.

price_type: Optional[Literal["flat"]]
Accepts one of the following:
"flat"
class PackagePriceOutput:

Package price is a price that is charged for a fixed number of units. For example, $10 per 1000 units. If the quantity is not a multiple of the package units, the rounding behavior will be applied.

amount: AmountOutput
currency_code: str

The currency code of the amount.

value: str

The value of the amount in the smallest unit of the currency.

package_units: int
rounding_behavior: Literal["round_up", "round_down"]
Accepts one of the following:
"round_up"
"round_down"
price_type: Optional[Literal["package"]]
Accepts one of the following:
"package"
metadata: Dict[str, str]

Additional metadata about the rate card. You may use this to store any custom data about the rate card.

name: str

The name of the rate card.

updated_at: datetime

The date and time the rate card was last updated.

formatdate-time
usage_based_rates: List[UsageBasedRate]

The usage based rates of the rate card.

Accepts one of the following:
class UsageBasedRateSimpleUsageBasedRateInterface:
id: str
description: Optional[str]
included_units: int
name: str
price: UsageBasedRateSimpleUsageBasedRateInterfacePrice

Flat price is a price that linearly scales with the quantity.

Accepts one of the following:
class FlatPriceOutput:

Flat price is a price that linearly scales with the quantity.

amount: AmountOutput
currency_code: str

The currency code of the amount.

value: str

The value of the amount in the smallest unit of the currency.

price_type: Optional[Literal["flat"]]
Accepts one of the following:
"flat"
class PackagePriceOutput:

Package price is a price that is charged for a fixed number of units. For example, $10 per 1000 units. If the quantity is not a multiple of the package units, the rounding behavior will be applied.

amount: AmountOutput
currency_code: str

The currency code of the amount.

value: str

The value of the amount in the smallest unit of the currency.

package_units: int
rounding_behavior: Literal["round_up", "round_down"]
Accepts one of the following:
"round_up"
"round_down"
price_type: Optional[Literal["package"]]
Accepts one of the following:
"package"
pricing_metric_id: str
usage_based_rate_type: Optional[Literal["simple"]]
Accepts one of the following:
"simple"
class UsageBasedRateDimensionalUsageBasedRateInterface:
id: str
description: Optional[str]
dimensions: List[UsageBasedRateDimensionalUsageBasedRateInterfaceDimension]
description: Optional[str]
key: str
values: List[str]
included_units: int
name: str
pricing_matrix: UsageBasedRateDimensionalUsageBasedRateInterfacePricingMatrix
cells: List[UsageBasedRateDimensionalUsageBasedRateInterfacePricingMatrixCell]
dimension_coordinates: Dict[str, str]
price: UsageBasedRateDimensionalUsageBasedRateInterfacePricingMatrixCellPrice

Flat price is a price that linearly scales with the quantity.

Accepts one of the following:
class FlatPriceOutput:

Flat price is a price that linearly scales with the quantity.

amount: AmountOutput
currency_code: str

The currency code of the amount.

value: str

The value of the amount in the smallest unit of the currency.

price_type: Optional[Literal["flat"]]
Accepts one of the following:
"flat"
class PackagePriceOutput:

Package price is a price that is charged for a fixed number of units. For example, $10 per 1000 units. If the quantity is not a multiple of the package units, the rounding behavior will be applied.

amount: AmountOutput
currency_code: str

The currency code of the amount.

value: str

The value of the amount in the smallest unit of the currency.

package_units: int
rounding_behavior: Literal["round_up", "round_down"]
Accepts one of the following:
"round_up"
"round_down"
price_type: Optional[Literal["package"]]
Accepts one of the following:
"package"
pricing_metric_id: str
usage_based_rate_type: Optional[Literal["dimensional"]]
Accepts one of the following:
"dimensional"
description: Optional[str]

The description of the rate card.

Create Rate Card
from lark import Lark

client = Lark(
    api_key="My API Key",
)
rate_card_resource = client.rate_cards.create(
    billing_interval="monthly",
    name="Pro Plan",
    description="For production applicatidddons with moderate usage.",
    fixed_rates=[{
        "name": "Base Rate",
        "price": {
            "price_type": "flat",
            "amount": {
                "value": 2500,
                "currency_code": "usd",
            },
        },
    }],
    metadata={},
    usage_based_rates=[{
        "usage_based_rate_type": "simple",
        "name": "Compute Hours",
        "price": {
            "price_type": "flat",
            "amount": {
                "value": 100,
                "currency_code": "usd",
            },
        },
        "included_units": 30,
        "pricing_metric_id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
    }],
)
print(rate_card_resource.id)
{
  "id": "rc_jQK2n0wutCj6bBcAIrL6o07g",
  "billing_interval": "monthly",
  "created_at": "2025-11-01T00:00:00Z",
  "fixed_rates": [
    {
      "id": "fr_04EjnYJoQLC7gtLKI6mPzZny",
      "description": "description",
      "name": "Base Rate",
      "price": {
        "amount": {
          "currency_code": "usd",
          "value": "2500"
        },
        "price_type": "flat"
      }
    }
  ],
  "metadata": {},
  "name": "Pro Plan",
  "updated_at": "2025-11-01T00:00:00Z",
  "usage_based_rates": [
    {
      "id": "ubr_zoXOJrDXlGGJWRNq3HqFYhbP",
      "description": "description",
      "included_units": 30,
      "name": "Compute Hours",
      "price": {
        "amount": {
          "currency_code": "usd",
          "value": "100"
        },
        "price_type": "flat"
      },
      "pricing_metric_id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
      "usage_based_rate_type": "simple"
    }
  ],
  "description": "For production applications with moderate usage."
}
Returns Examples
{
  "id": "rc_jQK2n0wutCj6bBcAIrL6o07g",
  "billing_interval": "monthly",
  "created_at": "2025-11-01T00:00:00Z",
  "fixed_rates": [
    {
      "id": "fr_04EjnYJoQLC7gtLKI6mPzZny",
      "description": "description",
      "name": "Base Rate",
      "price": {
        "amount": {
          "currency_code": "usd",
          "value": "2500"
        },
        "price_type": "flat"
      }
    }
  ],
  "metadata": {},
  "name": "Pro Plan",
  "updated_at": "2025-11-01T00:00:00Z",
  "usage_based_rates": [
    {
      "id": "ubr_zoXOJrDXlGGJWRNq3HqFYhbP",
      "description": "description",
      "included_units": 30,
      "name": "Compute Hours",
      "price": {
        "amount": {
          "currency_code": "usd",
          "value": "100"
        },
        "price_type": "flat"
      },
      "pricing_metric_id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
      "usage_based_rate_type": "simple"
    }
  ],
  "description": "For production applications with moderate usage."
}