proxy

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIFormat

type APIFormat int

APIFormat represents the LLM API format being proxied.

const (
	APIFormatOpenAI APIFormat = iota
	APIFormatAnthropic
	APIFormatGemini
	APIFormatUnknown
)

type Proxy

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

Proxy handles HTTP proxying for LLM API calls.

func NewProxy

func NewProxy(listenAddr, targetURL string) *Proxy

NewProxy creates a new HTTP proxy instance.

func NewProxyWithPipeline

func NewProxyWithPipeline(listenAddr, targetURL string, cfg filter.PipelineConfig) *Proxy

NewProxyWithPipeline creates a proxy with an explicit runtime pipeline config.

func (*Proxy) ListenAddr

func (p *Proxy) ListenAddr() string

func (*Proxy) ServeHTTP

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

ServeHTTP implements http.Handler.

func (*Proxy) SetModelAlias

func (p *Proxy) SetModelAlias(from, to string)

SetModelAlias adds a model alias mapping.

func (*Proxy) Stats

func (p *Proxy) Stats() *ProxyStats

type ProxyStats

type ProxyStats struct {
	TotalRequests     int64
	TotalInputTokens  int64
	TotalOutputTokens int64
	TotalSavedTokens  int64
	ByFormat          map[APIFormat]int64
	ByModel           map[string]int64
	StartTime         time.Time
	// contains filtered or unexported fields
}

ProxyStats tracks proxy usage statistics.

Jump to

Keyboard shortcuts

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