#ollama #fetcher #model #information #convert-json

ollama_models_info_fetcher

ollama models information fetcher

4 releases

0.1.3 May 12, 2025
0.1.2 Apr 5, 2025
0.1.1 Apr 4, 2025
0.1.0 Feb 13, 2025

#2363 in Machine learning

Download history

344 downloads per month
Used in 2 crates (via omama_manager)

MIT license

24KB
458 lines

ollama_models_info_fetcher License: MIT ollama_models_info_fetcher on crates.io ollama_models_info_fetcher on docs.rs

ollama model information fetcher.

for getting every single info about ollama models, those models are hosted on Ollama

Examples

these examples are the most you will need to use !!

Example 1

You can get all models names available that are hosted on the Ollama website.

use ollama_models_info_fetcher::{fetch_all_available_models, OResult};

#[tokio::main]
async fn main() -> OResult<()> {
    // getting all models that are available on the Ollama.com !!!
    let all_models = fetch_all_available_models().await?;

    // iterating over all models names and printing them!
    for name in all_models {
        println!("{}", name);
    }
    Ok(())
}

Example 2

you can fetch and get a model info by feeding it a name !

use ollama_models_info_fetcher::{fetch_model_info, OResult};

#[tokio::main]
async fn main() -> OResult<()> {
   let info = fetch_model_info("deepseek-r1").await?;
   println!("{:?}", info);
   Ok(())
}

Example 3

you can easily convert a model to json string!

use ollama_models_info_fetcher::{convert_to_json, fetch_model_info, OResult};

#[tokio::main]
async fn main() -> OResult<()> {
    let model = fetch_model_info("deepseek-r1").await?;
    let json = convert_to_json(&model)?;
    print!("{}", json);
    Ok(())
}

Example 4

this example finalize everything , here you can export every available model to json file.

use ollama_models_info_fetcher::{
    convert_to_json, fetch_all_available_models, fetch_model_info, OResult,
};

use std::{fs::File, io::Write};

#[tokio::main]
async fn main() -> OResult<()> {
    //creating json file to write into!
    let mut f = File::create("./models.json")?;

    let all_models = fetch_all_available_models().await?;

    let mut models_info = vec![];

    for model_name in all_models {
        models_info.push(fetch_model_info(&model_name).await?);
    }
    let to_json = convert_to_json(&models_info)?;

    f.write_all(to_json.as_bytes())?;
    Ok(())
}

Dependencies

~10–27MB
~321K SLoC