Skip to main content
Download a model from the Ollama model library. This endpoint supports streaming progress updates during the download.

Request

Endpoint

POST /api/pull

Request Body

model
string
required
Name of the model to pull (e.g., llama3.2, mistral:7b-instruct, codellama:latest)
stream
boolean
default:"true"
Enable streaming of download progress updates
insecure
boolean
default:"false"
Deprecated: This parameter is ignored
username
string
Deprecated: This parameter is ignored
password
string
Deprecated: This parameter is ignored

Response

Response Fields

status
string
Status message describing current operation (e.g., “pulling manifest”, “downloading”)
digest
string
Digest of the layer being downloaded
total
integer
Total size of the layer in bytes
completed
integer
Bytes downloaded so far

Examples

Pull a Model (Streaming)

curl http://localhost:11434/api/pull -d '{
  "model": "llama3.2"
}'

Example Streaming Response

{"status":"pulling manifest"}
{"status":"pulling 8daa9615cce3","digest":"sha256:8daa9615cce30c259a9555b1cc250d461d1bc69980a274b44d7eda0be78076d8","total":4661211936,"completed":0}
{"status":"pulling 8daa9615cce3","digest":"sha256:8daa9615cce30c259a9555b1cc250d461d1bc69980a274b44d7eda0be78076d8","total":4661211936,"completed":1048576}
{"status":"pulling 8daa9615cce3","digest":"sha256:8daa9615cce30c259a9555b1cc250d461d1bc69980a274b44d7eda0be78076d8","total":4661211936,"completed":4661211936}
{"status":"verifying sha256 digest"}
{"status":"writing manifest"}
{"status":"success"}

Pull with Specific Tag

curl http://localhost:11434/api/pull -d '{
  "model": "mistral:7b-instruct-q4_K_M"
}'

Non-Streaming Pull

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

Example Non-Streaming Response

{
  "status": "success"
}

Pull with Progress Bar (Python)

import requests
import json
from tqdm import tqdm

response = requests.post(
    'http://localhost:11434/api/pull',
    json={'model': 'llama3.2'},
    stream=True
)

progress_bars = {}

for line in response.iter_lines():
    if line:
        data = json.loads(line)
        
        if 'digest' in data and data.get('total'):
            digest = data['digest'][:12]  # Short digest for display
            
            if digest not in progress_bars:
                progress_bars[digest] = tqdm(
                    total=data['total'],
                    desc=f"{data['status']} {digest}",
                    unit='B',
                    unit_scale=True
                )
            
            progress_bars[digest].update(
                data['completed'] - progress_bars[digest].n
            )
            
            if data['completed'] >= data['total']:
                progress_bars[digest].close()
        else:
            print(data.get('status', ''))

Error Responses

error
string
Description of the error

Common Errors

  • 400 Bad Request: Invalid model name format
  • 404 Not Found: Model not found in the library
  • 500 Internal Server Error: Download or verification error
Model names follow the format name:tag. If no tag is specified, :latest is assumed.
Pulling a model that already exists will check for updates and download only if a newer version is available.