Pricing and Billing
Pricing Plans
Creating a Pricing Plan Object
10min
to define a custom pricing plan using usage based dimension pricing, you will construct a pricing plan object this object is composed of one or more price generators each price generator corresponds to a specific meter, a resource or service you want to charge for, and defines how usage of that meter is priced based on dimension values conceptual overview think of a price generator as the pricing definition for a single meter for every meter you intend to bill your customer for, you will create one price generator each price generator will have one or more price tiers price tiers are where you will set the price based on specific parameters such as dimensions, block size and tiered pricing the completed price generator are then bundled together in the pricing plan to create complete pricing for your customers each price generator includes a list of dimensionkeys (e g , model name , input output , instance type ) that determine how pricing is calculated a list of price tiers , where each tier defines a price for a specific combination of dimension values each price tier defines a specific combination of dimensionvalues (e g , \["gpt 4", "input"]) one or more volume based rates (e g , dimensional pricing, tiered pricing) workflow summary define one price generator per meter specify the relevant dimensionkeys create one or more price tiers per generator, each with dimension values and rates wrap the price generators into a single pricing plan object send the full object to the api endpoint `post https //app amberflo io/payments/pricing/amberflo/account pricing/product plans/template/custom pricing plan https //app amberflo io/payments/pricing/amberflo/account pricing/product plans/template/custom pricing plan ` pricing plan object structure { "id" "uuid", "type" "custom pricing plan", "planname" "name of pricing plan", "description" "optional plan description", "billingperiod" { "interval" "month", "intervalscount" 1, "frequency" "month" }, "planlevelfreetier" null, "realtimepricing" false, "lockingstatus" "open", "isdefault" false, "feemap" {}, "pricegenerators" \[] } price generator structure { "id" "uuid", "type" "usage based dimension", "usagetransformer" null, "productitemid" "uuid of the meter you are creating the pricing for", "productitempricename" "uuid", "lockingstatus" "open", "dimensionkeys" \["model name", "input output"], "pricetiers" \[] } note to get the productitemid you need to call the get all product items api https //docs amberflo io/reference/get all product items it will return an object with onformation on your meters for the purposes of pricing find the meter you want to price and use the id field for the productitemid price tier structure { "dimensionvalues" \["gpt 4", "input"], "pricetiers" \[ { "startafterunit" 0, "batchsize" 1, "priceperbatch" 0 000002 }, { "startafterunit" 10000000, "batchsize" 1, "priceperbatch" 0 000001 } ], "leafnodetype" "priceperunitleafnode" } example variations basic usage based pricing { "type" "usage based no dimension", "productitemid" "uuid", "pricetiers" \[ { "startafterunit" 0, "batchsize" 1, "priceperbatch" 3 14 } ], "leafnodetype" "priceperunitleafnode" } dimension based pricing { "type" "usage based dimension", "dimensionkeys" \["model name", "input output"], "pricetiers" \[ { "dimensionvalues" \["gpt 4", "input"], "pricetiers" \[ {"startafterunit" 0, "batchsize" 1, "priceperbatch" 0 000002} ], "leafnodetype" "priceperunitleafnode" } ] } flat rate pricing flat rates are defined in the feemap field within the pricing plan object "feemap" { "a5a5cc62 f2a0 44d2 9ffc 124664fdf69b" { "cost" 500, "discountable" false, "description" "recurring fee", "name" "access fee", "isonetimefee" false, "isprorated" false, "proratetoday" false, "prepayable" true, "id" "a5a5cc62 f2a0 44d2 9ffc 124664fdf69b" } } notes and best practices dimensionkeys and dimensionvalues must match in order use null in dimensionvalues to wildcard a dimension sort more specific price tiers before general ones it will use the first matching condition it finds set lockingstatus to open if you want to make more changes lock your plan (lockingstatus "close to changes") to activate