Liking cljdoc? Tell your friends :D

com.blockether.svar.internal.modelsdev

models.dev catalog loader.

Reads normalized provider files and model facts generated from resources/models.dev.json by make refresh-models. Router code merges these entries with the KNOWN_PROVIDERS wire and policy overlay.

Catalog wins for: pricing, context, modalities, capability flags, release dates, family. svar overlay wins for: api-style, reasoning-style, llm-headers, env-keys, base-url, paths, extra-body, exclude-models, rate budgets, default-models.

Plan-vs-retail pricing — per-provider entries on models.dev already reflect plan zeros (e.g. github-copilot, zai-coding-plan ship {input:0, output:0}). For svar's :openai-codex and :anthropic-coding-plan we explicitly want retail pricing (the user pays at API rates once metered), so the overlay declares :pricing-source to redirect catalog lookup to the retail provider.

models.dev catalog loader.

Reads normalized provider files and model facts generated from
`resources/models.dev.json` by `make refresh-models`. Router code merges
these entries with the `KNOWN_PROVIDERS` wire and policy overlay.

Catalog wins for: pricing, context, modalities, capability flags,
release dates, family.
svar overlay wins for: api-style, reasoning-style, llm-headers,
env-keys, base-url, paths, extra-body, exclude-models, rate budgets,
default-models.

Plan-vs-retail pricing — per-provider entries on models.dev already
reflect plan zeros (e.g. `github-copilot`, `zai-coding-plan` ship
{input:0, output:0}). For svar's `:openai-codex` and
`:anthropic-coding-plan` we explicitly want **retail** pricing
(the user pays at API rates once metered), so the overlay declares
`:pricing-source` to redirect catalog lookup to the retail provider.
raw docstring

catalogclj

Delayed provider index. Each entry is loaded once, on first use.

Delayed provider index. Each entry is loaded once, on first use.
sourceraw docstring

merge-overlayclj

(merge-overlay catalog-entry overlay-entry)

Merge svar wire/policy overlay onto a models.dev catalog model entry. Overlay keys win (api-style, reasoning-style, extra-body, etc). Pricing/context/modalities flow from catalog unless overlay overrides.

Merge svar wire/policy overlay onto a models.dev catalog model entry.
Overlay keys win (api-style, reasoning-style, extra-body, etc).
Pricing/context/modalities flow from catalog unless overlay overrides.
sourceraw docstring

model-factsclj

(model-facts model-name)

What the catalog knows about a model id from EVERY provider that lists it: {:families #{family ...} :release-date "yyyy-mm-dd"}, where the date is the earliest listing. nil when no provider lists the model.

What the catalog knows about a model id from EVERY provider that lists it:
`{:families #{family ...} :release-date "yyyy-mm-dd"}`, where the date is the
earliest listing. nil when no provider lists the model.
sourceraw docstring

model-keyclj

(model-key model-name)

Provider-independent lookup key for a model id: lower-cased, without an aggregator's vendor/ prefix, with dotted version separators dashed, so anthropic/claude-opus-4.8 and claude-opus-4-8 share one key.

Provider-independent lookup key for a model id: lower-cased, without an
aggregator's `vendor/` prefix, with dotted version separators dashed, so
`anthropic/claude-opus-4.8` and `claude-opus-4-8` share one key.
sourceraw docstring

normalize-modelclj

(normalize-model m)

Translate one models.dev model entry → svar-shaped model metadata.

Output keys (all optional): :name — canonical wire id (string) :display-name — human label :family — model family slug :pricing — {:input :output :cache-read :cache-write} :context — input + output budget (tokens) :input-limit — input-only cap (when separate) :output-limit — max output tokens :reasoning-options — provider-native reasoning controls :reasoning? — reasoning model flag :tool-call? — supports tools :attachment? — supports file/image input :temperature? — temperature param respected :open-weights? — open-weight model :modalities — {:input #{...} :output #{...}} :knowledge-cutoff — yyyy-mm string :release-date — yyyy-mm-dd :last-updated — yyyy-mm-dd :status — alpha, beta or deprecated when the provider flags one

Translate one models.dev model entry → svar-shaped model metadata.

Output keys (all optional):
  :name             — canonical wire id (string)
  :display-name     — human label
  :family           — model family slug
  :pricing          — {:input :output :cache-read :cache-write}
  :context          — input + output budget (tokens)
  :input-limit      — input-only cap (when separate)
  :output-limit     — max output tokens
  :reasoning-options — provider-native reasoning controls
  :reasoning?       — reasoning model flag
  :tool-call?       — supports tools
  :attachment?      — supports file/image input
  :temperature?     — temperature param respected
  :open-weights?    — open-weight model
  :modalities       — {:input #{...} :output #{...}}
  :knowledge-cutoff — yyyy-mm string
  :release-date     — yyyy-mm-dd
  :last-updated     — yyyy-mm-dd
  :status           — `alpha`, `beta` or `deprecated` when the provider flags one
sourceraw docstring

provider-metaclj

(provider-meta provider-id)

Returns top-level provider info from models.dev: {:id :env :api :name :doc :npm}

Returns top-level provider info from models.dev:
{:id :env :api :name :doc :npm}
sourceraw docstring

provider-modelsclj

(provider-models provider-id)

Returns a map of model-name (string) → normalized metadata for provider-id, pulled from the models.dev catalog.

Returns {} when the provider is unknown to models.dev.

Returns a map of model-name (string) → normalized metadata for
provider-id, pulled from the models.dev catalog.

Returns {} when the provider is unknown to models.dev.
sourceraw docstring

resolve-modelsclj

(resolve-models provider-id overlay-models {:keys [pricing-source]})

Build the final model map for a svar provider id.

Lookup chain:

  1. catalog provider = (:pricing-source overlay) or provider-id
  2. catalog model map → normalize
  3. overlay (svar-side) wins on api-style/reasoning-style/extra-body
  4. overlay-only entries (not in catalog) pass through unchanged

overlay-models is the per-model map from KNOWN_PROVIDER_MODELS.

Build the final model map for a svar provider id.

Lookup chain:
  1. catalog provider = (:pricing-source overlay) or provider-id
  2. catalog model map → normalize
  3. overlay (svar-side) wins on api-style/reasoning-style/extra-body
  4. overlay-only entries (not in catalog) pass through unchanged

`overlay-models` is the per-model map from KNOWN_PROVIDER_MODELS.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close