Skip to main content

Crate ollama_client

Crate ollama_client 

Source
Expand description

§ollama-client

A Rust client library for the Ollama API.

Covers all Ollama API endpoints: chat, generate, embeddings, model management (list, show, copy, delete, pull, push, create), running models, blobs, and version.

§Async usage

use ollama_client::{OllamaClient, types::Message};

let client = OllamaClient::new();
let response = client.chat()
    .model("gemma4")
    .messages(vec![Message::user("Hello!")])
    .send()
    .await?;
println!("{}", response.message.content);

§Blocking usage (feature blocking, enabled by default)

use ollama_client::blocking::BlockingClient;
use ollama_client::types::Message;

let client = BlockingClient::new();
let response = client.chat()
    .model("gemma4")
    .messages(vec![Message::user("Hello!")])
    .send()?;
println!("{}", response.message.content);

Re-exports§

pub use client::OllamaClient;
pub use client::OllamaClientBuilder;
pub use error::OllamaError;
pub use error::Result;

Modules§

blocking
Blocking (synchronous) client and builders.
client
Async client, request builders, and client builder.
error
Error types for the Ollama client.
streaming
NDJSON streaming response parser.
types
Serde types for all Ollama API endpoints.