model

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyPricingRequest

type ApplyPricingRequest struct {
	Updates []PricingUpdate `json:"updates" binding:"required"`
}

type ApplyPricingResponse

type ApplyPricingResponse struct {
	Updated int `json:"updated"`
}

type CreateRequest

type CreateRequest struct {
	ModelName   string  `json:"model_name" binding:"required"`
	InputPrice  float64 `json:"input_price"`
	OutputPrice float64 `json:"output_price"`
}

type FetchPricingRequest

type FetchPricingRequest struct {
	Source string `form:"source"` // "" = all, "basellm", "models.dev"
}

type FetchPricingResponse

type FetchPricingResponse struct {
	Matches         []PricingRecommendation `json:"matches"`
	UnmatchedModels []string                `json:"unmatched_models"`
	SourceErrors    map[string]string       `json:"source_errors,omitempty"`
}

type Handler

type Handler struct {
	FetchModelsDev func(targetURL, proxyURL string) ([]byte, error)
}

func (*Handler) ApplyPricing

func (h *Handler) ApplyPricing(c *app.Context, req ApplyPricingRequest) (ApplyPricingResponse, error)

func (*Handler) Create

func (*Handler) Delete

func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)

func (*Handler) FetchPricing

func (h *Handler) FetchPricing(c *app.Context, req FetchPricingRequest) (FetchPricingResponse, error)

func (*Handler) Get

func (*Handler) List

func (*Handler) Sync

func (h *Handler) Sync(c *app.Context, _ api.EmptyRequest) (SyncResponse, error)

func (*Handler) Update

func (h *Handler) Update(c *app.Context, req UpdateRequest) (models.ModelConfig, error)

type ListRequest

type ListRequest struct {
	api.PaginationQuery
	Search      string `form:"search"`
	PriceFilter string `form:"price_filter"`
}

type PriceCandidate added in v0.0.6

type PriceCandidate struct {
	Source      string        `json:"source"`
	Provider    string        `json:"provider"`
	MatchType   string        `json:"match_type"`
	MatchedName string        `json:"matched_name"`
	Price       PricingValues `json:"price"`
}

type PricingRecommendation added in v0.0.6

type PricingRecommendation struct {
	ModelID       uint             `json:"model_id"`
	ModelName     string           `json:"model_name"`
	Current       PricingValues    `json:"current"`
	HasPrice      bool             `json:"has_price"`
	Recommended   PricingValues    `json:"recommended"`
	Provenance    string           `json:"provenance"`
	Confidence    string           `json:"confidence"`
	ReviewReasons []string         `json:"review_reasons,omitempty"`
	HasChange     bool             `json:"has_change"`
	Candidates    []PriceCandidate `json:"candidates"`
}

type PricingUpdate

type PricingUpdate struct {
	ModelID         uint    `json:"model_id" binding:"required"`
	InputPrice      float64 `json:"input_price"`
	OutputPrice     float64 `json:"output_price"`
	CacheReadPrice  float64 `json:"cache_read_price"`
	CacheWritePrice float64 `json:"cache_write_price"`
}

type PricingValues

type PricingValues struct {
	InputPrice      float64 `json:"input_price"`
	OutputPrice     float64 `json:"output_price"`
	CacheReadPrice  float64 `json:"cache_read_price"`
	CacheWritePrice float64 `json:"cache_write_price"`
}

type SyncResponse

type SyncResponse struct {
	Created             int    `json:"created"`
	Removed             int    `json:"removed"`
	MetadataUpdated     int    `json:"metadata_updated"`
	MetadataSourceError string `json:"metadata_source_error,omitempty"`
}

type UpdateRequest

type UpdateRequest struct {
	ID     string         `uri:"id" binding:"required"`
	Fields map[string]any `json:"-"`
}

func (*UpdateRequest) SetBodyMap

func (r *UpdateRequest) SetBodyMap(fields map[string]any)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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