pricing

package
v0.4.123 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: AGPL-3.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pricing 是内置模型参考价的单一来源。

定价只能近似:各家价格随版本/渠道变动,这里给的是公开标价的数量级,用于 让用户看清“哪个任务、哪个 profile 在烧钱”的相对分布,不承诺账单精度。 前缀匹配、按声明顺序命中(specific 在前,free 在最前,避免 ":free" 被当付费)。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Estimate

func Estimate(model string, inTok, outTok int64) (usd float64, known bool)

Estimate 返回按模型名估算的 USD 成本;known=false 表示模型不在定价表, 成本按 0 计且调用方需要把模型名上报给用户(不静默算错)。

Types

type ModelPrice

type ModelPrice struct {
	Prefix string
	In     float64 // USD / 1M input tokens
	Out    float64 // USD / 1M output tokens
}

func Table

func Table() []ModelPrice

Table 返回内置价格的副本(评测报告展示用)。

Jump to

Keyboard shortcuts

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