router

package
v0.0.0-...-048055c Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Overview

Package router hosts `olares-cli router` — Router (the Olares AI gateway, whose runtime name is still llm-gateway) together with the per-app Model Console runtime that serves locally installed models.

Two things set this tree apart from its profile-authenticated siblings.

Addressing. Router is a Market application rather than a system service, so it has no fixed subdomain the way files.<terminus> and settings.<terminus> do — app-service gives it a per-install host. Every verb therefore resolves the entrance at runtime; see discovery.go. The verbs that reach into a model application address a second host the same way, because it serves its own Model Console on its own entrance.

Identity. Configuration runs on the active profile's access token, exactly as elsewhere: the Olares edge turns it into the X-BFL-USER header that Router's console plane trusts, so authentication questions there belong to the profile verbs rather than here.

Calling a model runs on the same identity. Router's /v1 accepts an `sk-*` key, and failing that reads the caller the Olares edge names — an application's `x-caller-appid`, or a person's X-BFL-USER. That last one is the header the console plane already runs on, so `router call` presents no credential of its own unless one is named; see dataplane.go. Keys issued with `router key` remain what they were — a credential to hand to other software.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuditCommand

func NewAuditCommand(f *cmdutil.Factory) *cobra.Command

func NewCallCommand

func NewCallCommand(f *cmdutil.Factory) *cobra.Command

func NewKeyCommand

func NewKeyCommand(f *cmdutil.Factory) *cobra.Command

func NewModelCommand

func NewModelCommand(f *cmdutil.Factory) *cobra.Command

NewModelCommand assembles the model noun: one place for every model this Router knows about, whichever provider serves it.

func NewProviderCommand

func NewProviderCommand(f *cmdutil.Factory) *cobra.Command

func NewQuotaCommand

func NewQuotaCommand(f *cmdutil.Factory) *cobra.Command

func NewRouteCommand

func NewRouteCommand(f *cmdutil.Factory) *cobra.Command

func NewRouterCommand

func NewRouterCommand(f *cmdutil.Factory) *cobra.Command

NewRouterCommand assembles the `olares-cli router` subtree: Router's management surface plus the Model Console runtime behind locally installed models. Identity and transport come from the active profile, as in the market / files / settings trees.

func NewUsageCommand

func NewUsageCommand(f *cmdutil.Factory) *cobra.Command

Types

type Format

type Format string
const (
	FormatTable Format = "table"
	FormatJSON  Format = "json"
)

type RouterError

type RouterError struct {
	Method  string
	Path    string
	Status  int
	Code    string
	Type    string
	Message string
	Phase   string
	Body    []byte

	// RetryAfter is what the `Retry-After` header said, zero when it said
	// nothing. It is a header rather than a field of either envelope, so
	// nothing below formatErr can see it and the caller that renders the
	// refusal has to be handed it separately.
	RetryAfter time.Duration
}

RouterError is a non-2xx response that carried one of Router's two error envelopes. Both nest under "error" and agree on `code` and `message` — the console plane adds `details`, the OpenAI-shaped data plane adds `type` and `param` — so a single decoder serves the whole surface. The Model Console behind a local model uses the same shape and adds `phase`, which is why this client serves that host too.

func (*RouterError) Error

func (e *RouterError) Error() string

type WriteUncertainError

type WriteUncertainError struct {
	Method string
	Path   string
	Err    error
}

WriteUncertainError is a write that left this machine without an answer.

Typed rather than a formatted string, because it is a state a caller may want to branch on: an agent that can re-read a list should do that instead of retrying, and matching on the wording of a network error to decide is the kind of control flow that breaks when Go changes a message.

func (*WriteUncertainError) Error

func (e *WriteUncertainError) Error() string

func (*WriteUncertainError) Unwrap

func (e *WriteUncertainError) Unwrap() error

Jump to

Keyboard shortcuts

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