Billing
BillingService
Import from @infrared-city/infrared-sdk-ts/billing.
Reads the API's public price list. Available as InfraredClient.billing.
Constructors
Constructor
new BillingService(
options):BillingService
Creates the service from the client's base URL, credentials and transport settings.
Parameters
| Parameter | Type |
|---|---|
options |
ServiceOptions |
Returns
BillingService
Methods
getPublicPricing()
getPublicPricing():
Promise<PublicPricing>
Fetches the current public price list.
Returns
Promise<PublicPricing>
The PublicPricing document.
Throws
Error when the API returns an empty response, or the request fails.
DEFAULT_TOKENS_PER_JOB
Import from @infrared-city/infrared-sdk-ts.
constDEFAULT_TOKENS_PER_JOB:10=10
Tokens billed for one tile-sized job when live pricing is not available.
ESTIMATED_SECONDS_PER_TILE
Import from @infrared-city/infrared-sdk-ts.
constESTIMATED_SECONDS_PER_TILE:10=10
Rough wall-clock time, in seconds, that one tile-sized job takes. Used for estimates only.
estimateWorkflowRunTokens
Import from @infrared-city/infrared-sdk-ts/billing.
estimateWorkflowRunTokens(
pricing,workflowId,areaKm2): {bracket:string;tokens:number; } |null
The tokens a workflow run over an area costs, according to a price list.
Parameters
| Parameter | Type | Description |
|---|---|---|
pricing |
PublicPricing |
The price list from BillingService.getPublicPricing. |
workflowId |
string |
The workflow to price. |
areaKm2 |
number |
The area in square kilometres. |
Returns
{ bracket: string; tokens: number; } | null
The token cost and the bracket it was priced in, or null when
no bracket fits the area or the workflow has no price for that bracket.
PER_JOB_MODEL_KEYS
Import from @infrared-city/infrared-sdk-ts/billing.
constPER_JOB_MODEL_KEYS:Readonly<Record<AnalysesName,string>>
For each analysis, the key of its entry in the older perJob section of
PublicPricing. Several analyses can share one key.
PublicPricing
Import from @infrared-city/infrared-sdk-ts/billing.
The price list the API publishes, as returned by
BillingService.getPublicPricing. Every section is optional, and any
further fields the API adds are kept under their own names.
Indexable
[
extra:string]:unknown
Properties
resolveBracketName
Import from @infrared-city/infrared-sdk-ts/billing.
resolveBracketName(
pricing,areaKm2):string|null
The name of the area bracket that an area falls in, according to a price list. Brackets are checked from the smallest upper limit up, and a bracket with no upper limit matches any area.
Parameters
| Parameter | Type | Description |
|---|---|---|
pricing |
PublicPricing |
The price list from BillingService.getPublicPricing. |
areaKm2 |
number |
The area in square kilometres. |
Returns
string | null
The bracket name, or null when the price list has no bracket that fits.
resolveTokensPerJob
Import from @infrared-city/infrared-sdk-ts/billing.
resolveTokensPerJob(
pricing,analysisType):number
The tokens one job of an analysis costs, according to a price list.
The price listed for the analysis wins. When there is none, the
run-analysis action price is used, then the older perJob entries (the
analysis's own, then default), and finally DEFAULT_TOKENS_PER_JOB.
Entries that are not finite, non-negative numbers are skipped.
Parameters
| Parameter | Type | Description |
|---|---|---|
pricing |
PublicPricing |
The price list from BillingService.getPublicPricing. |
analysisType |
AnalysesName |
The analysis to price. |
Returns
number
Tokens for one job.