model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 16 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         []PricingMatch    `json:"matches"`
	UnmatchedModels []string          `json:"unmatched_models"`
	SourceErrors    map[string]string `json:"source_errors,omitempty"`
}

type Handler

type Handler struct{}

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 PricingMatch

type PricingMatch struct {
	ModelID   uint                     `json:"model_id"`
	ModelName string                   `json:"model_name"`
	Current   PricingValues            `json:"current"`
	Sources   map[string]SourcePricing `json:"sources"`
	HasPrice  bool                     `json:"has_price"`
}

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 SourcePricing

type SourcePricing struct {
	InputPrice      float64  `json:"input_price"`
	OutputPrice     float64  `json:"output_price"`
	CacheReadPrice  *float64 `json:"cache_read_price"`
	CacheWritePrice *float64 `json:"cache_write_price"`
	MatchType       string   `json:"match_type"`
	MatchedName     string   `json:"matched_name"`
}

type SyncResponse

type SyncResponse struct {
	Created int `json:"created"`
	Removed int `json:"removed"`
}

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