Ollama4j
A Java library that wraps the Ollama server's API, giving Java applications text generation, multi-turn chat, tool and MCP tool calling, embeddings and model management against local or remote Ollama models.
Ollama4j is a Java binding for the Ollama server. It supports single-turn generation with optional streaming, multi-turn chat with conversation history and roles, and tool or function calling through annotations and tool specifications, including calling external tools over MCP.
It also supports reasoning or "thinking" outputs where the underlying model provides them, image inputs for vision-capable models, embeddings, asynchronous fire-and-forget generation, custom chat roles, and listing, pulling, creating, deleting and inspecting models.
It is distributed through Maven Central and GitHub's Maven package repository, for use with Maven or Gradle projects.