Skip to main content

Create Model

This API lets you create a custom model on the Ollama server.

Create a custom model from an existing model in the Ollama server

CreateModel.java
import io.github.ollama4j.OllamaAPI;

public class CreateModel {

public static void main(String[] args) {

String host = "http://localhost:11434/";

OllamaAPI ollamaAPI = new OllamaAPI(host);

ollamaAPI.createModel(CustomModelRequest.builder().model("mario").from("llama3.2:latest").system("You are Mario from Super Mario Bros.").build());
}
}

Once created, you can see it when you use list models API.

Read more about custom model creation and the parameters available for model creation.