Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscoveredModel ¶ added in v0.9.0
type DiscoveredModel struct {
ID string
Details json.RawMessage
}
DiscoveredModel is one model entry returned by an upstream /models endpoint. Details retains the complete response object so diagnostics are not limited to the standard OpenAI fields.
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)
type ModelDiscovery ¶ added in v0.9.0
type ModelDiscovery struct {
Backend string
URL string
StatusCode int
Models []DiscoveredModel
Err error
}
ModelDiscovery describes the result of querying one configured backend.
type ModelStats ¶
type Options ¶
type Options struct {
Config *config.Config
TokenProvider auth.TokenProvider // optional global override
Metrics *Metrics
HTTPClient *http.Client
UpstreamBase string // optional global override
LogOutput io.Writer // optional request/response log destination
}
Options configures a Proxy. TokenProvider and UpstreamBase are optional global overrides (used in tests). When not set, per-backend auth and URLs from Config.Backends are used.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func New ¶
New creates a Proxy and initialises an auth provider for each configured backend. If Options.TokenProvider and/or Options.UpstreamBase are set they act as global overrides for all backends (used in tests).
func (*Proxy) DiscoverModels ¶ added in v0.9.0
func (p *Proxy) DiscoverModels(ctx context.Context) []ModelDiscovery
DiscoverModels queries every configured backend's OpenAI-compatible /models endpoint using the same HTTP and authentication configuration as proxy calls. A failed backend is returned alongside successful results so the TUI can show a complete diagnostic picture.
type RequestRecord ¶
type Snapshot ¶
type Snapshot struct {
TotalRequests int64
ModelRequests int64
Active int64
Successes int64
Failures int64
InputTokens int64
OutputTokens int64
ThinkingTokens int64
CachedTokens int64
TotalTokens int64
TotalCostUSD float64
StatusCodes map[int]int64
Models map[string]ModelStats
Recent []RequestRecord
}
func (Snapshot) SortedModelNames ¶
type StaticTokenProvider ¶
type StaticTokenProvider string