go.bigb.es/claudio
Index
- func CloseLogger()
- func SetHTTPDebug(enabled bool, outputPath string)
- func Start(upstreamURL string, tokenFunc func() (string, error), extraHeaders map[string]string, proxyURL string, providerName string) (addr string, shutdown func(), err error)
- func StartPassthrough(upstreamURL string, tokenFunc func() (string, error), proxyURL string, providerName string) (addr string, shutdown func(), err error)
- func StartSOCKSBridge(socksURL string) (addr string, shutdown func(), err error)
- func StaticToken(key string) func() (string, error)
- type CallRecord
- type Metrics
Variables
var DefaultMetrics = &Metrics{}
Functions
func SetHTTPDebug(enabled bool, outputPath string)
SetHTTPDebug enables or disables proxy logging with an optional output path. Must be called before any logging happens (i.e. before Start/StartPassthrough). If outputPath is empty, defaults to "./claude-proxy.log".
func Start(upstreamURL string, tokenFunc func() (string, error), extraHeaders map[string]string, proxyURL string, providerName string) (addr string, shutdown func(), err error)
Start launches a local Anthropic-to-OpenAI translation proxy. upstreamURL is the OpenAI-compatible base URL (e.g. "https://api.openai.com/v1"). Returns the proxy address (host:port), a shutdown function, and any error.
func StartPassthrough(upstreamURL string, tokenFunc func() (string, error), proxyURL string, providerName string) (addr string, shutdown func(), err error)
StartPassthrough launches a logging-only proxy that forwards requests unchanged. Used for Anthropic-compatible providers to enable logging without translation.
func StartSOCKSBridge(socksURL string) (addr string, shutdown func(), err error)
StartSOCKSBridge starts a local HTTP CONNECT proxy that forwards connections through the given SOCKS5 proxy. This allows clients that only support HTTP(S) proxies (like Node.js / Claude Code) to route through SOCKS5.
func StaticToken(key string) func() (string, error)
StaticToken returns a token function that always returns the given key.
Types
type CallRecord struct { Provider string UpstreamDomain string Endpoint string Model string StatusCode int Stream bool Duration time.Duration InputTokens int OutputTokens int Error bool QuotaProbe bool Timestamp time.Time }
CallRecord holds metrics for a single proxy call.
type Metrics struct { // contains filtered or unexported fields }
Metrics collects proxy call records for the session.
DefaultMetrics is the package-level metrics instance.