gen

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 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

Overview

Package gen provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type ActivityEvent added in v0.4.0

type ActivityEvent struct {
	// Actor mesh | operator | daemon
	Actor string `json:"actor"`

	// Detail Reason / error text when there is one.
	Detail *string `json:"detail,omitempty"`

	// Kind download_started | downloaded | download_failed | loaded | unloaded | evicted | declined | missing | update_available | assignment
	Kind string `json:"kind"`

	// Message Human-readable one-liner for activity feeds.
	Message string    `json:"message"`
	Model   *string   `json:"model,omitempty"`
	Time    time.Time `json:"time"`
}

ActivityEvent defines model for ActivityEvent.

type ActivityList added in v0.4.0

type ActivityList struct {
	Events []ActivityEvent `json:"events"`
}

ActivityList defines model for ActivityList.

type Assignment

type Assignment struct {
	// Error Why it was declined or failed.
	Error *string   `json:"error,omitempty"`
	Since time.Time `json:"since"`

	// State assigned | downloading | ready | cached | declined | failed | evicted. `cached` is a mesh-placed model that is on disk but unloaded (idle unload or memory pressure); the coordinator re-sends the assignment to load it when demand returns.
	State string `json:"state"`
}

Assignment Coordinator placement status for this model, when the mesh asked for it. Failures and refusals stay visible for ten minutes.

type BadRequest

type BadRequest = Error

BadRequest defines model for BadRequest.

type CatalogEntry

type CatalogEntry struct {
	ArtifactUrl   string `json:"artifact_url"`
	ContextLength int64  `json:"context_length"`
	Default       bool   `json:"default"`

	// DisplayName Human-readable name incl. quant ("Qwen3.8 27B · Q4_K_M") — show this, not the id: ids are ambiguous now that model lines carry point versions (qwen3-8b vs qwen3.8-27b). Optional: absent when the daemon's catalog predates the field.
	DisplayName   *string `json:"display_name,omitempty"`
	Embeddings    bool    `json:"embeddings"`
	Family        string  `json:"family"`
	Id            string  `json:"id"`
	Installed     bool    `json:"installed"`
	License       string  `json:"license"`
	Loaded        bool    `json:"loaded"`
	MinRamMb      int64   `json:"min_ram_mb"`
	MinVramMb     int64   `json:"min_vram_mb"`
	ParamsB       float64 `json:"params_b"`
	PayoutClass   string  `json:"payout_class"`
	Quant         string  `json:"quant"`
	ReceivedBytes *int64  `json:"received_bytes,omitempty"`
	Sha256        string  `json:"sha256"`
	SizeBytes     int64   `json:"size_bytes"`

	// State downloading | ready; present when the artifact is local.
	State *string `json:"state,omitempty"`
}

CatalogEntry A catalog model merged with this node's local state.

type CatalogList

type CatalogList struct {
	Models []CatalogEntry `json:"models"`
}

CatalogList defines model for CatalogList.

type Disk added in v0.4.0

type Disk struct {
	BudgetBytes int64 `json:"budget_bytes"`

	// Dir Absolute path of the model directory.
	Dir          string `json:"dir"`
	FreeBytes    int64  `json:"free_bytes"`
	ModelsBytes  int64  `json:"models_bytes"`
	PartialBytes int64  `json:"partial_bytes"`
}

Disk Model store usage. `models_bytes` counts complete artifacts, `partial_bytes` counts resumable `.partial` downloads, `budget_bytes` is `models.max_disk_mb` (0 = unlimited), `free_bytes` is free space on the volume holding the model directory.

type DownloadStatus

type DownloadStatus struct {
	Ok bool `json:"ok"`

	// State downloading | ready
	State string `json:"state"`
}

DownloadStatus defines model for DownloadStatus.

type Earnings

type Earnings struct {
	EarnedCredits      float64 `json:"earned_credits"`
	EarnedMicrocredits int64   `json:"earned_microcredits"`
	EscrowCredits      float64 `json:"escrow_credits"`
	EstUsd             float64 `json:"est_usd"`
	EstUsdPerDay       float64 `json:"est_usd_per_day"`
	LifetimeTokens     int64   `json:"lifetime_tokens"`
	Note               string  `json:"note"`
}

Earnings defines model for Earnings.

