proxy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

func NewMetrics

func NewMetrics() *Metrics

func (*Metrics) Begin

func (m *Metrics) Begin(method, path string) *RequestRecord

func (*Metrics) Finish

func (m *Metrics) Finish(record *RequestRecord)

func (*Metrics) Snapshot

func (m *Metrics) Snapshot() Snapshot

type ModelStats

type ModelStats struct {
	Requests       int64
	InputTokens    int64
	OutputTokens   int64
	ThinkingTokens int64
	CachedTokens   int64
	TotalTokens    int64
}

type Options

type Options struct {
	Config        *config.Config
	TokenProvider auth.TokenProvider
	Metrics       *Metrics
	HTTPClient    *http.Client
	UpstreamBase  string
}

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

func New

func New(opts Options) *Proxy

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RequestRecord

type RequestRecord struct {
	Method     string
	Path       string
	Model      string
	StatusCode int
	Duration   time.Duration
	Error      string
	Usage      usage.TokenUsage
	StartedAt  time.Time
}

type Snapshot

type Snapshot struct {
	TotalRequests  int64
	Active         int64
	Successes      int64
	Failures       int64
	InputTokens    int64
	OutputTokens   int64
	ThinkingTokens int64
	CachedTokens   int64
	TotalTokens    int64
	StatusCodes    map[int]int64
	Models         map[string]ModelStats
	Recent         []RequestRecord
}

func (Snapshot) SortedModelNames

func (s Snapshot) SortedModelNames() []string

type StaticTokenProvider

type StaticTokenProvider string

func (StaticTokenProvider) Token

Jump to

Keyboard shortcuts

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