Documentation — ollama-toolkit
ollama-toolkit is a Python CLI utility for exporting and importing Ollama models (.tar.gz) to streamline backups, sharing, or migration across machines.
Designed for developers, researchers, and ML teams looking to package and deploy local Ollama models with ease.
What’s It For?
- Backup a custom model locally with all its layers
- Transfer models to another environment without re-downloading
- Archive models for offline or long-term use
- Recreate a complete Ollama model from a
.tar.gzarchive
Key Features
- Export a model with all necessary files
- Generate a self-contained
.tar.gzarchive - Automatically recreate the model using
ollama create - Built-in progress bar via
tqdm - Compatible with any locally installed Ollama model
Installation
Requirements
- Python ≥ 3.7
- Ollama installed and accessible from your terminal
tqdm(installed automatically)
Install from PyPI or Source
Install via PyPI:
pip install ollama-panongbene
Or install from source:
git clone https://github.com/openDataSenegal/ollama_toolkit.git
cd ollama-toolkit
pip install .
Once installed, two global CLI commands are available:
ollama-export <model_name>
ollama-import <archive.tar.gz> <model_name>
CLI Commands
ollama-export
Exports an Ollama model to a .tar.gz archive including the Modelfile and all binary layers.
ollama-export <model_name> [-o OUTPUT] [-v]
Arguments
| Argument | Description |
|---|---|
model_name |
Name of the model to export (e.g., phi:latest) |
-o, --output |
Optional output filename for the archive (.tar.gz) |
-v, --verbose |
Enable detailed logs (e.g., Modelfile content, layers) |
Example
ollama-export llama3:instruct -o llama3_instruct.tar.gz -v
ollama-import
Imports a model from a .tar.gz archive and recreates it via ollama create.
ollama-import <archive.tar.gz> <model_name>
Arguments
| Argument | Description |
|---|---|
archive.tar.gz |
Path to the archive containing model files |
model_name |
Name to assign to the model (used during model creation) |
Example
ollama-import phi_latest.tar.gz phi:latest
Archive Structure
Each export archive includes:
phi_latest.tar.gz
├── Modelfile
├── layer0.bin
├── layer1.bin
├── ...
This structure allows full offline restoration.
Use Cases
- Seamless model transfers across machines or teams
- Use Ollama in offline or air-gapped environments
- Archive models for reproducibility and long-term access
- Avoid redundant large downloads
- Share custom
Modelfilesetups and binary layers
Can I Store Archives on External Drives or Git?
Yes — archives are fully portable. You can version them using Git LFS or store them on external media for future reuse.
Are Custom or Private Models Supported?
Absolutely.
As long as the model is installed locally in Ollama, you can export and re-import it — including custom layers and any Modelfile configuration.
Author
- Developed and maintained by Panongbene Sawadogo
- Contact: amet1900@gmail.com
License
MIT License — Free for commercial and educational use.
Metadata
Release files for ollama-panongbene 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ollama_panongbene-0.1.0.tar.gz | 9.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ollama_panongbene-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / ollama_panongbene-0.1.0.tar.gz
| Download URL | ollama_panongbene-0.1.0.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0627013aa217215b04307330b2a4ac629aade3664d28898d43e61f1b81f83fc3
|
|
BLAKE2b-256 checksum How to use checksums |
57121f1c5c91e61d0a2acc9ca748f9e9e5fcd18272684efaafdbe0178151eb6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / ollama_panongbene-0.1.0-py3-none-any.whl
| Download URL | ollama_panongbene-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57c9e8868d44fa1a65a5ce2863760154ba90f0bf12bb0c95d2e133ab137d5b32
|
|
BLAKE2b-256 checksum How to use checksums |
bc1c121734b94984269a6758e337cde3cfe3d7beedfa6d6ce50007ee6b9b9aa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|