type EnrollNodeJSONRequestBody

type EnrollNodeJSONRequestBody = EnrollRequest

EnrollNodeJSONRequestBody defines body for EnrollNode for application/json ContentType.

type EnrollRequest

type EnrollRequest struct {
	ClaimCode string `json:"claim_code"`
}

EnrollRequest defines model for EnrollRequest.

type EnrollResponse

type EnrollResponse struct {
	CertExpiresAt time.Time `json:"cert_expires_at"`
	NodeId        string    `json:"node_id"`
	Ok            bool      `json:"ok"`
}

EnrollResponse defines model for EnrollResponse.

type Error

type Error struct {
	Error struct {
		Message string `json:"message"`
		Type    string `json:"type"`
	} `json:"error"`
}

Error defines model for Error.

type GetCatalogParams

type GetCatalogParams struct {
	// Refresh Force a refetch instead of the cached copy (15 min TTL).
	Refresh *bool `form:"refresh,omitempty" json:"refresh,omitempty"`
}

GetCatalogParams defines parameters for GetCatalog.

type GetLogsParams

type GetLogsParams struct {
	// N Max entries to return (default 200). `limit` is an accepted alias.
	N *int `form:"n,omitempty" json:"n,omitempty"`

	// Limit Alias for `n`.
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}

GetLogsParams defines parameters for GetLogs.

type Gpu

type Gpu struct {
	Accel         string `json:"accel"`
	Model         string `json:"model"`
	UnifiedMemory bool   `json:"unified_memory"`
	Vendor        string `json:"vendor"`
	VramMb        int64  `json:"vram_mb"`
}

Gpu defines model for Gpu.

type Hardware

type Hardware struct {
	Arch     string `json:"arch"`
	CpuCores int64  `json:"cpu_cores"`
	CpuModel string `json:"cpu_model"`
	Gpus     []Gpu  `json:"gpus"`
	Os       string `json:"os"`
	RamMb    int64  `json:"ram_mb"`
}

Hardware defines model for Hardware.

type Health

type Health struct {
	Ok      bool   `json:"ok"`
	Version string `json:"version"`
}

Health defines model for Health.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type Limits

type Limits struct {
	IdleAfterSeconds int `json:"idle_after_seconds"`

	// IdleUnloadSeconds Unload a loaded model after this long without a request (0 = never; default model exempt). Omitted on PUT = unchanged.
	IdleUnloadSeconds *int `json:"idle_unload_seconds,omitempty"`

	// MaxDiskMb Model store budget (`models.max_disk_mb`); 0 = unlimited. LRU eviction of unpinned models keeps the store under it. Omitted on PUT = unchanged.
	MaxDiskMb *int64 `json:"max_disk_mb,omitempty"`

	// MaxRamMb Memory budget for loaded models (`budget.max_ram_mb`); 0 = auto (about half of physical memory on unified-memory machines, the GPU budget on discrete GPUs). Omitted on PUT = unchanged.
	MaxRamMb       *int64  `json:"max_ram_mb,omitempty"`
	MaxTempCelsius float64 `json:"max_temp_celsius"`

	// MeshManaged Let the mesh place models on this node (download, load, and evict what it placed) inside `models.max_disk_mb`, minus your pinned and excluded models. Off means the node serves only what you installed. Omitted on PUT = unchanged.
	MeshManaged *bool `json:"mesh_managed,omitempty"`

	// RetentionDays Evict unpinned models not used for this many days (0 = never). Omitted on PUT = unchanged.
	RetentionDays *int `json:"retention_days,omitempty"`

	// Schedule Windows like "22:00-08:00" (overnight wraps).
	Schedule       []string `json:"schedule"`
	ServeOnBattery bool     `json:"serve_on_battery"`

	// ServePolicy always | idle-only | scheduled
	ServePolicy       string `json:"serve_policy"`
	YieldGraceSeconds int    `json:"yield_grace_seconds"`
}

Limits defines model for Limits.

type LogEntry

type LogEntry struct {
	Attrs   *string   `json:"attrs,omitempty"`
	Level   string    `json:"level"`
	Message string    `json:"message"`
	Time    time.Time `json:"time"`
}

LogEntry defines model for LogEntry.

type LogList

type LogList struct {
	Logs []LogEntry `json:"logs"`
}

