Importing custom GGUF and Safetensors models into Ollama

Import your own fine-tuned or approved model weights into a self-hosted Ollama server using a Modelfile, with quantization done beforehand and models kept in a private internal catalog.

On this page

Why teams import custom GGUF and Safetensors models into Ollama

Teams import custom GGUF and Safetensors models into Ollama when a fine-tuned or approved model must run on infrastructure they control instead of being pulled from ollama.com. The import turns weight files you already hold into a named model that the local Ollama server can load and serve. An import is two things: the weight file (GGUF, or Safetensors that Ollama converts during creation) and a Modelfile that names the source with FROM, sets default parameters and defines the chat template. The Modelfile is what makes the model repeatable, because every server built from it gets the same source and settings.

Teams usually need an import in three situations: a model they fine-tuned on internal data, a base model that legal or security approved after its own review, or a model they quantized themselves to fit their hardware. In each case the model never has to leave the environment. Ollama states that when it runs locally it does not see your prompts or data, and cloud features can be turned off with OLLAMA_NO_CLOUD=1 or the server configuration file. Confirm that setting in the version you deploy, and check that no other tool on the server sends requests elsewhere.

Before importing, check the license of the weights, not only the MIT license of Ollama itself. Ollama's MIT license covers the runtime, while each model carries its own terms that may limit commercial use, redistribution, or derivative models. Ask whether your fine-tune inherits restrictions from its base model, and keep the license text with the Modelfile so a reviewer can trace it. The Ollama pricing page confirms that running models on your own hardware is unlimited, so licensing and data handling, not runtime fees, are the decisions that remain for this import.

Choosing between GGUF and Safetensors imports and quantization paths

This table compares four ways to bring custom weights into a self-hosted Ollama server: importing a GGUF file, converting Safetensors, quantizing with llama.cpp first, and handling sharded files. Read each row for when the route fits, how much preparation it takes, and what to verify before the model reaches your internal catalog.

Import routeWhen it fitsPreparation effortWhat to verify
GGUF already quantizedThe team has a finished GGUF file from a trusted build pipeline and the quantization is already approvedLow: create a Modelfile with FROM pointing to the file, then importArchitecture support in your Ollama version, chat template match, license terms in the file metadata and your Modelfile
Safetensors requiring conversionFine-tuned weights arrive as Safetensors from a training run and no GGUF exists yetMedium to high: convert with llama.cpp tooling, then validate the output before importArchitecture is supported by the converter, tokenizer files are present and match the base model, output loads and answers as expected
Quantize with llama.cpp before importHardware has tight memory and the approved quantization level must be produced in-house and recordedMedium: a conversion step plus a quantization step, each repeated for every new model versionQuantization type is documented, the same source weights produce the same artifact, outputs are re-tested against the unquantized reference
Sharded filesLarge weights are split into several Safetensors or GGUF parts by the training or hosting toolMedium: confirm the shard set is complete and merge or convert it as the chosen tooling requiresEvery shard is present, index files are consistent, checksums match the source and the merged model loads without errors
Tokenizer and template matchApplies to every route, because a mismatch can produce unusable output without a load errorLow to medium: copy or confirm tokenizer and template files from the base modelTemplate in the Modelfile matches the model's expected prompt format and stop tokens after import
License termsApplies to every route, especially for fine-tunes of third-party base modelsLow: review and record the license in the Modelfile LICENSE instructionBase model license permits your use and redistribution scope, confirmed with legal before the model enters the catalog

How to import and verify a custom model on your own server

