tokens

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 11 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateTokens added in v0.7.0

func EstimateTokens(req *CountTokensRequest) int

EstimateTokens calculates accurate input tokens across Claude & OpenAI schemas

Types

type AccountHealth

type AccountHealth struct {
	ProviderID string    `json:"provider_id"`
	AccountID  string    `json:"account_id"`
	Status     string    `json:"status"` // "healthy", "refreshing", "expired", "error"
	LastCheck  time.Time `json:"last_check"`
	LastError  string    `json:"last_error,omitempty"`
	LatencyMs  int64     `json:"latency_ms"`
}

type CountTokensRequest added in v0.7.0

type CountTokensRequest struct {
	Model    string        `json:"model"`
	Messages []interface{} `json:"messages"`
	System   interface{}   `json:"system,omitempty"`
	Tools    []interface{} `json:"tools,omitempty"`
}

CountTokensRequest mirrors Anthropic's count_tokens payload

type CountTokensResponse added in v0.7.0

type CountTokensResponse struct {
	InputTokens int `json:"input_tokens"`
}

CountTokensResponse represents the standard token count return

type ProviderRegistry

type ProviderRegistry interface {
	GetProvider(id string) (providers.Provider, bool)
	GetAllProviders() []providers.Provider
}

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}
var GlobalScheduler *Scheduler

func InitScheduler

func InitScheduler(registry ProviderRegistry, interval time.Duration) *Scheduler

func (*Scheduler) ListHealth

func (s *Scheduler) ListHealth() []*AccountHealth

func (*Scheduler) RunHealthCheck

func (s *Scheduler) RunHealthCheck(ctx context.Context)

func (*Scheduler) Start

func (s *Scheduler) Start()

func (*Scheduler) Stop

func (s *Scheduler) Stop()

Jump to

Keyboard shortcuts

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