estimate
What something would cost a month before you make it: an app, its database and bucket, a repo, live editing.
Each charge comes back on its own line with the unit it's billed by, the unit price NoClick charges for it (what the service costs NoClick, nothing added), the quantity a month and the dollars, priced for your account's plan. Leave usage out and a modest default is assumed, and the line says so. Nothing is made or charged by asking.
est = noclick.estimate([
{"kind": "project", "runtime": "edge", "usage": {"requests": 100_000}},
{"kind": "database", "engine": "sqlite"},
{"kind": "bucket"},
])
print(f"${est.monthly_usd:.2f} a month")noclick.estimate(items, *, user=..., client=None) -> EstimateWhat items would cost a month, before you make any of them. Each item is a dict naming its kind
(project, durable_objects, database, bucket, repo or live_editing), its options (a
project's runtime, region and framework, a database's engine), an optional name of your own,
and the usage you expect a month by name (noclick.Estimate.kinds() lists each kind's). Usage you leave
out is assumed from the kind's defaults, and so is an option you leave out whose default changes a price (an
edge app's framework picks its build machine); every line a default decided says so (assumed). Prices
are what each service costs NoClick, nothing added, priced for your account's plan. Needs the usage scope;
nothing is made, held or charged.
Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)An Estimate: monthly_usd, every charge in lines (its unit, unit_usd, quantity and
usd), the items each with its own total, and your plan with the usage it includes a month.
A kind, option or usage it can't price raises noclick.InvalidRequest naming the field.
A small site on the edge with a SQLite database and a bucket, at 100,000 requests a month:
est = noclick.estimate([
{"kind": "project", "runtime": "edge", "usage": {"requests": 100_000}},
{"kind": "database", "engine": "sqlite"},
{"kind": "bucket"},
])
print(f"${est.monthly_usd:.2f} a month")
for line in est.lines:
note = " (assumed)" if line.assumed else ""
print(f"{line.kind} {line.charge}: {line.quantity:g} {line.unit} x ${line.unit_usd:g} = "
f"${line.usd:.4f}{note}")A Postgres database awake 200 hours a month, at its smallest size:
est = noclick.estimate([{"kind": "database", "engine": "postgres",
"usage": {"active_hours": 200, "compute_units": 0.25, "storage_gb": 2}}])Estimate
class EstimateWhat the items would cost a month: a usage-based estimate, priced for your account's plan.
| monthly_usd | float | |
| estimated | bool | Always true: these charges are by usage, so what's charged is what's used. |
| items | list[EstimateItem] | |
| lines | list[EstimateLine] | Every item's lines, in order. |
| plan | dict[str, Any] | None | Your account's plan, as |
| included_usd_per_month | float | None | The usage the plan includes a month, in dollars, which every charge to the account draws from (None without a plan). |
| raw | dict[str, Any] | The response JSON exactly as the API sent it. |
kindsstaticasync
noclick.Estimate.kinds(*, region=None, user=..., client=None) -> list[EstimateKind]What noclick.estimate takes: each kind and variant, the usage it's priced by with the default assumed
for any you leave out, and each charge's unit price. A container app's prices depend on its region
(default: where a new app of yours would go). Needs the usage scope.
NoneWho the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)Each EstimateKind: its kind and options (a project's runtime, a database's engine),
its usage fields with their defaults, and its prices.
for kind in noclick.Estimate.kinds():
print(kind.kind, kind.options, [(u.name, u.default) for u in kind.usage])
for price in kind.prices:
print(f" {price.charge}: ${price.unit_usd} per {price.unit}")EstimateItem
class EstimateItemOne thing you asked about, priced: its options, the usage it was priced at, and its lines.
| kind | str | |
| label | str | For people, e.g. |
| name | str | None | |
| options | dict[str, Any] | What it was priced as: a project's |
| usage | dict[str, float] | Every usage it was priced at, by name: what you gave and the defaults for the rest. |
| assumed | list[str] | The usage names you left out, and the options you left out whose default changes a price. |
| monthly_usd | float | |
| lines | list[EstimateLine] | |
| not_included | list[str] | What its meters also charge that no usage here prices (an app's calls to AI, say), in words. |
| raw | dict[str, Any] | The response JSON exactly as the API sent it. |
EstimateLine
class EstimateLineOne charge of an estimate: what is billed, by which unit, at what price, and how much of it a month.
| kind | str | The kind of the item it's for: |
| item | str | None | The |
| charge | str | Which charge it is, e.g. |
| description | str | What it charges for, in words. |
| unit | str | The unit it's billed by, e.g. |
| unit_usd | float | The price of one |
| quantity | float | How many units a month. |
| usd | float | What it would cost your account a month, in US dollars. |
| assumed | bool | Whether a default decided it: its |
| raw | dict[str, Any] | The response JSON exactly as the API sent it. |
EstimateKind
class EstimateKindSomething an estimate takes: the usage it's priced by and the charges it makes.
| kind | str | What |
| label | str | |
| description | str | |
| options | dict[str, Any] | What this variant is priced as: a project's |
| usage | list[EstimateUsageField] | |
| prices | list[EstimatePrice] | |
| not_included | list[str] | |
| raw | dict[str, Any] | The response JSON exactly as the API sent it. |
EstimateUsageField
class EstimateUsageFieldA usage a kind takes: what it counts, and the default assumed when you leave it out.
| name | str | |
| unit | str | |
| description | str | |
| default | float | |
| most | float | None | The most it can be (a share is at most 1), else None. |
EstimatePrice
class EstimatePriceA charge a kind makes, at its unit price.
| charge | str | |
| description | str | |
| unit | str | |
| unit_usd | float | |
| usage_fields | list[str] | The usage names its quantity comes from. |