pricing

package
v1.164.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 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 calculates per-call costs without mutating catalog entries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyConfigCost

func ApplyConfigCost(m *modelsdev.Model, id modelsdev.ID, cost *latest.CostConfig) *modelsdev.Model

ApplyConfigCost overlays a config-declared price table (USD per 1M tokens) onto the catalogue entry, returning m untouched when there is no override. It never mutates m: the store caches entries shared across sessions. When the model is uncatalogued (m == nil) a minimal entry is synthesized so the call is still priced — this is the escape hatch for custom endpoints that models.dev cannot describe.

func ApplyModelCost

func ApplyModelCost(m *modelsdev.Model, id modelsdev.ID, usage *chat.Usage, config base.Config) *modelsdev.Model

ApplyModelCost resolves configured and serving-tier rates for a call.

func ComputeMessageCost

func ComputeMessageCost(usage *chat.Usage, m *modelsdev.Model) *float64

ComputeMessageCost prices the whole call at the tier selected by its prompt size. Nil means unpriced; a non-nil zero means free. Messages and hooks share this value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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