Provider-agnostic model metadata for the Rig ecosystem.
rig-model-catalog answers one question consistently across providers:
Given a model id, what is its context window, what capabilities does it advertise, and what do I need to know to size prompts and budget tokens?
It ships a single trait — ModelMetaProbe — plus a plain-data
ModelDescriptor and a handful of backends (live Ollama, static catalogs
for OpenAI / Anthropic, and a stub for tests). The default build pulls
no HTTP client or provider SDKs; backends are opt-in via Cargo
features.
v0.1.0 — initial release. API is #[non_exhaustive] where it counts;
additive changes (new descriptor fields, new probes, new capability
variants) are not breaking.
[dependencies]
rig-model-catalog = { version = "0.1", features = ["ollama", "static"] }use rig_model_catalog::{ChainedProbe, ModelMetaProbe, OllamaProbe, StaticProbe};
# async fn run() -> anyhow::Result<()> {
let probe = ChainedProbe::new(
OllamaProbe::live("http://localhost:11434"),
StaticProbe::builtin(),
);
if let Some(desc) = probe.describe("gpt-4o").await? {
println!("context window: {:?}", desc.context_window);
println!("capabilities: {:?}", desc.capabilities);
}
# Ok(()) }Capability::Thinking means the model advertises a native reasoning channel.
For Ollama models used through Rig, callers should opt into that native
separation with think: true and still assert that user-visible output is free
of raw <think> / </think> tags.
use rig_model_catalog::{Capability, ModelMetaProbe, OllamaProbe};
let base_url = "http://localhost:11434";
let model_name = "qwen3.5:9b";
let model = ollama_client.completion_model(model_name);
let probe = OllamaProbe::live(base_url);
let descriptor = probe.describe(model_name).await?;
let supports_thinking = descriptor
.as_ref()
.is_some_and(|d| d.capabilities.contains(&Capability::Thinking));
let mut builder = rig::agent::AgentBuilder::new(model);
if supports_thinking {
builder = builder.additional_params(serde_json::json!({ "think": true }));
}
let agent = builder.build();The capability is not a sanitizer. It tells the host which provider contract to
activate. Applications that render model output directly should keep a live
smoke check equivalent to !output.contains("<think>") && !output.contains("</think>") so provider or model regressions are caught
before users see reasoning tags.
| Feature | Pulls | What you get |
|---|---|---|
| default | — | ModelMetaProbe, ModelDescriptor, StubProbe, ChainedProbe |
ollama |
reqwest |
OllamaProbe::live(...) against POST /api/show |
static |
— | StaticProbe::builtin() with bundled OpenAI + Anthropic tables |
rig-hook |
rig-core |
MetaHook + HookPair (PromptHook telemetry composition) |
observe |
rig-hook |
Re-emits MetaHook prompt lifecycle events on the rig_tap target |
pricing |
— | PricingTable + ModelPrice with bundled OpenAI + Anthropic USD/M rates and snapshot metadata |
- Unknown is normal. Probes return
Ok(None)for models they don't recognise.Erris reserved for hard failures (transport down, auth rejection, malformed response). - No
tokioin[dependencies]. The library is runtime-agnostic; tests and examples usetokiovia dev-deps. - No panics in library code. Every fallible operation is a
Resultor anOption. Clippyunwrap_used,expect_used,panic,indexing_slicing,todo,unimplemented,unreachable,dbg_macro, andawait_holding_lockaredeny/forbid. #[non_exhaustive]on the public payload. Adding fields toModelDescriptoror variants toCapabilityis not a breaking change.
Released in v0.1.0. Unreleased on main and exercised in the CI matrix:
MetaHook + HookPair (rig-hook feature), MetaHook rig_tap
emission (observe feature), PricingTable + ModelPrice (pricing feature),
RuntimeDescriptor / OllamaProbe::runtime,
ModelMetaProbeDyn + DynProbe, and a TTL Cache<P> memoiser. See
CHANGELOG.md for the full list.
PricingTable::builtin() exposes the bundled pricing snapshot date and
provenance through snapshot_date() and snapshot_provenance() so downstream
cost reports can warn on stale static rates while still overriding prices with
host-owned JSON or programmatic entries.
Still planned:
- Knowledge-cutoff + deprecation fields (additive, data files).
- Bedrock and llama.cpp probes.
- CLI:
rig-model-catalog show <provider>:<model>.
Dual-licensed under MIT or Apache-2.0 at your option.