LogList defines model for LogList.

type Memory added in v0.4.0

type Memory struct {
	BudgetMb int64 `json:"budget_mb"`
	TotalMb  int64 `json:"total_mb"`
	UsedMb   int64 `json:"used_mb"`
}

Memory Model memory on this node. `used_mb` is the measured footprint of every loaded runtime (physical footprint / proportional set size, not RSS, so mmap'd weight pages shared with the page cache are not double counted). `budget_mb` is what the daemon lets loaded models use in total before it unloads idle instances or declines a load.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type ModelID

type ModelID = string

ModelID defines model for ModelID.

type ModelList

type ModelList struct {
	Models []ModelRow `json:"models"`
}

ModelList defines model for ModelList.

type ModelRow

type ModelRow struct {
	// Assignment Coordinator placement status for this model, when the mesh asked for it. Failures and refusals stay visible for ten minutes.
	Assignment *Assignment `json:"assignment,omitempty"`
	Default    bool        `json:"default"`
	Id         string      `json:"id"`

	// IdleSince Present while loaded and not serving; the daemon unloads the instance after `idle_unload_seconds` (default model exempt).
	IdleSince *time.Time `json:"idle_since,omitempty"`
	LastUsed  time.Time  `json:"last_used"`
	Loaded    bool       `json:"loaded"`

	// LoadedMb Measured memory footprint; present only while loaded.
	LoadedMb *int64 `json:"loaded_mb,omitempty"`

	// Origin Who installed it: `operator` (you, via the app/CLI/config) or `mesh` (coordinator placement). The mesh can only evict its own; yours are never touched.
	Origin string `json:"origin"`

	// Path Absolute artifact path; present when the file exists.
	Path   *string `json:"path,omitempty"`
	Pinned bool    `json:"pinned"`

	// ReceivedBytes Live progress; present only while downloading.
	ReceivedBytes *int64 `json:"received_bytes,omitempty"`
	SizeBytes     int64  `json:"size_bytes"`

	// State assigned | downloading | ready | missing. `assigned` is a coordinator placement queued behind other work (nothing on disk yet). `missing` means the index knows the model but its file is gone from disk (deleted outside the daemon); it no longer counts against the budget and loads re-download it.
	State string `json:"state"`
}

ModelRow defines model for ModelRow.

type NotFound

type NotFound = Error

NotFound defines model for NotFound.

type Ok

type Ok struct {
	Ok bool `json:"ok"`
}

Ok defines model for Ok.

type PinModelJSONRequestBody

type PinModelJSONRequestBody = PinRequest

PinModelJSONRequestBody defines body for PinModel for application/json ContentType.

type PinRequest

type PinRequest struct {
	Pinned bool `json:"pinned"`
}

PinRequest defines model for PinRequest.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	http.Handler
}

ServeMux is an abstraction of http.ServeMux.

type ServerInterface

