statusclient

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package statusclient is the CLI's HTTP client for a running kram-gateway's /admin/status: real per-provider telemetry and combo definitions, used to draw the footer and the expanded strategy panel. Nothing here is simulated — every number comes straight from the gateway's own counters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks to a kram-gateway instance's status endpoint.

func New

func New(baseURL string) *Client

New builds a client pointed at a running gateway (e.g. http://127.0.0.1:20128).

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context) (Status, error)

Fetch retrieves the current status snapshot.

func (*Client) SetStrategy added in v0.3.0

func (c *Client) SetStrategy(ctx context.Context, combo, strategy string, persist, makeDefault bool) (Combo, error)

SetStrategy changes combo's runtime strategy for future model calls. The gateway intentionally exposes this mutation only to loopback clients.

persist, when true, asks the gateway to write the change through to its config.yaml so it survives a restart; makeDefault additionally persists this combo as the config's default_combo. Both require the gateway to have an on-disk config — the gateway returns 503 otherwise, surfaced here as an error. A plain runtime switch passes false for both.

type Combo

type Combo struct {
	ID        string   `json:"id"`
	Strategy  string   `json:"strategy"`
	Providers []string `json:"providers"`
}

Combo is one entry in the gateway's status response.

type Provider

type Provider struct {
	ID          string        `json:"id"`
	Kind        string        `json:"kind"`
	BreakerOpen bool          `json:"breaker_open"`
	Stats       ProviderStats `json:"stats"`
}

Provider is one entry in the gateway's status response.

type ProviderStats

type ProviderStats struct {
	Requests         int64   `json:"requests"`
	Failures         int64   `json:"failures"`
	PromptTokens     int64   `json:"prompt_tokens"`
	CompletionTokens int64   `json:"completion_tokens"`
	AvgLatencyMS     int64   `json:"avg_latency_ms"`
	SuccessRate      float64 `json:"success_rate"`
}

ProviderStats mirrors the gateway's telemetry.ProviderStats.

type Status

type Status struct {
	Providers  []Provider `json:"providers"`
	Combos     []Combo    `json:"combos"`
	Strategies []string   `json:"strategies"`
}

Status is the full /admin/status payload.

Jump to

Keyboard shortcuts

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