cost

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BillingDashboardURL

func BillingDashboardURL(p adapter.Provider) string

BillingDashboardURL returns the public URL where the user can inspect their billing / quota for the given provider, or empty string if no canonical surface exists.

/usage surfaces this as a footer so the dollar estimate has an authoritative escape hatch — the catalog drifts, the invoice doesn't.

URLs are stable hostnames; we point at the dashboards' index rather than deep links because the deep paths churn more often (OpenAI's "Usage" tab has been renamed three times in two years, for example).

Types

type Estimate added in v0.5.0

type Estimate struct {
	USD       float64
	Available bool
}

Estimate is a public-list-price estimate in USD. It is not an invoice and is unavailable when the catalog cannot price the complete usage record.

func ForUsage added in v0.5.0

func ForUsage(baseURL, provider string, model string, u adapter.Usage) Estimate

ForUsage calculates an estimated USD amount for provider-reported usage. Prices are expressed by models.dev as USD per one million tokens. Cache creation is included only when models.dev publishes a cache-write rate; unknown dimensions remain unavailable rather than being guessed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL