Documentation
¶
Overview ¶
Package proxy wires relaykit's conversion kernel to HTTP.
The data path is deliberately one-directional and stateless:
client protocol --decode--> DTO --relaykit--> DTO --encode--> upstream upstream protocol <--encode-- DTO <--relaykit-- DTO <--decode-- client
relaykit owns every semantic decision between the two DTO hops. This package owns transport only: HTTP framing, headers, SSE, and error shapes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpstreamAuthHeaders ¶
func UpstreamAuthHeaders(format types.RelayFormat, apiKey string) map[string]string
UpstreamAuthHeaders returns the authentication headers a protocol expects. Exported so the admin UI's connectivity probe authenticates exactly the way live traffic does, rather than reimplementing the rules.
Types ¶
type Event ¶
type Event struct {
Seq uint64 `json:"seq"`
Time string `json:"time"`
Client string `json:"client"`
Upstream string `json:"upstream"`
Model string `json:"model"`
UpstreamModel string `json:"upstream_model,omitempty"`
Stream bool `json:"stream"`
Status int `json:"status"`
LatencyMS int64 `json:"latency_ms"`
Converter string `json:"converter,omitempty"`
Diagnostics int `json:"diagnostics"`
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
Error string `json:"error,omitempty"`
}
Event is one completed conversion, as shown in the admin UI.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy converts and forwards one client protocol to one upstream protocol.
The upstream is swappable at runtime: Apply publishes a new runtime snapshot atomically, so an operator can retarget the converter from the admin UI without dropping in-flight streams.
func (*Proxy) Apply ¶
Apply publishes cfg as the live upstream. The previous runtime's idle connections are released once it is no longer reachable.
func (*Proxy) EventsSince ¶
EventsSince returns the conversion history newer than seq, for the console.
func (*Proxy) EventsTotal ¶
EventsTotal is the number of conversions observed since start.