---
title: Amount
description: "What a line item's cost can be: an estimate, or unpriced."
---

```python
@final
class Amount
```

What a line item's cost can be: an estimate, or unpriced.

A class rather than a union, because a union in Python is a documentation convention
and this has to be something a caller can branch on. `kind` is the stable tag
(`"estimated-usd"` / `"unpriced"`), `usd` is `None` for the unpriced case, and
`unpriced` is `None` for the priced one — so exactly one of the two is present and a
reader who checks either has handled both.

## Constructor

`Amount` declares no `__new__` or `__init__`, so it is not constructed directly: an instance comes back from another call in this package.

## Properties

### `kind`

```python
kind: str
```

`"estimated-usd"` or `"unpriced"` — the tag `cli.py` puts in `amount.kind`.

### `unpriced`

```python
unpriced: Unpriced | None
```

The unpriced half, or `None` when the line was priced.

### `usd`

```python
usd: EstimatedUsd | None
```

The estimate, or `None` when there is no published rate.

`None` rather than a zero, which is the same decision as the JSON omitting the
`usd` key: a zero gets summed by anything permissive, and that is the one
arithmetic this module refuses to enable.

## Special methods

### `__repr__`

```python
def __repr__() -> str
```

### `__str__`

```python
def __str__() -> str
```

## Provenance

This page is generated from `bindings/microvms-py/microvms.pyi` by Griffe 2.3.0, run from `site/scripts/gen-reference.mjs` on every `pnpm run sync`, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding's Rust source, then regenerate the declarations with `mise run stubs`. `mise run stubs:check` fails when the committed file no longer matches the source.