Documentation
¶
Index ¶
Constants ¶
const ( HeaderResponsesOnly = "x-metapi-responses-only" HeaderStreamOnly = "x-metapi-stream-only" HeaderEndpointPreference = "x-metapi-endpoint-preference" HeaderProtocolPreference = "x-metapi-protocol-preference" )
Site protocol preference control headers (site.custom_headers). These are configuration signals for Metapi and must not be forwarded upstream.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All() []*types.CliProfileDefinition
All returns all CLI profile definitions for registration. Callers must register them with proxy.RegisterDetectionProfile / RegisterFallbackProfile.
func Generic ¶
func Generic() *types.CliProfileDefinition
Generic returns the generic fallback profile.
func IsMetapiControlHeader ¶
IsMetapiControlHeader reports whether a custom header is a Metapi control signal that must not be forwarded to upstream. Only known preference keys are blocked; other x-metapi-* values (e.g. operator tracing headers) still pass through.
func ParseCustomHeadersJSON ¶
ParseCustomHeadersJSON parses a site.custom_headers JSON object into a flat map. Invalid / empty input yields nil. Bool values become "true"/"false"; numbers become their JSON text; other types are skipped.
Types ¶
type SiteProtocolPreference ¶
type SiteProtocolPreference struct {
// ResponsesOnly means the site should not be tried on chat/messages; only /v1/responses.
ResponsesOnly bool
// PreferResponses reorders multi-protocol candidates so responses is first (fallback allowed).
PreferResponses bool
// PreferStream forces upstream stream=true for responses (and stream-only sites).
PreferStream bool
// Source is a short debug label: platform | header | url | none.
Source string
}
SiteProtocolPreference describes how a site should be reached for chat-family traffic. some relays only expose /v1/responses (+ streaming).
func DetectSiteProtocolPreference ¶
func DetectSiteProtocolPreference(platform, siteURL string, customHeaders map[string]string) SiteProtocolPreference
Precedence (first match wins for Source; flags OR together across sources): 1. custom headers (operator mark) 2. platform (codex / known responses-stream platforms) 3. URL host markers (known responses-only relays)