cost

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package cost estimates per-model pricing for prompt tokens.

Prices are per 1M input tokens, in USD, approximate list prices as of this project's v1. The map is used for README-style "cost impact per 100k runs" projections; it is not a substitute for live billing data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateBulk

func EstimateBulk(model string, count, invocations int64) float64

EstimateBulk computes the cost to run each model's tokens n times.

func Lookup

func Lookup(model string) float64

Lookup returns the USD per-1M-token price for a model. Unlisted models fall back to a neutral default so projections never crash.

Types

type Estimated

type Estimated struct {
	Model  string  `json:"model"`
	Tokens int     `json:"tokens"`
	Per1M  float64 `json:"price_per_1m"`
	Cost   float64 `json:"cost_usd"`
}

Estimated is a per-model cost estimate for a given token count.

func Estimate

func Estimate(model string, count int) Estimated

Estimate computes the cost to run count tokens once, per model.

type Price

type Price struct {
	Per1M float64
}

Price is the USD cost per 1M input tokens.

Jump to

Keyboard shortcuts

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