utils

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountWords

func CountWords(text string) int

CountWords returns the number of words in a string

func EstimateCost

func EstimateCost(model string, inputTokens, outputTokens int) float64

EstimateCost calculates estimated cost based on model and token count. It uses the provider registry to lookup accurate pricing from Catwalk's provider configs. Falls back to zero cost if the model is not found in the registry.

func EstimateCostLegacy added in v0.5.0

func EstimateCostLegacy(model string, inputTokens, outputTokens int) float64

EstimateCostLegacy is the old hardcoded cost estimation function. Deprecated: Use EstimateCost which uses the provider registry instead.

func EstimateTokens

func EstimateTokens(text string) int

EstimateTokens provides a rough estimation of token count This is a simplified version - actual tokenization varies by model

Types

This section is empty.

Jump to

Keyboard shortcuts

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