modelcatalog

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package modelcatalog reads public models.dev metadata. Authenticated Cloud relay catalogs have a different contract and must not be decoded here.

Index

Constants

View Source
const (
	DefaultURL = "https://models.dev/api.json"
)

Variables

View Source
var (
	ErrSourceNotFound = errors.New("model catalog source not found")
	ErrProtocol       = errors.New("unsupported model catalog protocol")
)
View Source
var ErrUnavailable = errors.New("model catalog unavailable")

Functions

This section is empty.

Types

type Info

type Info struct {
	Source    string    `json:"source"`
	Revision  string    `json:"revision"`
	CheckedAt time.Time `json:"checked_at"`
	Stale     bool      `json:"stale"`
}

type Model

type Model struct {
	ModelID string             `json:"model_id"`
	Name    string             `json:"name,omitempty"`
	Type    models.ModelType   `json:"type"`
	Config  models.ModelConfig `json:"config"`
}

Model is a normalized preview/import entry, never a persisted tenant model.

type Options

type Options struct {
	URL       string
	CachePath string
	// Now makes cache expiry deterministic in tests without wall-clock waits.
	Now func() time.Time
}

type Response

type Response struct {
	Info
	Models []Model `json:"models"`
}

type Service

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

func New

func New(logger *slog.Logger, options Options) *Service

func (*Service) Models

func (s *Service) Models(ctx context.Context, source, protocol string) (Response, error)

Models returns newly allocated normalized configs; callers cannot mutate the shared raw snapshot. A source ID never becomes a network address.

Jump to

Keyboard shortcuts

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