type ServerInterface interface {
	// GetActivity Recent node activity (downloads, loads, evictions, declines)
	// (GET /api/v1/activity)
	GetActivity(w http.ResponseWriter, r *http.Request)
	// GetCatalog Model catalog merged with local state
	// (GET /api/v1/catalog)
	GetCatalog(w http.ResponseWriter, r *http.Request, params GetCatalogParams)
	// GetEarnings Node earnings (simulated until enrolled with a real ledger)
	// (GET /api/v1/earnings)
	GetEarnings(w http.ResponseWriter, r *http.Request)
	// EnrollNode Enroll (or re-enroll) this node with the coordinator
	// (POST /api/v1/enroll)
	EnrollNode(w http.ResponseWriter, r *http.Request)
	// GetHealth Liveness probe
	// (GET /api/v1/health)
	GetHealth(w http.ResponseWriter, r *http.Request)
	// GetLimits Live governor limits
	// (GET /api/v1/limits)
	GetLimits(w http.ResponseWriter, r *http.Request)
	// UpdateLimits Update governor limits
	// (PUT /api/v1/limits)
	UpdateLimits(w http.ResponseWriter, r *http.Request)
	// GetLogs Recent daemon log entries (ring buffer)
	// (GET /api/v1/logs)
	GetLogs(w http.ResponseWriter, r *http.Request, params GetLogsParams)
	// ListModels Locally installed models
	// (GET /api/v1/models)
	ListModels(w http.ResponseWriter, r *http.Request)
	// DeleteModel Delete a model from disk (and unload it if loaded)
	// (DELETE /api/v1/models/{id})
	DeleteModel(w http.ResponseWriter, r *http.Request, id ModelID)
	// SetDefaultModel Serve this model when a request names none (must be loaded)
	// (POST /api/v1/models/{id}/default)
	SetDefaultModel(w http.ResponseWriter, r *http.Request, id ModelID)
	// CancelModelDownload Cancel an in-flight download (the .partial file is kept for resume)
	// (DELETE /api/v1/models/{id}/download)
	CancelModelDownload(w http.ResponseWriter, r *http.Request, id ModelID)
	// StartModelDownload Start downloading a catalog model in the background
	// (POST /api/v1/models/{id}/download)
	StartModelDownload(w http.ResponseWriter, r *http.Request, id ModelID)
	// LoadModel Load a model into the serving runtime
	// (POST /api/v1/models/{id}/load)
	LoadModel(w http.ResponseWriter, r *http.Request, id ModelID)
	// PinModel Pin or unpin a model (pinned models are never LRU-evicted)
	// (POST /api/v1/models/{id}/pin)
	PinModel(w http.ResponseWriter, r *http.Request, id ModelID)
	// UnloadModel Unload a model from the runtime (the artifact stays cached)
	// (POST /api/v1/models/{id}/unload)
	UnloadModel(w http.ResponseWriter, r *http.Request, id ModelID)
	// GetStatus Node status snapshot
	// (GET /api/v1/status)
	GetStatus(w http.ResponseWriter, r *http.Request)
	// CheckUpdate Run a version check now
	// (POST /api/v1/update/check)
	CheckUpdate(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CancelModelDownload

func (siw *ServerInterfaceWrapper) CancelModelDownload(w http.ResponseWriter, r *http.Request)

CancelModelDownload operation middleware

func (*ServerInterfaceWrapper) CheckUpdate added in v0.4.0

func (siw *ServerInterfaceWrapper) CheckUpdate(w http.ResponseWriter, r *http.Request)

CheckUpdate operation middleware

func (*ServerInterfaceWrapper) DeleteModel

func (siw *ServerInterfaceWrapper) DeleteModel(w http.ResponseWriter, r *http.Request)

DeleteModel operation middleware

func (*ServerInterfaceWrapper) EnrollNode

func (siw *ServerInterfaceWrapper) EnrollNode(w http.ResponseWriter, r *http.Request)

EnrollNode operation middleware

func (*ServerInterfaceWrapper) GetActivity added in v0.4.0

func (siw *ServerInterfaceWrapper) GetActivity(w http.ResponseWriter, r *http.Request)

GetActivity operation middleware

func (*ServerInterfaceWrapper) GetCatalog

func (siw *ServerInterfaceWrapper) GetCatalog(w http.ResponseWriter, r *http.Request)

GetCatalog operation middleware

func (*ServerInterfaceWrapper) GetEarnings

func (siw *ServerInterfaceWrapper) GetEarnings(w http.ResponseWriter, r *http.Request)

GetEarnings operation middleware

func (*ServerInterfaceWrapper) GetHealth

func (siw *ServerInterfaceWrapper) GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth operation middleware

func (*ServerInterfaceWrapper) GetLimits

func (siw *ServerInterfaceWrapper) GetLimits(w http.ResponseWriter, r *http.Request)

GetLimits operation middleware

func (*ServerInterfaceWrapper) GetLogs

GetLogs operation middleware

func (*ServerInterfaceWrapper) GetStatus

func (siw *ServerInterfaceWrapper) GetStatus(w http.ResponseWriter, r *http.Request)

GetStatus operation middleware

func (*ServerInterfaceWrapper) ListModels

func (siw *ServerInterfaceWrapper) ListModels(w http.ResponseWriter, r *http.Request)

ListModels operation middleware

func (*ServerInterfaceWrapper) LoadModel

func (siw *ServerInterfaceWrapper) LoadModel(w http.ResponseWriter, r *http.Request)

LoadModel operation middleware

func (*ServerInterfaceWrapper) PinModel

func (siw *ServerInterfaceWrapper) PinModel(w http.ResponseWriter, r *http.Request)

PinModel operation middleware

func (*ServerInterfaceWrapper) SetDefaultModel

func (siw *ServerInterfaceWrapper) SetDefaultModel(w http.ResponseWriter, r *http.Request)

SetDefaultModel operation middleware

func (*ServerInterfaceWrapper) StartModelDownload

func (siw *ServerInterfaceWrapper) StartModelDownload(w http.ResponseWriter, r *http.Request)

StartModelDownload operation middleware

func (*ServerInterfaceWrapper) UnloadModel

func (siw *ServerInterfaceWrapper) UnloadModel(w http.ResponseWriter, r *http.Request)

UnloadModel operation middleware

func (*ServerInterfaceWrapper) UpdateLimits

func (siw *ServerInterfaceWrapper) UpdateLimits(w http.ResponseWriter, r *http.Request)

UpdateLimits operation middleware

type Stats

type Stats struct {
	EarnedMicrocredits int64   `json:"earned_microcredits"`
	Inflight           int     `json:"inflight"`
	RequestsPerMin     float64 `json:"requests_per_min"`
	TokensPerSec1m     float64 `json:"tokens_per_sec_1m"`
	TotalRequests      int64   `json:"total_requests"`
	TotalTokens        int64   `json:"total_tokens"`
}

Stats defines model for Stats.

type Status

type Status struct {
	// CertExpiresAt Client-certificate expiry; present when enrolled.
	CertExpiresAt *time.Time `json:"cert_expires_at,omitempty"`
	DefaultModel  string     `json:"default_model"`

	// Disk Model store usage. `models_bytes` counts complete artifacts, `partial_bytes` counts resumable `.partial` downloads, `budget_bytes` is `models.max_disk_mb` (0 = unlimited), `free_bytes` is free space on the volume holding the model directory.
	Disk     Disk      `json:"disk"`
	Enrolled bool      `json:"enrolled"`
	Hardware *Hardware `json:"hardware,omitempty"`
	Inflight int       `json:"inflight"`

	// Memory Model memory on this node. `used_mb` is the measured footprint of every loaded runtime (physical footprint / proportional set size, not RSS, so mmap'd weight pages shared with the page cache are not double counted). `budget_mb` is what the daemon lets loaded models use in total before it unloads idle instances or declines a load.
	Memory       Memory `json:"memory"`
	ModelsLoaded int    `json:"models_loaded"`

	// NodeId Key fingerprint until enrolled; coordinator-assigned id after.
	NodeId     string `json:"node_id"`
	OnBattery  bool   `json:"on_battery"`
	Standalone bool   `json:"standalone"`

	// State serving | yielded | paused-battery | paused-thermal | outside-schedule
	State       string  `json:"state"`
	Stats       Stats   `json:"stats"`
	TempCelsius float64 `json:"temp_celsius"`

	// Update Result of the last version check against the mesh's version feed. `minimum` is the oldest daemon the coordinator still serves; below it the node is drained until updated.
	Update        *Update `json:"update,omitempty"`
	UptimeSeconds int64   `json:"uptime_seconds"`
	Version       string  `json:"version"`
}

Status defines model for Status.

type StdHTTPServerOptions

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type Unauthorized

type Unauthorized = Error

Unauthorized defines model for Unauthorized.

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type Unsupported

type Unsupported = Error

Unsupported defines model for Unsupported.

type Update added in v0.4.0

type Update struct {
	Available    bool      `json:"available"`
	BelowMinimum *bool     `json:"below_minimum,omitempty"`
	CheckedAt    time.Time `json:"checked_at"`
	Current      string    `json:"current"`
	Latest       string    `json:"latest"`
	Minimum      *string   `json:"minimum,omitempty"`

	// Url Release page / download for `latest`.
	Url *string `json:"url,omitempty"`
}

Update Result of the last version check against the mesh's version feed. `minimum` is the oldest daemon the coordinator still serves; below it the node is drained until updated.

type UpdateLimitsJSONRequestBody

type UpdateLimitsJSONRequestBody = Limits

UpdateLimitsJSONRequestBody defines body for UpdateLimits for application/json ContentType.

type Upstream

type Upstream = Error

Upstream defines model for Upstream.

Jump to

Keyboard shortcuts

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