Skip to content
View as Markdown llms.txt

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.

const DEFAULT_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.

const ESTIMATED_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.

const PER_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

Property Modifier Type Description
actionCatalog? readonly Readonly<Record<string, { tokens?: number; }>> Tokens charged per action, by action name; run-analysis is the price of one analysis job.
analysisType? readonly Readonly<Record<string, { tokens?: number; }>> Tokens charged for one job, by analysis name.
brackets? readonly Readonly<Record<string, { maxKm2: number | null; }>> The area brackets used to price workflow runs, by bracket name. maxKm2 is the largest area in square kilometres the bracket covers; null means no upper limit.
effectiveFrom? readonly string When this price list takes effect.
perJob? readonly Readonly<Record<string, { tokens?: number; }>> Older per-job prices, keyed by model (see PER_JOB_MODEL_KEYS) with an optional default.
version? readonly string | number The version of this price list.
workflows? readonly Readonly<Record<string, Readonly<Record<string, number>>>> Tokens charged for a whole workflow run, by workflow id and then by bracket name.

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.