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 ¶
- func NewAuditCommand(f *cmdutil.Factory) *cobra.Command
- func NewCallCommand(f *cmdutil.Factory) *cobra.Command
- func NewKeyCommand(f *cmdutil.Factory) *cobra.Command
- func NewModelCommand(f *cmdutil.Factory) *cobra.Command
- func NewProviderCommand(f *cmdutil.Factory) *cobra.Command
- func NewQuotaCommand(f *cmdutil.Factory) *cobra.Command
- func NewRouteCommand(f *cmdutil.Factory) *cobra.Command
- func NewRouterCommand(f *cmdutil.Factory) *cobra.Command
- func NewUsageCommand(f *cmdutil.Factory) *cobra.Command
- type Format
- type RouterError
- type WriteUncertainError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewModelCommand ¶
NewModelCommand assembles the model noun: one place for every model this Router knows about, whichever provider serves it.
func NewRouterCommand ¶
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.
Types ¶
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 ¶
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
Source Files
¶
- audit.go
- call.go
- call_audio.go
- call_audio_analysis.go
- call_audio_stream.go
- call_audio_task.go
- call_audio_voice.go
- call_chat.go
- call_embed.go
- call_media.go
- call_media_canonical.go
- call_media_generations.go
- call_models.go
- call_ocr.go
- call_rerank.go
- call_responses.go
- call_translate.go
- call_web.go
- client.go
- common.go
- credentials_input.go
- dataplane.go
- deprecated.go
- discovery.go
- endpoints.go
- key.go
- model.go
- model_apps_lookup.go
- model_console.go
- model_console_spec.go
- model_diag.go
- model_get.go
- model_list.go
- model_phase.go
- model_spec.go
- model_status.go
- provider.go
- provider_create.go
- provider_credentials.go
- provider_delete.go
- provider_get.go
- provider_history.go
- provider_list.go
- provider_sync.go
- provider_types.go
- provider_update.go
- provider_validate.go
- quota.go
- resolve.go
- root.go
- route.go
- table.go
- usage.go
- usage_retention.go
- users_lookup.go
- write_uncertainty.go