Documentation
¶
Index ¶
- Variables
- func ApplyModelCapabilities(data map[string]interface{}, caps map[string]ModelCapability, ...) int
- func Handle(args []string) error
- func HandleUsages(args []string) error
- func ParseModelCapabilities(entries []string) (map[string]ModelCapability, error)
- func PatchCodexSSEOutput(body []byte) []byte
- func ReadCodexAuth(path string) (accessToken string, accountID string, err error)
- func StartAPIProxy(baseUrl string, modelMappings []string, port string, verbose bool, ...) error
- func StartCodexProxy(baseUrl string, modelMappings []string, port string, verbose bool, ...) error
- func TransformCodexRequest(data map[string]interface{}, logf func(format string, args ...any))
- type ColorMode
- type ModelCapability
Constants ¶
This section is empty.
Variables ¶
var CapNoImage = ModelCapability{NoImage: true}
CapNoImage is a capability value with only NoImage set.
Functions ¶
func ApplyModelCapabilities ¶ added in v0.0.10
func ApplyModelCapabilities(data map[string]interface{}, caps map[string]ModelCapability, logf func(format string, args ...any)) int
ApplyModelCapabilities delegates to the unexported applyModelCapabilities so the doctest harness can exercise image stripping on decoded request bodies.
func Handle ¶ added in v0.0.6
Handle dispatches a llm-proxy CLI invocation to the doc subcommand, the usage summary, the OpenAI/Codex proxies, or a generic --base-url proxy.
func HandleUsages ¶
func ParseModelCapabilities ¶ added in v0.0.10
func ParseModelCapabilities(entries []string) (map[string]ModelCapability, error)
ParseModelCapabilities delegates to the unexported parseModelCapabilities so the doctest harness can exercise --model-capability flag parsing.
func PatchCodexSSEOutput ¶ added in v0.0.6
PatchCodexSSEOutput delegates to the unexported patchCodexSSEOutput so the doctest harness can exercise SSE output-item injection.
func ReadCodexAuth ¶ added in v0.0.6
ReadCodexAuth delegates to the unexported readCodexAuth so the doctest harness can exercise auth.json parsing against temp files.
func StartAPIProxy ¶
func StartCodexProxy ¶
func StartCodexProxy(baseUrl string, modelMappings []string, port string, verbose bool, logFile string, modelCaps map[string]ModelCapability, colorEnabled bool) error
StartCodexProxy starts a Codex OAuth proxy with the default stream behavior.
func TransformCodexRequest ¶ added in v0.0.6
TransformCodexRequest delegates to the unexported transformCodexRequest so the doctest harness can exercise system-message -> instructions adaptation.
Types ¶
type ColorMode ¶ added in v0.0.12
type ColorMode int
ColorMode selects when ANSI color is emitted, per the three-mode policy (auto / always / never). See go-best-practice cli/color.
type ModelCapability ¶ added in v0.0.10
type ModelCapability struct {
// NoImage marks a model that rejects image input upstream (e.g. a
// text-only gateway endpoint answers 404). Image content parts are
// replaced with a text note before the request leaves the proxy.
NoImage bool
// EffortMapping rewrites Anthropic output_config.effort to Command Code
// params.reasoning_effort. Keys are the client-sent effort; values are
// low, high, max, drop (omit the upstream field), or invalid (400 the
// client). A missing key leaves today's behavior (do not send reasoning_effort).
EffortMapping map[string]string
// AdjustUsageForDSH rewrites Command Code Anthropic usage so input_tokens
// is the uncached miss (DSH cache-hit % is cache_read / (input + cache_read)).
AdjustUsageForDSH bool
}
ModelCapability is the per-model limits declared via --model-capability MODEL=opt1,opt2.