SAMBudget

smarter.models.sam.budget

SAM model of the Budget kind, generated from the Smarter platform’s JSON Schema.

Do not edit: run scripts/generate_sam_models.py. See smarter.models.sam.

class smarter.models.sam.budget.SAMBudgetMetadata

Bases: smarter.models.sam.base.SAMModel

Smarter API Budget Manifest - Metadata class.

annotations: None | list[dict[str, str | int | float | bool | datetime.date | datetime.datetime | Annotated[str, StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=None, max_length=None, pattern='^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$')] | uuid.UUID | bytes | list | dict[str, Any]]]

The manifest annotations.

Used for storing arbitrary metadata as

key-value pairs. Example: [{‘smarter.sh/test-manifest/project-name’: ‘Scooby dooby do’}]. The key should be a valid url-friendly string. The value accepts multi-line string values (YAML block scalars) and various scalar types including str, int, float, bool, datetime.date, datetime.datetime, decimal.Decimal, uuid.UUID, bytes, list, dict.

description: str | None

The description for this resource.

Be brief. Keep it under 255 characters.

name: str

The camelCase name of the manifest resource.

tags: list[str] | None

The tags of the manifest.

Used for generic resource categorization and search. Example: [‘tag1’, ‘tag2’]

version: str | None

The semantic version of the manifest.

Example: 0.1.0

class smarter.models.sam.budget.Action

Bases: enum.Enum

Budget.spec.config.action: block further charges when a limit is reached, or only warn.

class smarter.models.sam.budget.Period

Bases: enum.Enum

Budget.spec.config.period: the billing period of periodicLimit and duration.

class smarter.models.sam.budget.Unit

Bases: enum.Enum

Budget.spec.config.unit: what the limits measure: cost in USD, or total tokens.

class smarter.models.sam.budget.SAMBudgetSpecConfig

Bases: smarter.models.sam.base.SAMModel

Smarter API Budget Manifest Budget.spec.config: the budget’s limits.

absoluteLimit: Union

Budget.spec.config.absoluteLimit: the most that may be spent in total, from when the budget is attached.

0 means no limit.

action: smarter.models.sam.budget.Action | None

Budget.spec.config.action: block further charges when a limit is reached, or only warn.

duration: Optional

Budget.spec.config.duration: the billing periods, from when the budget is attached, after which it no longer applies.

0 means never.

message: Optional

Budget.spec.config.message: what people are told when the budget blocks their request.

Defaults to a description of the limit that was reached.

period: smarter.models.sam.budget.Period | None

Budget.spec.config.period: the billing period of periodicLimit and duration.

periodicLimit: Union

Budget.spec.config.periodicLimit: the most that may be spent in a billing period.

0 means no limit.

unit: smarter.models.sam.budget.Unit | None

Budget.spec.config.unit: what the limits measure: cost in USD, or total tokens.

warningThreshold: Optional

Budget.spec.config.warningThreshold: the percentage of a limit at which a warning is sent.

0 means never.

class smarter.models.sam.budget.Kind

Bases: enum.Enum

Budget.spec.resources.kind: the resource’s manifest kind, e.g. LLMClient.

class smarter.models.sam.budget.SAMBudgetSpecResource

Bases: smarter.models.sam.base.SAMModel

Smarter API Budget Manifest Budget.spec.resources[]: a resource that the budget is enforced on.

Either kind and name, with an optional accountNumber, or a recordLocator.

accountNumber: str | None

Budget.spec.resources.accountNumber: the account that the resource belongs to.

Defaults to your own.

kind: smarter.models.sam.budget.Kind | None

Budget.spec.resources.kind: the resource’s manifest kind, e.g. LLMClient.

name: str | None

Budget.spec.resources.name: the resource’s name.

For an Account, its account number; for a User, the username.

recordLocator: str | None

Budget.spec.resources.recordLocator: any resource’s record locator, e.g. llmclient-rc2x, in place of kind and name.

class smarter.models.sam.budget.SAMBudgetStatusResource

Bases: smarter.models.sam.base.SAMModel

The budget versus the actual spending of one of the budget’s resources.

Read only.

absoluteActual: Union

Budget.status.resources.absoluteActual: spending since startDate.

absolutePercent: float | None

Budget.status.resources.absolutePercent: absoluteActual, as a percentage of the limit.

expiresAt: datetime.datetime | None

Budget.status.resources.expiresAt: when the budget’s duration ends.

isActive: bool

Budget.status.resources.isActive: whether the budget is enforced on it.

isLocked: bool

Budget.status.resources.isLocked: whether the budget refuses further charges.

lockReason: str | None

Budget.status.resources.lockReason: which limit was reached.

periodicActual: Union

Budget.status.resources.periodicActual: spending this billing period.

periodicPercent: float | None

Budget.status.resources.periodicPercent: periodicActual, as a percentage of the limit.

recordLocator: str

Budget.status.resources.recordLocator: the resource’s record locator.

startDate: datetime

Budget.status.resources.startDate: when the budget was attached.

class smarter.models.sam.budget.SAMDependency

Bases: smarter.models.sam.base.SAMModel

A resource that depends on the resource that a manifest describes.

kind: str

Kind[String]: The SAM kind of the resource that depends on this resource, e.g. LLMClient.

Read only.

name: str

Name[String]: The name of the resource that depends on this resource.

Read only.

class smarter.models.sam.budget.SAMBudgetSpec

Bases: smarter.models.sam.base.SAMModel

Smarter API Budget Manifest Budget.spec.

config: SAMBudgetSpecConfig

Budget.spec.config[object].

The limits of the Budget.

resources: list[smarter.models.sam.budget.SAMBudgetSpecResource] | None

Budget.spec.resources[list].

The resources that the Budget is enforced on. Resources that are removed from the list are detached.

class smarter.models.sam.budget.SAMBudgetStatus

Bases: smarter.models.sam.base.SAMModel

Smarter API Budget Manifest - Status class.

Read only.

created: datetime

The date in which this resource was created.

Read only.

dependencies: list[smarter.models.sam.budget.SAMDependency] | None

Dependencies[List]: The resources that depend on this resource, and that must be deleted, or stop referring to it, before it can be deleted.

Lists only the resources that you can read. Read only.

modified: datetime

The date in which this resource was most recently changed.

Read only.

recordLocator: str

RecordLocator[String]: An optional identifier used to locate the resource record associated with this manifest.

Read only.

resources: list[smarter.models.sam.budget.SAMBudgetStatusResource] | None

Budget.status.resources: the budget versus the actual spending of each resource.

Read only.

class smarter.models.sam.budget.SAMBudget

Bases: smarter.models.sam.base.SAMModel

Smarter API Manifest - Budget.

apiVersion: str

ApiVersion[String]: Required.

The API version of the AbstractSAMBase.

kind: str

Kind[String]: Required.

The kind of resource described by the manifest.

metadata: SAMBudgetMetadata

Budget.metadata[obj]: Required, the Budget metadata.

spec: SAMBudgetSpec

Budget.spec[obj]: Required, the Budget specification.

status: smarter.models.sam.budget.SAMBudgetStatus | None

Budget.status[obj]: Optional, Read-only.

Stateful status information about the Budget.