profiles

package
v0.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: AGPL-3.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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

func IsMetapiControlHeader(name string) bool

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

func ParseCustomHeadersJSON(raw string) map[string]string

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL