model

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 3 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 model defines the model vendors (Anthropic, OpenAI) and their canonical models: provider-qualified ids, the harnesses each model can be driven by, and per-token pricing.

It is a leaf domain package — it imports no other internal package — so both the controllers and the in-pod agent-runner can share one source of truth for which harness runs a model and what CLI model-id that harness expects. A model's identity (its provider-qualified ID) is independent of the executing harness: the Supported map records the harness-specific CLI id each driver needs, and Preferred names the default driver. The harness package layers resolution (ResolveModel/ValidateAllowlist) on top, filtering by which harnesses are enabled in a given deployment.

Index

Constants

View Source
const (
	ProviderAnthropic = "anthropic"
	ProviderOpenAI    = "openai"
)

Provider ids.

View Source
const (
	HarnessClaude = "claude"
	HarnessCodex  = "codex"
	HarnessFake   = "fake"
)

Harness ids, referenced by the Supported maps below. The harness package owns the Harness implementations; these constants are the shared vocabulary so the registry can name executors without importing that package.

Variables

KnownHarnessIDs is the set of harness ids the registry may name in a Supported map, in registry order — the deterministic tiebreak order for harness resolution when a model's preferred harness is not enabled.

Functions

func IsKnownHarnessID

func IsKnownHarnessID(id string) bool

IsKnownHarnessID reports whether id names a harness the registry knows.

func IsProviderID

func IsProviderID(id string) bool

IsProviderID reports whether id names a known vendor.

func UsageCostUSD

func UsageCostUSD(m Model, inputTokens, cacheReadTokens, cacheCreationTokens, outputTokens int) *float64

UsageCostUSD prices a measured token usage at the model's rates, or nil when the model has no published pricing. It is the fallback for a harness that reports no cost of its own: every input-side count (fresh input, cache reads, and cache writes) is priced at the input rate so the figure still reflects the whole session.

Types

type Model

type Model struct {
	ID         string            `json:"id"`
	ProviderID string            `json:"provider_id"`
	Name       string            `json:"name"`
	InputUSD   *float64          `json:"input_per_mtok"`
	OutputUSD  *float64          `json:"output_per_mtok"`
	Supported  map[string]string `json:"supported"`
	Preferred  string            `json:"preferred"`
}

Model is one canonical, vendor-owned model. ID is provider-qualified ("anthropic/claude-sonnet-5") and is the stable id patchy stores in config, the investigation report, and the CRDs; the executing harness never appears in it.

Supported maps each harness id that can run this model to the CLI-specific model-id string that harness's --model flag expects — this is where any harness/vendor id divergence lives. Preferred is the harness chosen when several supported harnesses are enabled; it is always a key of Supported.

InputUSD/OutputUSD are USD per 1M tokens (standard tier, cache-miss rates); nil means the vendor has not published per-token pricing. They exist so a harness that reports token usage but not cost (codex) can still be priced.

func AllModels

func AllModels(overrides map[string][]Model) []Model

AllModels returns the canonical model registry with any per-provider config override applied. overrides maps a provider id to a replacement model list (replace, not merge — partial merges create "which price won?" ambiguity); only models whose ProviderID is overridden are replaced.

func Builtins

func Builtins() []Model

Builtins returns the canonical model registry (no overrides). It is the default set patchy resolves models against.

func ModelByID

func ModelByID(models []Model, id string) (Model, bool)

ModelByID returns the model with the given canonical id from models, if any.

func (Model) BareID

func (m Model) BareID() string

BareID is the id without its provider prefix ("claude-sonnet-5") — the vendor's own model id, independent of the executing harness.

func (Model) CLIModelID

func (m Model) CLIModelID(harnessID string) (string, bool)

CLIModelID returns the harness-specific model-id string this model's --model flag expects for harnessID, and whether the harness supports it.

func (Model) Key

func (m Model) Key() string

Key is the canonical, provider-qualified id ("anthropic/claude-sonnet-5").

func (Model) SupportedHarnessIDs

func (m Model) SupportedHarnessIDs() []string

SupportedHarnessIDs lists the harness ids that can run this model, sorted for stable display.

func (Model) Supports

func (m Model) Supports(harnessID string) bool

Supports reports whether harnessID can run this model.

type Provider

type Provider struct {
	ID   string `json:"id"`   // registry key, e.g. "anthropic"
	Name string `json:"name"` // human name, e.g. "Anthropic"
}

Provider is a model vendor: the entity that owns and prices a family of models (Anthropic, OpenAI). It is distinct from a harness — the CLI that drives a model — because several harnesses can in principle run one vendor's model, and the vendor id keys pricing while the harness id keys execution.

func ProviderByID

func ProviderByID(id string) (Provider, bool)

ProviderByID returns the vendor with the given id, if any.

func Providers

func Providers() []Provider

Providers returns the model vendors in display order.

Jump to

Keyboard shortcuts

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