comecerodocs

Create a rate plan version

POST
/usage/rate_plans

Prices a metric. A saved version never changes: to change a price, save a new version with the same rate_plan_id. Tiers and package sizes price only the units above the included allowance. Secret and trusted tokens may call it; a limited token may not (403). The plan is not checked against an agreement's currency here: use a plan in the agreement's currency, or its billing run fails with currency_mismatch.

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Request Body

A rate plan version.

application/json
  1. body
rate_plan_id?string

Defaults to a new id. Send an existing id with a new version to change a price.

version?integer

Defaults to 1.

metric_id*string

Required.

currency*string

Required. Three ASCII letters, trimmed and saved in upper case. Digits, punctuation or another length answer 400 (reference UbV13). Must be a currency Comecero supports and match the agreement currency.

Match^\s*[A-Za-z]{3}\s*$
pricing_model*string

Required.

Value in"flat_per_unit""package""tiered_volume""tiered_graduated""stair_step"
included_allowance?number

Units included each period before anything is charged. When left out, the entitlement's capacity is used. At most 1,000,000,000,000.

overage_price?number

For flat_per_unit: the price per billable unit. For package: the price per package. At most 1,000,000.

tiers?array<>

Required for tiered_volume, tiered_graduated and stair_step. Tiers count billable units, the units above included_allowance. At most 100 tiers; each up_to above 0 and unique; only one tier (the last) open-ended. For stair_step: every tier has a flat_fee and no unit_price, the last tier is open-ended, and fees never go down as up_to goes up.

billing_region?string

Billing region. Defaults to us.

Value in"us""uk""eu"
package_size?number

Only for package: units in one package. Billable units are rounded up to whole packages. Defaults to 1.

effective_from?string

When the version was published. Defaults to now. Billing does not use it: an entitlement pins the exact version it is billed with.

Formatdate-time
credit_pricing?

Response Body

Success.

application/json
  1. response

The price of one metric in one currency. Each version is fixed once saved. There is no archive field or archive endpoint.

object?string

Always rate_plan.

rate_plan_id?string

Your id, or rate_ plus 32 characters.

version?integer

1 or more. Never changes once saved.

metric_id?string

The metric it prices.

currency?string

Three ASCII letters, saved in upper case. Must be the currency of the agreements that use it.

Match^[A-Z]{3}$
pricing_model?string

How billable units are priced.

Value in"flat_per_unit""package""tiered_volume""tiered_graduated""stair_step"
included_allowance?number

Units included in each period before any charge.

overage_price?number

Price per billable unit for flat_per_unit and package.

tiers?array<>

Set for tiered_volume, tiered_graduated and stair_step.

effective_from?string

Kept with the plan.

Formatdate-time
effective_to?string

Kept with the plan.

Formatdate-time
billing_region?string

Billing region. Defaults to us.

Value in"us""uk""eu"
test?boolean

Test or live.

credit_pricing?
unit_snapshot?
Example Request
curl -X POST 'https://api.comecero.com/api/v1/usage/rate_plans' \  -H 'Content-Type: application/json' \  -d '{  "rate_plan_id": "ai_tokens_standard",  "version": 1,  "metric_id": "met_ai_tokens",  "currency": "USD",  "pricing_model": "flat_per_unit",  "included_allowance": 100000,  "overage_price": 0.00002}'
Example Response
{  "object": "rate_plan",  "rate_plan_id": "ai_tokens_standard",  "version": 1,  "metric_id": "met_ai_tokens",  "currency": "USD",  "pricing_model": "flat_per_unit",  "included_allowance": 100000,  "overage_price": 0.00002,  "tiers": [],  "billing_region": "us",  "test": false}