Liking cljdoc? Tell your friends :D

com.blockether.svar.internal.modelsdev

models.dev catalog loader.

Reads the bundled resources/models.dev.json snapshot (refreshed via make refresh-models) and exposes a normalized view that downstream router code merges with KNOWN_PROVIDERS wire/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 the bundled `resources/models.dev.json` snapshot (refreshed via
`make refresh-models`) and exposes a normalized view that downstream
router code merges with `KNOWN_PROVIDERS` wire/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 lazy load of models.dev snapshot. Map: provider-id (keyword) -> raw provider entry.

Delayed lazy load of models.dev snapshot.
Map: provider-id (keyword) -> raw provider entry.
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

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? — 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

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?       — 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
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