Liking cljdoc? Tell your friends :D

llm.sdk.registry

Unified merged model + pricing registry.

Layered precedence (highest first):

  1. Caller overrides — register-entry! lets the SDK consumer inject custom data for endpoints the public registries don't know.
  2. Live per-provider /models fetch — populated lazily by refresh!. Authoritative for what the provider currently advertises.
  3. LiteLLM snapshot — bundled at resources/litellm-snapshot.json from llm.sdk.litellm-snapshot. Refreshable via scripts/build_litellm_snapshot.py. Wide coverage of pricing + capabilities, especially strong on Bedrock variants and less-mainstream providers.
  4. models.dev — breadth source via llm.sdk.models-dev. Includes the bundled offline snapshot as its own innermost fallback.

Lookups field-merge across all tiers: higher tiers fill in missing fields (like context-length and pricing) from lower tiers. The :model/source fields describe the highest-precedence contributor, :model/sources retains all contributors, and :model/cost-source records the highest tier that supplied pricing.

All operations are by [provider-keyword, model-id].

Unified merged model + pricing registry.

Layered precedence (highest first):
  1. Caller overrides — register-entry! lets the SDK consumer inject
     custom data for endpoints the public registries don't know.
  2. Live per-provider /models fetch — populated lazily by refresh!.
     Authoritative for what the provider currently advertises.
  3. LiteLLM snapshot — bundled at resources/litellm-snapshot.json
     from llm.sdk.litellm-snapshot. Refreshable via
     scripts/build_litellm_snapshot.py. Wide coverage of pricing +
     capabilities, especially strong on Bedrock variants and
     less-mainstream providers.
  4. models.dev — breadth source via llm.sdk.models-dev. Includes
     the bundled offline snapshot as its own innermost fallback.

Lookups field-merge across all tiers: higher tiers fill in missing
fields (like context-length and pricing) from lower tiers. The
:model/source fields describe the highest-precedence contributor,
:model/sources retains all contributors, and :model/cost-source records
the highest tier that supplied pricing.

All operations are by [provider-keyword, model-id].
raw docstring

clear-live!clj

(clear-live!)

Empty the live tier — useful in tests.

Empty the live tier — useful in tests.
sourceraw docstring

clear-overrides!clj

(clear-overrides!)

Empty the override tier — useful in tests.

Empty the override tier — useful in tests.
sourceraw docstring

known-providersclj

(known-providers)

Set of all provider keywords any tier knows about.

Set of all provider keywords any tier knows about.
sourceraw docstring

list-allclj

(list-all)

Every (provider, model) entry the registry can produce, across every known provider.

Every (provider, model) entry the registry can produce, across every
known provider.
sourceraw docstring

list-by-providerclj

(list-by-provider provider-id)

Every model the registry knows under provider-id. Each entry is the merged result across tiers. Models present in only one tier come through with that tier's data only.

Every model the registry knows under provider-id. Each entry is the
merged result across tiers. Models present in only one tier come
through with that tier's data only.
sourceraw docstring

lookupclj

(lookup provider-id model-id)

Return the merged ModelEntry for (provider, model), or nil if no layer knows the model. Field-merge order: models.dev (lowest) → litellm-snapshot → live → override.

Return the merged ModelEntry for (provider, model), or nil if no
layer knows the model. Field-merge order:
  models.dev (lowest) → litellm-snapshot → live → override.
sourceraw docstring

merge-entriesclj

(merge-entries & entries)

Merge ModelEntry maps in increasing-precedence order. nil entries are skipped. The winning tier owns the scalar source fields; all contributors remain visible in :model/sources. :model/cost-source is the highest tier that supplied any pricing.

Merge ModelEntry maps in increasing-precedence order. nil entries are
skipped. The winning tier owns the scalar source fields; all contributors
remain visible in :model/sources. :model/cost-source is the highest tier
that supplied any pricing.
sourceraw docstring

refresh!clj

(refresh! provider-id)

Replace one provider's live /models slice with the fetched snapshot. Fetch and entry validation complete before the single atomic store update. A failed fetch preserves the prior slice and marks it stale before rethrowing. Unsupported providers return an empty vector.

Replace one provider's live /models slice with the fetched snapshot.
Fetch and entry validation complete before the single atomic store update.
A failed fetch preserves the prior slice and marks it stale before rethrowing.
Unsupported providers return an empty vector.
sourceraw docstring

refresh-all!clj

(refresh-all!)

Refresh every provider currently advertising live model listing. Returns a map of provider → count, or an error per provider. Failures do not abort other providers.

Refresh every provider currently advertising live model listing. Returns a
map of provider → count, or an error per provider. Failures do not abort
other providers.
sourceraw docstring

register-entry!clj

(register-entry! provider-id model-id entry)

Insert a caller-provided entry into the override tier. The supplied map can omit source/provider/id fields; they are set to the caller-owned override tier.

Insert a caller-provided entry into the override tier. The supplied
map can omit source/provider/id fields; they are set to the caller-owned
override tier.
sourceraw docstring

snapshotclj

(snapshot)

Inspect current tier sizes (for debugging / introspection).

Inspect current tier sizes (for debugging / introspection).
sourceraw docstring

unregister-entry!clj

(unregister-entry! provider-id model-id)

Remove a caller-registered override.

Remove a caller-registered override.
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