This sequence takes a fine-tuned or approved model from downloaded weights to a verified, internally hosted Ollama model that answers through the local API. Each step ends with a check, so the team knows whether to move on or go back.

  1. Confirm weights license and provenance

    Before any file touches the server, the model owner and the security or legal reviewer confirm where the weights came from, which base model they derive from, and which license governs redistribution and internal use. Record the source, checksum, base model name and license text in the internal model catalog entry. Done means every file has a recorded hash and an approved license, and the reviewer has signed off on the catalog record. If the license is unclear, stop here and confirm it with the rights holder rather than guessing from the model card.

  2. Prepare files with llama.cpp tooling

    Engineers convert Safetensors weights to GGUF with the conversion scripts that ship with llama.cpp, and quantize the result with its quantization tool if the team needs a smaller footprint. Sharded Safetensors files must all be present and loaded from the same export before conversion. Check the output by confirming the file count, the file sizes and the quantization level, and by recording the checksum of the final GGUF. Confirm the converter version matches the architecture of the base model, because an unsupported architecture fails here or produces a model that loads but answers poorly.

  3. Write the Modelfile

    Create a Modelfile that points FROM at the local GGUF file or a reviewed base model, and set TEMPLATE, PARAMETER and SYSTEM values that match what the model was trained to expect. Copy the chat template from the base model or the model documentation instead of writing it from memory, and confirm it matches the base architecture. Keep the file in version control next to the catalog record. Done means the file parses without errors and every referenced path exists on the build host.

  4. Create the model on a test server

    On a test server that is not yet serving users, run the create command against the Modelfile so Ollama imports the weights into its model store. Set OLLAMA_MODELS if the store should live on a dedicated volume. Confirm the model appears in the local model list with the expected name and size, and that the server has no outbound calls to ollama.com during creation. Network logs or a firewall deny rule can show this. If the create step pulls anything from the internet, treat the build as failed until the source is identified.

  5. Run a smoke test through the local API

    Send a short request to the native API on port 11434, first with a fixed prompt whose answer is known, then with a multi-turn chat request. Check that the response is coherent, that the output follows the template and stop behavior, and that the server log shows no template or architecture warnings. Test from a second host to confirm the bind address and firewall behave as designed. Done means the expected answer comes back and no request reaches an external endpoint.

  6. Confirm the model is loaded with ollama ps

    Run the process listing command while the model is answering a request to confirm it is loaded, the processor split between GPU and CPU, and the context length allocated. Compare the allocated context with the value the team set, because the model may load with a smaller default. Record the output in the test report. Done means the model shows as loaded on the expected hardware and the allocated context matches the Modelfile or server setting.

  7. Verify data stays on the internal host

    Confirm that the model store, the Modelfile and the server configuration sit on approved internal storage, and that the server can run with cloud features disabled, for example with OLLAMA_NO_CLOUD=1. Review the firewall rules and outbound logs to show no prompt or response data leaves the network during the smoke test. Attach this evidence and the checksums to the catalog record. Done means the security reviewer can see where the weights live, what the server reaches and who approved the model for production.

How weights move from training output to a private Ollama catalog

The path starts with a fine-tuned checkpoint or an approved release in Safetensors or GGUF form. Conversion and quantization with llama.cpp produce a GGUF file, which is then referenced by a reviewed Modelfile and loaded with ollama create on a server inside your network. The model is recorded in an internal catalog, and clients reach it only through an authenticating proxy, because the local Ollama API does not require authentication. Check each hand-off, especially the Modelfile and the proxy, before a model is published.

The trust boundary sits around the Ollama server, the catalog and the authenticating proxy.

Keeping imported models in a private internal catalog instead of ollama.com

Ollama can keep every imported model on servers you control, so pushing to ollama.com never has to happen by default. The cards below cover the parts that make an internal catalog work: where weights live, how definitions are versioned, how entries are named, who may create models, how copies move between servers, and what each entry records.

Storage location with OLLAMA_MODELS

Set OLLAMA_MODELS on every server that hosts the catalog so model blobs and manifests land on a volume you back up and size on purpose, rather than the default user or service directory. Confirm that the service account can write to the new path and that the directory survives restarts, container rebuilds and OS upgrades. Ask your team to document the path in the same runbook as the server's backup schedule.

Ollama FAQ

Modelfile versioning in source control

Treat each Modelfile as source code. Keep the FROM path, parameters, template and license text in a Git repository alongside the conversion notes, so a reviewer can see exactly which weights and settings produced a given model tag. Require a pull request for changes to shared Modelfiles, and tag the repository commit that matches each published model version.

Naming and tagging conventions

Agree on a pattern for model names and tags before the first import, for example one that encodes the owning team, the base family, the quantization and a version number. Predictable names make it possible to roll back a client to a previous tag and to tell at a glance whether a model is approved for a given data classification. Write the convention down and reject imports that do not follow it.

Limiting who can create models

Decide who may run ollama create against the shared server. Creating a model imports weights and settings that every user of that server will then load, so this is a change-control decision, not a convenience. Restrict write access to the host with operating system groups or container permissions, and put the approval step in your release process. Confirm how access works on your deployment, since the local API itself has no authentication.

Copying models between internal servers

Plan how an approved model reaches staging, production and any restricted network. Options include copying the model directory between hosts with checksums, or rebuilding from the same weights and Modelfile on each server. Rebuilding from source keeps a single approved artifact per version, while copying preserves the exact bytes. Whichever you choose, verify that the copied model reports the same details on every server before users reach it.

Recording hash and license per entry

For each catalog entry, record the SHA-256 hash of the source weight files, the base model identifier, the license text and its acceptance date, the quantization method and the approving owner. The hash lets you prove later that the running model matches the approved file. The license record shows whether internal use, redistribution or commercial use was permitted when the model was approved.

What does it cost and take to import a custom model into Ollama?

Does running Ollama on our own hardware cost money?

Running Ollama on your own hardware is free of per-use fees. Ollama's pricing page states that running models on your own hardware is always unlimited, and its paid plans cover cloud models rather than local inference. The Pro, Max, Team and Enterprise plans are priced separately and only matter if you choose to use Ollama's cloud. Your real costs are the servers, GPUs, storage, power, and the staff time to build, test and run the service. Ask your team to confirm the current pricing page terms before you budget, since plan details can change.

What makes importing a custom model take more or less effort?

