Skip to main content
Create a new model from a Modelfile, GGUF file, or safetensors format. This endpoint supports streaming progress updates during model creation.

Request

Endpoint

POST /api/create

Request Body

model
string
required
Name for the new model (e.g., my-model, namespace/model:tag)
from
string
Model name to use as base, or path to local file
files
object
Map of file paths to blob digests for model files (GGUF or safetensors)Example: {"model.gguf": "sha256:abc123...", "config.json": "sha256:def456..."}
adapters
object
Map of LoRA adapter files to include when creating the model
stream
boolean
default:"true"
Enable streaming of progress updates
quantize
string
Quantization format for the model (e.g., "Q4_0", "Q5_K_M", "Q8_0")
remote_host
string
URL of upstream Ollama API for remote models
template
string
Custom prompt template to use for the model
system
string
System prompt for the model
license
string | array
License information (string or array of strings)
parameters
object
Map of model parameters (e.g., temperature, top_k, etc.)
messages
array
List of messages to embed in the model
renderer
string
Template renderer to use
parser
string
Output parser to use (e.g., "harmony" for GPT-OSS models)
requires
string
Minimum Ollama version required by the model
info
object
Additional metadata for the model (not exposed in Modelfiles)

Response

Response Fields

status
string
Status message describing the current operation
digest
string
Digest of the layer being processed (during operations)
total
integer
Total size in bytes (during file operations)
completed
integer
Bytes completed (during file operations)

Examples

Create from Base Model

curl http://localhost:11434/api/create -d '{
  "model": "my-custom-model",
  "from": "llama3.2",
  "system": "You are a helpful coding assistant.",
  "parameters": {
    "temperature": 0.7,
    "top_p": 0.9
  }
}'

Create from GGUF File

First, upload the GGUF file:
# Upload the file and get its digest
digest=$(sha256sum model.gguf | awk '{print "sha256:" $1}')
curl http://localhost:11434/api/blobs/$digest --data-binary @model.gguf
Then create the model:
curl http://localhost:11434/api/create -d '{
  "model": "my-gguf-model",
  "files": {
    "model.gguf": "'$digest'"
  }
}'

Create with Quantization

curl http://localhost:11434/api/create -d '{
  "model": "my-quantized-model",
  "from": "llama3.2",
  "quantize": "Q4_K_M"
}'

Create from Safetensors

curl http://localhost:11434/api/create -d '{
  "model": "my-st-model",
  "files": {
    "model-00001-of-00002.safetensors": "sha256:abc123...",
    "model-00002-of-00002.safetensors": "sha256:def456...",
    "config.json": "sha256:ghi789...",
    "tokenizer.json": "sha256:jkl012..."
  }
}'

Non-Streaming Response

curl http://localhost:11434/api/create -d '{
  "model": "my-model",
  "from": "llama3.2",
  "stream": false
}'

Example Streaming Response

{"status":"parsing modelfile"}
{"status":"looking up model manifest"}
{"status":"creating model layer"}
{"status":"writing manifest"}
{"status":"success"}

Error Responses

error
string
Description of the error

Common Errors

  • 400 Bad Request: Invalid model name, missing required fields, or invalid file paths
  • 404 Not Found: Base model not found
  • 500 Internal Server Error: Error during model creation
You must provide either from (base model) or files (model files), but not both.
When creating from files, ensure all files are uploaded via /api/blobs/:digest before calling /api/create.