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 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].(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 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.
(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.
(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.
(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.
(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 |