Effort depends mostly on how far the model is from a format Ollama can load directly and how much testing it needs. The main drivers are:

  • Format conversion: Safetensors weights may need quantizing to GGUF with llama.cpp before import, and the choice of quantization level changes both quality and memory use.
  • Template matching: the chat template, stop tokens and default parameters in the Modelfile must match what the model was trained on, or outputs degrade in ways that are hard to spot.
  • Testing: functional, quality and regression checks against the approved use cases, repeated for every version.
  • Catalog process: license records, provenance checks, naming, versioning and approval steps for each model.

A model with a clean GGUF file and a known template is a small job. A sharded model with a custom template and a formal approval process is a larger one.

Can an internal team import custom models without outside help?

Yes, a platform team with Linux and GPU experience can import models on its own, especially if it imports a few models in a known format. The skills needed are familiarity with the Modelfile, llama.cpp quantization, model file handling and a test process that compares outputs before release. The harder part is often building the repeatable process: a private catalog, version control for Modelfiles, sign-off from security and compliance, and a way to retire old versions. Teams with few engineers often find that this process work competes with their other platform tasks. A partner can build the process once, and your team then runs it.

What do we need to provide before an import project starts?

Prepare the inputs before work begins so the first days are not spent chasing them. Typical requirements include:

  • The model weights, with their exact file format and any shard files, and the base model they were derived from.
  • Written license records for the base model and any fine-tuning data, including any restrictions on internal use.
  • A test server that matches the production hardware or a close equivalent, with network access restricted as your policy requires.
  • Access to the GPU hardware and the Ollama installation, plus a named owner who can approve each model.
  • Sample prompts and expected outputs from the business users who will rely on the model.

Ask the engagement scope to list which of these you supply and which the partner provides.

How long does it take to import models into Ollama?

The duration depends on how many models you import, how many need conversion, and how many checks each one must pass. A single GGUF model with a known template can be imported and tested quickly, while a set of Safetensors models that each need quantizing, template work and sign-off takes considerably longer. The number of approved use cases and the review cycles from security and compliance often set the pace more than the technical import. Ask any provider for a timeline built from a written list of models, formats, test cases and approval steps, and compare it against your own estimate.

Where do custom model files and approvals get stored?

Store the model files on a storage location you control and record each model in a private internal catalog. Ollama stores models in a local directory that can be moved with the OLLAMA_MODELS environment variable, so you can place them on storage that your backup and retention policies cover. The catalog should record the base model, quantization, Modelfile version, license, test results, owner and approval date for each version. Keeping this record outside public registries helps your data handling and audit evidence stay under your control. Confirm the storage path and backup approach with your platform team before the first import.

When should we bring in a partner for custom model imports?

Bring in a partner when the work involves many models, unfamiliar formats, a formal approval process or a tight schedule with no spare engineers. A partner is also useful when a compliance team needs documented evidence of how each model was sourced, converted, tested and approved. DeployOpen plans and implements self-hosted open-source platforms in infrastructure you control, and it prepares systems and evidence for compliance assessments, but it does not issue audit reports or certifications. Work is usually fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and a quote follows from that written scope.

What recurring work follows after the first custom model is live?

Each model needs ongoing care after the first import. Recurring work includes re-running tests when Ollama is upgraded, reviewing a model again when its base model or license changes, retiring old versions, and keeping the Modelfiles under version control. Ollama ships frequent releases, so your team should plan a regular review of the server version and the models it hosts. Ongoing support, upgrades and continuous testing can be covered by a retainer, and you should ask any provider to state in writing what the retainer includes and how changes to scope are priced.

How DeployOpen scopes an Ollama model import engagement

DeployOpen plans, implements and documents self-hosted Ollama inside your own infrastructure, and an engagement to import custom GGUF or Safetensors models starts with a written, fixed-scope agreement that names the models, the target hosts and the deliverables before any work begins. The scope lists which weights are in play (your fine-tuned checkpoints or approved third-party weights), which base models they derive from, whether quantization happens before import, and which Ollama servers will serve them. Each of those choices changes the work, so the scope should record them explicitly rather than leaving them to be discovered during the build.

The deliverables are the artifacts your team keeps after DeployOpen leaves: a Modelfile for each imported model with its FROM, PARAMETER, TEMPLATE, SYSTEM and LICENSE settings recorded, a private internal catalog process describing how approved models are added, versioned and retired without publishing them to ollama.com, and runbooks covering import, rollback and removal. Ask for the exact file list, the naming and versioning convention and the acceptance criteria in the scope document. Confirm the storage location for model files on each host, since Ollama's default paths differ by operating system and can be moved with the OLLAMA_MODELS variable.

DeployOpen does not publish a price list. A quote follows from the written scope, so the drivers to put in front of a provider are the number of models, the number of quantization variants, the number of Ollama hosts, whether your security or compliance team needs evidence of model provenance, and whether you want ongoing support after handover. Ask the provider to separate one-time import work from any recurring retainer for upgrades and re-imports, and to state in writing which items your own team must supply, such as the model files, license documents and access to the target environment.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.