Unified merged model + pricing registry.
Layered precedence (highest first):
Lookups field-merge across all tiers: higher tiers fill in missing fields (like context-length and pricing) from lower tiers. The :model/source of the returned entry is the highest-precedence tier that contributed.
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 of the returned entry is the highest-precedence tier
that contributed.
All operations are by [provider-keyword, model-id].(clear-live!)Empty the live tier — useful in tests.
Empty the live tier — useful in tests.
(clear-overrides!)Empty the override tier — useful in tests.
Empty the override tier — useful in tests.
(known-providers)Set of all provider keywords any tier knows about.
Set of all provider keywords any tier knows about.
(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.
(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.
(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.
(merge-entries & entries)Merge any number of ModelEntry maps in increasing-precedence order. nil entries skipped. Returns nil when no input has a value. The highest-precedence non-nil contributor's :model/source tag wins.
Merge any number of ModelEntry maps in increasing-precedence order. nil entries skipped. Returns nil when no input has a value. The highest-precedence non-nil contributor's :model/source tag wins.
(refresh! provider-id)Hit the provider's live /models endpoint and merge results into the live tier. Returns the vector of fetched entries on success, throws ex-info on failure. No-op (returns empty vector) for providers that don't expose /models.
Hit the provider's live /models endpoint and merge results into the live tier. Returns the vector of fetched entries on success, throws ex-info on failure. No-op (returns empty vector) for providers that don't expose /models.
(refresh-all!)Refresh every supported provider's live /models. Returns a map of provider → number of entries fetched, or {:error ...} on failure per provider. Failures do not abort other providers.
Refresh every supported provider's live /models. Returns a map of
provider → number of entries fetched, or {:error ...} on failure
per provider. Failures do not abort other providers.(register-entry! provider-id model-id entry)Insert a caller-provided entry into the override tier. The supplied map can omit :model/source / :model/provider / :model/id — they will be set to (provider-id, model-id, :override). Useful for custom endpoints models.dev doesn't know about.
Insert a caller-provided entry into the override tier. The supplied map can omit :model/source / :model/provider / :model/id — they will be set to (provider-id, model-id, :override). Useful for custom endpoints models.dev doesn't know about.
(snapshot)Inspect current tier sizes (for debugging / introspection).
Inspect current tier sizes (for debugging / introspection).
(unregister-entry! provider-id model-id)Remove a caller-registered override.
Remove a caller-registered override.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |