Documentation
¶
Overview ¶
Package proxy implements an OpenAI-compatible HTTP proxy server with smart routing. It classifies incoming requests, selects the cheapest capable model, and forwards to the upstream API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Version = "1.0.0"
Version is set at build time or defaults to "dev".
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Port to listen on
Port int
// Upstream API base URL (e.g. "https://api.example.com")
UpstreamBase string
// API key for upstream
UpstreamAPIKey string
// Routing config override (nil = use default)
RoutingConfig *router.RoutingConfig
}
Config controls the proxy server behavior.
type CostBreakdown ¶
type CostBreakdown struct {
Total float64 `json:"total"`
Input float64 `json:"input"`
Output float64 `json:"output"`
Baseline float64 `json:"baseline"`
SavingsPct *int `json:"savings_pct,omitempty"`
Model string `json:"model"`
Tier string `json:"tier,omitempty"`
}
CostBreakdown is the usage.cost payload injected into every routed response.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the OpenAI-compatible proxy with smart routing.
func (*Server) Close ¶
func (s *Server) Close()
Close shuts down the proxy server and its components.
func (*Server) ListenAndServe ¶
ListenAndServe starts the proxy server.
Click to show internal directories.
Click to hide internal directories.