{"modulePath":"github.com/claude-code-launch/ccl","version":"v1.7.20","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package modelsdev\n\nPackage modelsdev fetches and parses the models.dev public model database ([https://models.dev/api.json](https://models.dev/api.json)). It owns the catalog wire format and an optional offline metadata cache. It resolves model capabilities and AI SDK providers without knowing CCL's provider configuration, credentials or protocol dispatch.\n\nmodels.dev is the metadata source OpenCode itself uses to decide which AI SDK provider (and therefore which wire protocol) each model speaks. A provider carries a default npm package (e.g. \"@ai-sdk/openai-compatible\") and individual models may override it via their own provider.npm field.\n\n## Functions\n\n```go\nfunc CachePath() (string, error)\n```\nCachePath is separate from provider configuration and OAuth credentials.\n\n```go\nfunc CacheStamp() string\n```\nCacheStamp lets an explicitly requested proxy start notice a metadata refresh without reading/decoding the catalog or changing provider config.\n\n```go\nfunc Fetch(ctx context.Context) (map[string]Provider, error)\n```\nFetch downloads and decodes the models.dev catalog. The top level is a map of provider id → provider with no envelope key, so it is decoded with a raw map and tolerant of entries that do not parse into a full provider (they are skipped rather than failing the whole fetch).\n\n```go\nfunc ResolvedNPM(p Provider, m Model) string\n```\nResolvedNPM returns the AI SDK package that describes a model's protocol: the model-level provider.npm when present, otherwise the provider default.\n\n## Types\n\n```go\ntype Cache struct {\n\tPath   string\n\tURL    string\n\tClient *http.Client\n}\n```\nCache downloads public metadata only; it never receives provider credentials. URL and Client can point to local services in isolated tests.\n\n```go\nfunc (c *Cache) Index() (*Index, error)\n```\n\n```go\nfunc (c *Cache) Refresh(ctx context.Context) (*Snapshot, error)\n```\n\n```go\ntype Index struct {\n\t// contains filtered or unexported fields\n}\n```\nIndex retains only reasoning metadata and exact aliases from a catalog. It is immutable after construction and safe for concurrent lookups.\n\n```go\nfunc CachedIndex() (*Index, error)\n```\nCachedIndex is read-only and performs no network access. A cached immutable index is reused until the snapshot file changes (for example via ccl set).\n\n```go\nfunc (index *Index) Efforts(providerID, modelID, displayName string) ([]string, bool)\n```\nEfforts resolves an exact provider entry first, then a canonical/reference entry. Conflicting equal-priority aliases are not merged or guessed. Found with an empty slice means the model has no selectable reasoning tiers. The returned slice is a copy so callers cannot mutate the shared index.\n\n```go\ntype Model struct {\n\tID               string            `json:\"id\"`\n\tName             string            `json:\"name\"`\n\tStatus           string            `json:\"status\"`\n\tProvider         *ModelProvider    `json:\"provider\"`\n\tLimit            ModelLimit        `json:\"limit\"`\n\tCanonicalID      string            `json:\"canonical_model_id\"`\n\tReasoning        bool              `json:\"reasoning\"`\n\tReasoningOptions []ReasoningOption `json:\"reasoning_options\"`\n}\n```\nModel is a single model under a provider. Status is optional (\"deprecated\", \"beta\", …); most models omit it.\n\n```go\nfunc (m Model) Efforts() []string\n```\nEfforts returns reasoning tiers in slider order. Off/none is a thinking switch, not a reasoning tier; toggle and budget options do not invent tiers.\n\n```go\ntype ModelLimit struct {\n\tContext int `json:\"context\"`\n\tOutput  int `json:\"output\"`\n}\n```\nModelLimit carries the advertised context/output token limits.\n\n```go\ntype ModelProvider struct {\n\tNPM string `json:\"npm\"`\n}\n```\nModelProvider carries a model-level npm override. Absent means the model inherits its provider's default npm.\n\n```go\ntype Provider struct {\n\tID     string           `json:\"id\"`\n\tName   string           `json:\"name\"`\n\tNPM    string           `json:\"npm\"`\n\tAPI    string           `json:\"api\"`\n\tEnv    []string         `json:\"env\"`\n\tDoc    string           `json:\"doc\"`\n\tModels map[string]Model `json:\"models\"`\n}\n```\nProvider is one entry in the models.dev catalog, keyed by its id at the top level. Fields we do not consume (cost, modalities, …) are intentionally omitted.\n\n```go\ntype ReasoningOption struct {\n\tType   string   `json:\"type\"`\n\tValues []string `json:\"values\"`\n}\n```\nReasoningOption distinguishes selectable effort tiers from thinking switches and token budgets. A reasoning model need not support selectable efforts.\n\n```go\ntype Snapshot struct {\n\tProviders map[string]Provider\n\tOffline   bool\n}\n```\nSnapshot is a validated catalog fetched during configuration. Offline means refresh failed but the last valid local snapshot remains usable.\n\n```go\nfunc Refresh(ctx context.Context) (*Snapshot, error)\n```\nRefresh updates the on-disk snapshot, or returns the last valid offline copy. Call from OAuth / ccl set, never from a model request.\n\n","path":"github.com/claude-code-launch/ccl/internal/modelsdev","name":"modelsdev","synopsis":"Package modelsdev fetches and parses the models.dev public model database (https://models.dev/api.json).","isRedistributable":true}
