proxy

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.6.3

type Config struct {
	Addr     string
	Upstream string
	Token    string

	User *UserInfo
}

type Proxy added in v0.6.3

type Proxy struct {
	Config
	Store *Store
}

func New added in v0.6.3

func New(cfg Config) *Proxy

func (*Proxy) Start added in v0.6.3

func (p *Proxy) Start(ctx context.Context) error

type RequestEntry

type RequestEntry struct {
	ID        string
	Timestamp time.Time

	Method string
	URL    *url.URL

	Status   int
	Duration time.Duration

	Model string

	InputTokens  int
	CachedTokens int
	OutputTokens int

	RequestBody  []byte
	ResponseBody []byte

	Error string
}

type Store

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

func (*Store) Add

func (s *Store) Add(entry RequestEntry) string

func (*Store) Get

func (s *Store) Get(id string) (RequestEntry, bool)

func (*Store) List

func (s *Store) List() []RequestEntry

func (*Store) TotalTokens

func (s *Store) TotalTokens() (input, output int)

type UserInfo

type UserInfo struct {
	Name  string
	Email string
}

Jump to

Keyboard shortcuts

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