llm_providers 0.14.2

A unified source of truth for LLM providers, models, pricing, and capabilities.
Documentation

Features

  • Compile-time embedded registry (data/providers.json)
  • Endpoint-aware pricing with price_currency (USD/CNY)
  • Extended pricing: prompt/completion/cache_read/cache_write/reasoning
  • Global catalog dedupe (list_catalog_models) vs full offerings (list_offerings)
  • Official ParaRouter export CLI and JSON schema

Installation

[dependencies]
llm_providers = "0.14"

Usage

use llm_providers::{
    canonical_model_id, export_pararouter_registry, get_model_for_endpoint,
    list_catalog_models, list_offerings,
};

fn main() {
    // Endpoint-accurate pricing + currency
    let resolved = get_model_for_endpoint("minimax:cn", "MiniMax-M3").unwrap();
    assert_eq!(resolved.price_currency, "CNY");

    // Global catalog (vendor wins over resellers for duplicate ids)
    let catalog = list_catalog_models();
    println!("catalog entries: {}", catalog.len());

    // All deployable provider×endpoint×model tuples
    let offerings = list_offerings();
    println!("offerings: {}", offerings.len());

    // Canonical id helper
    assert_eq!(canonical_model_id("google/gemini-3.5-flash"), "gemini-3.5-flash");

    // Programmatic export
    let export = export_pararouter_registry();
    println!("export version: {}", export.registry_version);
}

ParaRouter Export

cargo run -- export --format pararouter --output llm_providers_registry.json

Export shape is documented in schemas/pararouter-export-v1.json:

  • catalog[] — one entry per canonical model id
  • offerings[] — every (provider_id, endpoint_id, model_id) with price_currency and global_pricing

Catalog vs Offerings

Layer Purpose
catalog Global model list keyed by official short id (gemini-3.5-flash)
offerings Routing/deploy entries including resellers (tencent, volcengine)

Reseller/aggregator prefixes like google/ are stripped by canonical_model_id() and must not be used as catalog ids.

Contributing

Edit data/providers.json, then run cargo test. See AGENTS.md and CONTRIBUTING.md.

License

MIT