The model gallery is a curated collection of models configurations for LocalAI that enables one-click install of models directly from the LocalAI Web interface.
To see what the models can do, such as text, speech, images and video, see What models can do. For engines with their own page, see Engines. To fine-tune or quantize a model, see Train and quantize.
You can browse the available models on the Models page of the web interface, list them with local-ai models list, or read the gallery index on GitHub.
LocalAI to ease out installations of models provide a way to preload models on start and downloading and installing them in runtime. You can install models manually by copying them over the models directory, or use the API or the Web interface to configure, download and verify the model assets for you.
Note
The models in this gallery are not directly maintained by LocalAI. If you find a model that is not working, please open an issue on the main LocalAI repository.
Note
GPT and text generation models might have a license which is not permissive for commercial use or might be questionable or without any license at all. Please check the model license before using it. The official gallery contains only open licensed models.
How it works
Open Models in the WebUI. It is the canonical page for a model’s complete
lifecycle and has two views:
Explore browses configured galleries and installs models. It is one
dense table: each row shows the model’s size, a bar for the memory it needs at
the chosen context length, and the headroom in words (“3.7 free”, “+1.5 on
CPU”, “0.9 over”). Capability chips show how many models each one matches.
Select a row to open the details beside the table: the fit on this machine,
VRAM by context length, variants, files, links, tags and licence. This is the
default view.
Installed lists local model configurations in the same table, with their
running, idle, disabled, pinned, and distributed state and their size on disk.
Load or stop a model from its row, or select it to edit its configuration,
open a supported use case, inspect backend logs, or remove it.
Both views store the view, search, filter, and selection in the URL. Installing
from Explore does not move you away from the catalog; the entry updates in place
when the operation finishes.
Nemotron 3.5 Bolt E4B
Nemotron 3.5 Bolt E4B
is NVIDIA’s Gemma 4 E4B fine-tune for conversational assistants and tool use.
The llama.cpp entries include Unsloth’s UD-Q4_K_XL and UD-Q8_K_XL builds,
the F16 vision projector, and a 32,768-token default context.
Install with automatic variant selection:
local-ai models install nemotron-3.5-bolt-e4b-q4
To select a build explicitly, use --variant nemotron-3.5-bolt-e4b-q4
or --variant nemotron-3.5-bolt-e4b-q8.
MiniCPM-V 4.7 1B
MiniCPM-V 4.7 1B
supports text chat and image understanding through the llama.cpp backend.
The gallery includes official Q4_K_M, Q5_K_M, Q6_K, and Q8_0 GGUF builds.
Each build includes the F16 vision projector and uses an 8,192-token default context.
Install the family with automatic variant selection:
local-ai models install minicpm-v-4_7-1b-q4
Select a specific build with --variant minicpm-v-4_7-1b-q4,
--variant minicpm-v-4_7-1b-q5, --variant minicpm-v-4_7-1b-q6,
or --variant minicpm-v-4_7-1b-q8.
Repairing an existing model configuration
Gallery template updates do not rewrite YAML files for already installed models.
If an older installation puts context_size, f16, or mmap under
parameters, move those fields to the YAML root. LocalAI reads them at the
root; nested copies are ignored. Keep model and sampling options under
parameters.
For example, the relevant fields in models/qwen3-vl-4b-thinking.yaml should be:
Back up the installed YAML before editing it, preserve its other settings, and
remove the misplaced nested copies. Use your configured models directory if it
is not models. Preserve model-specific context values: supra2-100m-instruct
uses 2048, while shieldstral-1.0-3b and shieldstral-1.0-3b-q8 use 32768.
Restart LocalAI after editing so it reads the repaired configuration and reloads
the model. You do not need to download the weights again.
To take the configuration the gallery entry has now, upgrade the model (see Model updates) with
only its configuration: POST /api/models/upgrade/{name} with
{"config_only": true}. The upgrade keeps the keys you edited unless you choose
the gallery’s value, stops the model, loads the new configuration as a check,
and puts the old one back when the check fails. The older
POST /api/models/config/{id}, which rewrote the configuration at once, was
removed: it answers 410 Gone with a Link header to the upgrade route for one
release.
A model’s own page
Every model also has a page of its own at /app/models/<name>, so it can be
linked. Open it with the arrow at the end of a row, a double click on the row,
or o on the selected row. On a phone, a tap on a row opens it. The details
beside the table stay as the quick look.
The title block names the model and holds the main action: Install, with a
chevron to choose which build to install, or Load and Stop with a menu
for an installed model (disable, pin, edit configuration, logs, delete). A strip
under it answers three questions: whether the model fits this machine, what it
does, and what installing leaves free on the models disk (or its state, when it
is installed). The tabs are:
Overview: the description, backend, licence, largest context, tags, links
and a memory bar. For an installed model it also shows its state, the pages it
opens in, and which agents, agent tasks, failover chains and aliases name it.
Fit and memory: the verdict in words, a context size selector, the memory
bar split into weights and the part that grows with context, and a chart of the
memory needed at each context size against the memory this machine offers.
When a model has several builds, pick the build to see its own figures.
Variants and files: the builds with their size and fit, and the files the
chosen build downloads. Install any build from its row.
Usage and history, Configuration and Logs, for installed models.
LocalAI does not record requests, timings, loads or configuration changes for
each model, so the usage tab lists what it cannot show yet instead of an empty
chart. The same tab lists the files the model uses on disk, with their size,
the other models that use them, and any file the configuration names that is
not on disk (see Disk and cleanup). Configuration holds the Placement
section. Logs is the backend log viewer of the Admin section.
The page reads the same lists as the table, so it works for a model the gallery
does not list (it has no variants or files tab) and for a gallery model that is
not installed (it has no usage, configuration or logs tab). If the gallery cannot
be reached, an installed model keeps working and Install says why it is off.
Going back with Esc, Backspace or the Models button returns to the list
with its view, search, filters, selection and scroll as you left them. The
previous and next buttons step through the rows of the list you came from, in
the order you saw them.
Keyboard
On the Models page, / jumps to the search field, the up and down arrows move
the selection, Enter installs the selected model in Explore, d switches
between comfortable and compact rows, o opens the selected model’s page, and
Esc closes the details.
On a model’s page, 1 to 6 switch tabs, [ and ] (or k and j) step to
the previous and next model of the list, and Esc goes back to the list.
Disk and cleanup
When the server reports the disk that holds the models directory, a strip in the
page header shows how much of it is free. It turns amber when less than 10
percent, or less than 20 GB, is free. In Explore, the details of a model say how
much disk an install leaves free. The strip is hidden when the disk cannot be
read, and on a distributed controller, where the models live on the workers.
Select the strip to open the cleanup review. LocalAI does not record when a
model was last used or how often, so the review says so and ranks installed
models only by what it can see:
Safe to remove: another build of the same gallery model is installed, and
the build LocalAI would pick on this host is the one that stays.
Probably safe: disabled, unused, and available in the gallery to download
again.
Your call: not loaded and not used by anything, but with nothing more
known. A model that is not in the gallery cannot be downloaded again, and the
review says so.
Protected: loaded, pinned, or named by an agent, an agent task, a failover
chain or an alias. These are never suggested. If an agent or task cannot be
read, nothing is marked safe.
For an admin, sizes are what each model uses on disk, read from
GET /api/models/storage. A file that another installed model also uses stays
on disk when you remove one of the two, so the review counts only the files a
model does not share. It says which models share files, and the amount freed
by a selection counts a shared file only when every model that uses it is in
the selection. A configuration that names files that are not on disk (a download
that did not finish, or files removed by hand) is listed as a finding. If the
report cannot be read, for example because the user is not an admin, sizes fall
back to the sizes of the files the gallery lists. A model that is not in the
gallery then shows no size and is not counted in what a removal frees. Before you
confirm, the review checks again and lists what will go, why, and how much it
frees. Removal then waits 30 seconds, during which you can undo it; the delete
request is sent only when that time ends. If you leave the page during the wait,
nothing is deleted.
LFM2.5-24B-A2B
LiquidAI LFM2.5-24B-A2B
is a text-only reasoning model with 24B total parameters and 2.45B active
parameters. The gallery provides the official Q4_K_M, Q5_K_M, Q6_K, and Q8_0
GGUF builds through the llama-cpp backend.
Install the model with automatic variant selection:
local-ai models install lfm2.5-24b-a2b
To select a specific quantization, use --variant with lfm2.5-24b-a2b
(Q4_K_M), lfm2.5-24b-a2b-q5, lfm2.5-24b-a2b-q6, or
lfm2.5-24b-a2b-q8. The entries use the embedded tokenizer template, a
131,072-token context, and LiquidAI’s recommended sampling settings.
The weights use the Liquid AI LFM Open License.
Cyber-Ornith 1.5 9B
Cyber-Ornith 1.5 is a Qwen3.5 fine-tune for security auditing, terminal tasks, and tool use.
The gallery includes Q4_K_M and Q6_K GGUF builds for text chat with llama.cpp.
Both use the embedded chat template and a 32,768-token context by default.
Install cyber-tiel-coder-35b-a3b-q4-mtp for coding and image chat with llama.cpp.
The gallery groups UD-Q4_K_XL and UD-Q8_K_XL builds; both enable MTP speculative decoding and include a BF16 vision projector.
To select Q8 explicitly, run local-ai models install cyber-tiel-coder-35b-a3b-q4-mtp --variant cyber-tiel-coder-35b-a3b-q8-mtp.
Both configurations use the embedded chat template and default to 32,768 context tokens.
The model card describes its abliterated Ornith-1.5 base and MIT license.
Qwen3.8-27B Agention Precision
The gallery includes Agention Precision IQ4_XS and Q4_K_M GGUF builds of
Qwen3.8-27B for llama.cpp. Both include the BF16 vision projector for image
input and use a 32,768-token context by default.
To select a specific build, pass --variant qwen3.8-27b-agention-iq4-xs
or --variant qwen3.8-27b-agention-q4-k-m to the same command.
The files use standard llama.cpp quantization types and the Apache-2.0 license.
See the publisher’s model card
for quantization details. These entries do not enable MTP speculative decoding.
Swift 1.5 Qwen3.8-27B GSQ-RCO
Install swift-1.5-qwen3.8-27b-gsq-rco for text chat with llama.cpp.
The gallery groups IQ2_XS, IQ2_S, IQ3_XXS, and IQ3_S quantizations of this 27B reasoning and coding model.
To select IQ3_S explicitly, run:
The configurations use the embedded chat template and default to 32,768 context tokens.
These builds support text chat only: the publisher has no verified vision projector for this release.
They use standard GGUF files without MTP decoding.
See the model card and Swift Open License v1.0 for usage terms.
Sharp-Spark-X2.5-4B
Install sharp-spark-x2.5-4b for coding and text chat with llama.cpp.
The gallery groups Q4_K_XL, Q5_K_XL, and Q6_K_XL builds as variants.
To select the publisher’s recommended Q6 build, run:
All builds use a 32,768-token default context and the embedded Sharp-Spark chat template.
That template adds a terseness instruction to the system prompt.
See the publisher’s model card for quantization and template details.
MiMo-V2.6-Distill-Qwen-9B
Install mimo-v2.6-distill-qwen-9b for text and image chat with llama.cpp.
This MIT-licensed 9B Qwen3.5 fine-tune targets coding, agent tasks, and visual coding.
The gallery groups Q4_K_M and Q8_0 builds as variants; both include the F16 vision projector.
To select Q8_0 explicitly, run local-ai models install mimo-v2.6-distill-qwen-9b --variant mimo-v2.6-distill-qwen-9b-q8.
The configurations default to 32,768 context tokens and use the model’s embedded chat template.
See the model card for training details.
Qwopus3.8 Flash V2
Install qwopus3.8-27b-flash-v2 for the Q4_K_M GGUF build, with Q8_0 available through variant selection:
Both builds use llama.cpp with the embedded chat template, MTP speculative decoding, and the F32 vision projector.
Weights and projector downloads are pinned to a Hugging Face revision and verified with SHA256.
This Apache-2.0 release is a further post-training of Qwopus3.8 Flash for reasoning and agent tasks.
See the publisher’s model card for evaluation details and limitations.
ThinkingCap Qwen3.8-27B
Install thinkingcap-qwen3.8-27b for a 27B reasoning model with text and image input.
The llama.cpp entries include Q4_K_M and Q8_0 weights, each paired with the F16 vision projector.
LocalAI selects between the builds using the gallery variant rules. To request Q8_0 explicitly:
Both builds use the embedded chat template, a 32,768-token default context, and the publisher’s sampled decoding settings.
MTP speculative decoding is not enabled by these entries.
The weights use PolyForm Small Business 1.0.0 with a personal-use grant.
Review that license for permitted use.
Hemmingway-1
Install hemmingway-1 for English text generation with llama.cpp. The gallery groups its Q4_K_M and Q8_0 builds as variants.
To select a specific build, use local-ai models install hemmingway-1 --variant hemmingway-1-q8 for Q8_0.
The configurations default to 32,768 context tokens. Increase the context size only if available memory permits.
The model license is CC BY-NC 4.0; commercial use requires a separate agreement.
Qwen-Image 2.1
For image generation, install qwen-image-2.1-q4_k-ggml or its qwen-image-2.1-q8_0-ggml variant.
These entries use stablediffusion-ggml and include the text encoder, vision projector, and VAE.
The invalid qwen-image-2.1-uncensored chat entry was removed because llama.cpp cannot load its diffusion weights.
This removal does not delete previously installed models. Remove that configuration before installing an image-generation entry.
Search Hugging Face and other sources
Models that are not in a gallery can be found from the Models page or with the API. On the Explore tab, a chip next to the library chips searches one source with the search box. Hugging Face is built in. Other sources come from add-ons, and each installed source is on as soon as the add-on is installed: the Pirate Face search add-on adds Pirate Face (tagged p2p), and the Ollama search add-on adds Ollama. The Sources button, shown when more than Hugging Face is installed, opens the panel where you turn each installed source off or on again. Every source is on until you turn it off. The choice is yours, is kept with your account and takes effect at once. The results use the same table as the gallery, under a header such as “From Hugging Face”. Memory fit is measured against your machine at the chosen context, and sizes load as rows scroll into view. Open a row to see one line per quantization with its size and fit, pick one, and press Install. The install runs through POST /models/import-uri with that quantization. With nothing typed, Hugging Face shows its newest models under “Latest on Hugging Face” (the models API sorted by creation date, with the same GGUF filter as a search). A source that has no list of new models, such as Pirate Face, shows a note until you search it. Use Load more for more results (up to 50 per source). A gated Pirate Face model cannot be installed from here.
A source can declare filters, for example a minimum number of seeders. With a source chip picked, its filters appear next to the GGUF only switch, drawn by LocalAI in the same style as the other controls. With All libraries picked, the filters of every source that is on appear with the name of their source.
With All libraries picked, a search term also asks every source that is on, and with no term the sections show the newest Hugging Face models (10 rows) and a note for each source that cannot list its newest models, below your library list. The table shows your libraries first, then one section for each source, such as “From Hugging Face”. Each section answers on its own: a source that is slow or down shows its own error line with a retry button and does not hold back the others. A section starts with 10 rows and has its own Load more; pick the source chip to see a full page of one source. If a source returned rows that LocalAI refused (an address scheme it does not handle, or a field over its size limit), the count shows as “N results skipped”. A library chip, a capability chip or a backend filter narrows the table to your libraries and leaves the online sections out.
The search asks several sources at the same time and merges the answers. If one source is down or slow, you still get the others, and the answer says which one failed.
Source
ID
What it returns
Hugging Face
huggingface
Repositories from the Hugging Face model search, with downloads, likes, license and tags. The result uri is huggingface://owner/repo. Built in.
Ollama
ollama
Models of the public Ollama library, with downloads, last update, capability and size tags. The result uri is ollama://name. To choose a size, import ollama://name:tag yourself; the Models page does not list the tags yet. It comes from the Ollama search add-on, which an administrator installs. It reads the HTML pages of the site, so one search gives a dozen results at most.
Pirate Face
pirateface
Open-weight models offered as torrents, with size and seeders. The result uri is pirateface://owner/repo, and the magnet field holds the magnet link. It comes from the Pirate Face search add-on, which an administrator installs.
q: the search text, up to 200 bytes. It is required unless sort is latest.
providers: comma separated source IDs. The default is your enabled set of sources: every source you can see, except the ones you turned off. An unknown ID gives a 400 error.
limit: results per provider. The default is 20 and the maximum is 50.
format: file format filter. The default is gguf; any turns it off. Only Hugging Face can filter; a source that cannot ignores it.
filters.<source>.<id>: the value of a filter that one source declares, for example filters.example.kind=any. The sources list in the answer gives each source’s filters (type, label, values, range). An unknown filter, or a value that does not fit its type, gives a 400 error that names the filter.
sort: downloads (default), likes, updated, trending or latest. Only Hugging Face can sort; a source that cannot keeps its own order. latest lists the newest models first (Hugging Face sorts by creation date) and is the only sort that works with no q. A source that cannot list its newest models is not called: its status says "unsupported": true and it has no results. Pirate Face is one of them, because its public pages have no sorted list outside /api, which its robots.txt disallows.
A source can come from an add-on that provides the model-search slot (see Model search sources). Every source you can see is on until you turn it off, so a source from a newly installed add-on is searched with no action. GET /api/models/search/sources returns the installed sources with their filters and your enabled set. missing is always empty and stays in the answer for older clients. PUT /api/models/search/sources with {"enabled": ["huggingface", "<source id>"]} changes the set at once, with no restart. The server stores what you left out, as the sources you turned off. A source you turned off stays off when its add-on is removed and installed again. An empty set searches nothing. Each status in providers has a title and a dropped count: the rows that the host refused because of an unknown URI scheme or a field over its size cap.
The endpoint is for administrators, like the import endpoints. Results also say whether an installed model already comes from the repository (installed, installed_name), the backend an import would likely pick (backend, a hint derived from the tags) and whether the repository likely has several quantizations (has_variants). Pass the uri of a result to POST /models/import-uri to install it. A pirateface:// uri only imports on a LocalAI version that can download over BitTorrent. The server keeps answers for five minutes in memory, so a repeated search does not call the provider again. Hugging Face allows 500 unauthenticated requests per five minutes. Gated models are listed with gated: true; you still need access on Hugging Face to download them. The Assistant can run the same search with the search_models tool.
Look inside a search result
A search result has no file list and no memory figure. Two more endpoints fill that in for one repository, without downloading anything. Both are for administrators and both call the provider (Hugging Face for the file list and the GGUF header), so answers are cached per repository for ten minutes, at most four upstream calls run at the same time, and a rate-limit answer (HTTP 429) is remembered for a minute instead of being retried.
GET /api/models/remote/files?uri=huggingface://owner/repo lists the weight files with sizes, one variant per quantization (the shards of a split model are one variant):
{"provider":"huggingface","id":"acme/Tiny-GGUF","uri":"huggingface://acme/Tiny-GGUF","revision":"9217f5db79a29953eb74d5343926648285ec7e67","gated":false,"license":"apache-2.0","pipeline_tag":"text-generation","description":"Tiny is a very small chat model.","gguf":{"architecture":"qwen2","context_length":32768,"parameters":630167424},"size_known":true,"backend":"llama-cpp","installed":false,"variants":[{"quantization":"Q4_K_M","file":"tiny-q4_k_m.gguf","files":["tiny-q4_k_m.gguf"],"size_bytes":398000000,"shards":1,"preference":"q4_k_m","recommended":true},{"quantization":"Q8_0","file":"tiny-q8_0.gguf","files":["tiny-q8_0.gguf"],"size_bytes":670000000,"shards":1,"preference":"q8_0"}],"files":[{"path":"tiny-q4_k_m.gguf","size":398000000,"sha256":"...","kind":"gguf"}]}
backend is the backend a dry run of the import selects on this exact file list, and import_files are the files it would download. Add quantization=q8_0 to dry-run the import with that choice. If no importer matches, import_error says why.
preference is the value for preferences.quantizations on POST /models/import-uri that selects exactly that variant.
installed and installed_name say that an installed model was made from this repository.
gated is reported as is. For Pirate Face it is also true when the site shows no magnet link, which is what a gated licence looks like there.
For ollama://name[:tag] uris (a bare name is library/name, the default tag is latest) the file list comes from the manifest of the Ollama registry. The model layer is the one gguf file and the only variant, named after the tag. A vision projector layer is listed as a file of kind mmproj and is not part of the variant. Template, parameter, licence and system layers are not listed. The registry gives sizes and digests but no licence or description.
For pirateface:// uris the file list comes from the Pirate Face index, which has no sizes. The sizes come from the Hugging Face commit the torrent mirrors. When Hugging Face does not know the repository, size_known is false and the sizes are 0.
GET /api/models/remote/estimate?uri=...&file=...&contexts=4096,8192 returns the same answer as GET /api/models/estimate/{id} for a gallery model, for one variant (file is the variant’s first file; the default is the recommended variant):
source says how good the figure is. gguf-header means the layer count, width and head count were read from the first bytes of the GGUF file, so the KV cache term is computed. file-size means only the size was known, so the figure is the file size plus 2 KiB per context token, and approximate is true: it can be well off for long contexts. unknown means no size was known at all. variants repeats the estimate for every quantization of a GGUF repository. Quantizations of one model share an architecture, so the header read for the chosen file serves all of them: one call answers a whole variant list.
VRAM and download size estimates
When browsing the gallery or importing a model by URI, LocalAI can show estimated download size and estimated VRAM for models.
Where they appear: In the model gallery table (Size and Fit columns), in the model inspector beside it, and after starting an import from URI (in the success message).
How they are computed: GGUF models use file size (HTTP HEAD or local stat) and optional GGUF metadata (HTTP Range) for KV cache and overhead; other formats use Hugging Face file sizes and optional config when available. If metadata is unavailable, a size-only heuristic is used. GGUF metadata lengths that exceed the file size are rejected before allocation; these files also use the size-only estimate.
Hardware fit indicator: When your system reports GPU or RAM capacity, each row shows whether the estimated memory at the chosen context length fits, using a 95% headroom rule. A model that is too big for the GPU but would run from system RAM is marked as spilling to the CPU, with how much; a model too big for both is marked as over by the shortfall.
Estimates are best-effort and may be missing if the server does not support HEAD/Range or the request times out.
Recommended model for your machine
On first run, when no model is installed, the Home page and the chat page offer
one model for your machine, with the size of the download and the context window
it will get, and two alternatives behind More models. Only an administrator
can install it. Everyone else sees the same names and is told to ask an
administrator.
How the choice is made:
LocalAI reads the memory of the machine that runs models: the smallest GPU, or
system memory when there is no GPU. In a cluster it uses the best single node.
That puts the machine in a tier: cpu (no GPU), gpu-small (under 8 GB),
gpu-mid (8 GB up to 24 GB) or gpu-large (24 GB and more).
Each tier has a curated list of one default and two alternatives. All are chat
models with tool calling and a permissive licence. The list is the file
gallery/recommended.yaml, served next to the gallery index.
For each model on the list, LocalAI reads the GGUF header only (a few ranged
requests, never the weights) and works out the context window the loader would
pick on this machine: it aims at 32768 tokens and steps down to what fits, as
described for context_size in model configuration.
The result is a verdict: fits, tight (for example a window under 24576, or
little free memory) or does_not_fit (the window would be under the 16384
tokens a chat needs, or the model needs more memory than the machine has).
Models that do not fit are left out. A model that fits comfortably comes before
one that only fits tightly. If nothing in the tier fits, LocalAI offers the
models of the smaller tiers, and if nothing fits at all it shows the smallest
model and says it does not fit.
When the hardware cannot be read, the page says so and shows the cpu tier
without a fit verdict.
The install writes the fitted window into the model’s configuration as an
explicit context_size, so a model whose gallery entry sets a larger window
(for example 262144 tokens) still loads on your machine. A context_size that
you set is never changed by this.
To change the outcome:
Install any other model from Models. The recommendation is a suggestion.
Edit context_size in the model’s configuration at any time. See
model configuration.
Change the list for everyone who uses your gallery: edit recommended.yaml
(schema version: 1, one list per tier, each with one default and two
alternative entries, each with the model’s gallery id, a name and a
one-line reason) and serve it next to the gallery index. LocalAI reads it
from the same sources as the index, so no release is needed. If the file is
missing or not valid, or strict backend integrity is on, LocalAI uses a short
list built into the binary and logs why.
API: GET /api/models/recommended answers for any signed-in user with the tier,
the hardware that was read and a ranked list. Each entry has the gallery id, the
context_size an install will use, memory_bytes at that window, fit and
fit_reasons. To install one, call POST /api/models/install/{id}?variant={id}&context_size={n}
(administrators only). The variant parameter pins the entry that was measured,
so the install does not choose a larger build.
EmbeddingGemma 2
The embeddinggemma-2 family serves text embeddings through llama-cpp.
It offers Q8_0 and BF16 weights, plus smaller Unsloth UD-Q4_K_XL,
UD-Q5_K_XL, and UD-Q6_K_XL variants. These entries use the 270M-parameter
text backbone with an 8192-token context and 768-dimensional output.
Send text to /v1/embeddings. For retrieval, prefix queries with
task: search result | query: and documents with title: {title} | text: .
See the model card
for other task prefixes. These gallery entries support text input only.
Useful Links and resources
Open LLM Leaderboard - here you can find a list of the most performing models on the Open LLM benchmark. Keep in mind models compatible with LocalAI must be quantized in the gguf format.
Add other galleries
You can add other galleries by:
Using the Web UI: Open the Manage libraries panel on the Models page (or the Backends page for backend galleries) to add, turn on or off, refresh, edit or remove a source. The Runtime Settings page lists them read-only.
Using Environment Variables: Set the GALLERIES environment variable. The GALLERIES environment variable is a list of JSON objects, where each object has a name and a url field. The name field is the name of the gallery, and the url field is the URL of the gallery’s index file, for example:
Using Configuration Files: Add galleries to runtime_settings.json in the LOCALAI_CONFIG_DIR directory.
The models in the gallery will be automatically indexed and available for installation.
To use a gallery that needs authentication, such as a private GitHub repository or an internal server, add a matching entry to the credentials file. See Private Registries and Galleries.
Model library (preview)
The model library lists the models in the shared library entry shape. Each entry has the common header (kind, id, name, version, description, license, urls, tags, icon, channel, policy, schemaVersion) and a model body with url, backend, size, files, configFile, overrides, variants and promptTemplates. It is the file gallery/models/index.yaml, and it is the source of truth for the models: to add, change or remove a model, edit this file.
The old gallery file, gallery/index.yaml, is a generated copy of the library. It stays only so that releases from before the cutover, which read the gallery, keep working. The cutover release switches the default to the library, and the old gallery file is removed in that release. Never edit it by hand; CI fails when it differs from the generated copy.
LocalAI lists the library as a default model source, official-models, next to the localai gallery, so a standard install has it without a flag. To start without it, remove it; a source you remove stays removed:
local-ai library remove official-models
The gallery named localai keeps its own index. A source you add with local-ai library add is added to the defaults. If the library cannot be fetched or read, listing the models fails with an error; LocalAI does not fall back to the gallery, so the problem is never silent. Entries of another kind are skipped. The shipped official-models library has no mirrors, and the library has no signature policy of its own. A source you add can list mirrors (see below). The sha256 of each model file is still checked on install.
Edit the library, generate the gallery
All edits go to gallery/models/index.yaml. After an edit, generate the gallery copy and commit both files:
go run ./scripts/models/cmd/modelcatalog \
--library gallery/models/index.yaml \
--out gallery/index.yaml
The command reads the library with the same strict reader the host uses. It converts every library entry to a gallery entry and back, loads its own output the way the host loads a gallery, and fails if one entry does not come back equal.
The gallery copy cannot carry everything a library entry or the old gallery file could hold. The command lists what it drops on every run:
The keys last_checked, parameters, Base Model, Context Length, License and Training Data are not in the library. The gallery reader has no field for any of them, so the host ignored them on load, and dropping them changes no entry the host reads.
The library header fields version, channel and schemaVersion have no place in a gallery entry. The host does not read them from a gallery.
CI (the model library workflow) checks the library file itself. It decodes, every entry has the library shape, every entry converts to a gallery entry and back, and the gallery reader loads the generated gallery and sees the same names, file URIs and digests. It then generates the gallery copy again and fails with a message to regenerate, not to edit by hand, when gallery/index.yaml differs from it.
The tests in core/gallery run the same checks on every entry of the real library, and compare the result with golden files in core/gallery/testdata/model_library, which are written from the library. After you change the library shape on purpose, write the golden files again with --golden core/gallery/testdata/model_library.
Gallery mirrors
A gallery entry can declare a mirrors list of alternative locations for the same index file. Mirrors exist for availability, not for load balancing: LocalAI always prefers the url, and only falls back to the mirrors, in the order you listed them, when the one before it cannot be fetched. If the primary works, the mirrors are never contacted.
Mirrors accept any URI the gallery loader understands (https://, github:, huggingface:// (also hf:// and hf.co/), pirateface://, magnet:, .torrent files (see Download over BitTorrent), file://, and oci://) and the same rules apply to them as to a primary URL, so a file:// mirror must still live inside your models directory.
Each attempt is bounded by a 120 second timeout, and a source that fails (a connection error, a timeout, or an HTTP error status such as 404 or 502) is skipped for the next 10 minutes so a dead host is not re-dialled on every gallery listing. A source that answers is usable again immediately, and a request you cancel yourself is not counted against it. If every source happens to be inside that 10 minute window, LocalAI tries them all anyway rather than refuse to serve the gallery.
Warning
Neither mirrors nor the offline cache cover a .ref URL. If a gallery’s url ends in .ref, that reference file is fetched and resolved to the real index location before mirrors or the cached copy are consulted, and a failure to fetch it fails the gallery outright. That includes the offline case: a .ref gallery fails when the network is gone even if it has been fetched successfully before. Mirrors are alternates for the index, not for the reference that points at it. If you want mirror coverage or offline listings, point url directly at the index file.
The key is optional: a gallery without mirrors behaves exactly as before.
A library source carries the same list. Set it in the Manage libraries panel (one address per line, at most 8), with PUT /api/library/sources/{id} ({"mirrors": [...]}) or with mirrors in the body of POST /api/library/sources. A source accepts https://, http://, github:, oci:// and file:// mirrors, and an add-on source takes none. When a source lists mirrors, they replace the ones a gallery of the same address got from the flags. Clearing a source’s mirrors does not change a gallery that is already listed until LocalAI restarts.
Offline gallery listings
Every successful gallery fetch is written to a cache directory alongside your models directory (<MODELS_PATH>/../cache/gallery/), one file per gallery URL. If nothing can serve the index, the primary and every mirror failed, there is no network at all, the host is airgapped, LocalAI serves that last successfully fetched copy instead of failing the listing, and logs a warning saying it did so. This applies to every gallery whose url points directly at an index file, with or without mirrors, but not to a .ref URL, which is resolved before the cache is consulted (see the warning above).
Only a response that actually parses as a gallery index is stored. A captive portal, a proxy or a CDN can answer an index request with HTTP 200 and an HTML error page; caching that would replace a working offline copy with something no listing can read. An empty index is rejected for the same reason, so the previous copy survives.
Entries served this way may be stale: the copy is only as fresh as the last time the gallery could be reached, so models added or changed upstream since then will not show up, and an entry may point at a file that has since moved. A listing served from disk is a degraded mode, not a substitute for a reachable gallery.
The copy is deliberately kept out of the models directory itself, where LocalAI reads a .yaml file as an installed model’s configuration. Deleting the cache directory is safe (the next successful fetch recreates it) and a machine that has never reached a gallery has nothing cached, so its first listing still fails.
Galleries published as OCI artifacts
A gallery can live in a container registry instead of on a web server. Give the gallery a url with the oci:// scheme and point it at an artifact reference:
LocalAI pulls the artifact, unpacks it into a cache directory beside your models directory (<MODELS_PATH>/../cache/gallery/oci/) and reads index.yaml from it. The unpacked copy is reused for one hour before the registry is asked again. Everything else works as it does for an HTTP gallery: an oci:// URL can be a primary url or one of the mirrors, a failed pull puts the source in the same 10 minute cooldown, and the offline cache still serves the last good listing.
Downloaded artifact files are readable and writable only by the LocalAI process owner. File writes stay inside the cache directory, including when an existing subdirectory is a symbolic link.
This is the only format that carries a whole gallery in one object, so it is what to publish when the index and the model configuration files must travel together.
Entry URLs relative to the gallery
An artifact holds the index and the files it refers to, so an entry can name its base configuration by its place in the tree:
- name:premium-modelurl:base/virtual.yaml
A url with no scheme is resolved against the root of the gallery it was read from: the unpacked artifact for an oci:// gallery, and the directory of the index URL for an http://, https://, github:, huggingface:// or file:// gallery. A url that names a scheme, such as https://example.org/base.yaml, is always used as written.
A relative url cannot leave the gallery root. An entry that tries to climb out of it, for example url: ../../etc/passwd, is refused: LocalAI drops that entry from the listing, logs the reason and keeps the rest of the gallery.
Signature verification
An oci:// gallery can be signed, and LocalAI verifies the signature before it unpacks anything. Add an artifact_verification block with the Fulcio issuer and the signing identity, in the same form the backend galleries use:
The tag is resolved to a digest, the signature is checked against that digest, and the same digest is then pulled. A gallery that fails verification is never written to the cache, so no unverified file reaches your disk. The optional not_before RFC3339 value revokes signatures logged before that time, exactly as it does for backends.
Cached copies of a gallery are kept per verification policy on disk, and the in-memory listings are dropped when the gallery settings change. When you change the verification block (for example, you add source_repository or move not_before forward), in the configuration, at runtime through the settings API, or by editing runtime_settings.json, the next listing fetches the gallery again and verifies it under the new policy. LocalAI does not serve a copy that an older policy admitted.
LocalAI tells a refusal apart from an outage:
Refusal. The artifact has no signature, or its signature does not match the issuer, identity, source_repository or not_before of the policy, or the policy itself cannot be used (for example, not_before is not an RFC3339 time). LocalAI shows an error and does not serve a cached copy.
Outage. The registry or the Sigstore trust root cannot be reached, answers with a server error, or the fetch times out. This includes failures during the signature check itself. LocalAI serves the last copy that was verified under the current policy. If no such copy exists, it shows an error. It never serves a copy that was verified under a different policy.
An oci:// gallery with a verification block is only served from oci:// sources. LocalAI cannot check a signature on an https://, github: or file:// mirror, so it ignores these mirrors for that gallery and logs a warning. List only oci:// mirrors for a signed gallery.
With strict integrity on (--require-backend-integrity or LOCALAI_REQUIRE_BACKEND_INTEGRITY), an oci:// gallery without a verification block is refused. This is also true when a copy from an earlier fetch is in the cache, because that copy was never verified, and when the gallery has an https://, github: or file:// mirror, because LocalAI ignores these mirrors in strict mode too.
The optional source_repository value works the same for oci:// galleries as it does for backends: it pins the repository the signature was made for when a shared reusable workflow does the signing. See Verifying OCI Backends.
Warning
artifact_verification applies only to the gallery artifact. Backend image signatures use verification. For compatibility, the artifact loader uses verification when artifact_verification is absent. Set both fields when the gallery and its backend images have different signing identities.
With --require-backend-integrity (LOCALAI_REQUIRE_BACKEND_INTEGRITY=1), an oci:// gallery with neither policy is refused when the models are listed, not only when one is installed. An oci:// gallery without a policy still lists outside strict mode, with a warning in the log.
Official gallery publishing
The gallery_publish.yml workflow publishes both official galleries on relevant changes to master, or through a manual dispatch on master. It uses the existing LOCALAI_REGISTRY_USERNAME and LOCALAI_REGISTRY_PASSWORD secrets. It reuses the public backend repository go-skynet/local-ai-backends. The gallery-models and gallery-backends tags move only after their artifact digest has been signed. Revision tags include the source commit SHA.
To prepare the same files locally, run go run ./scripts/build/gallery . gallery /tmp/model-gallery or use backend as the source directory. The helper rewrites repository-local base configuration URLs to artifact-relative paths and copies the files. The published artifact type is application/vnd.localai.gallery.v1; each file is a separate layer with its relative path as its title.
Private registries
A gallery in a private registry needs a credentials entry that matches the registry, the same entry an image pull from it would use:
See Private Registries and Galleries for the file location, the other authentication types and the rules for registries on a local network, which also need allow_insecure: true.
API Reference
Model repositories
You can install a model in runtime, while the API is running and it is started already, or before starting the API by preloading the models.
To install a model in runtime you will need to use the /models/apply LocalAI API endpoint.
By default LocalAI is configured with the localai repository.
To use additional repositories you need to start local-ai with the GALLERIES environment variable:
LocalAI tries https://index.localai.io/models first, GitHub second, and the signed OCI gallery last. The OCI artifact includes the repository-local base configurations, so reading those configurations does not require GitHub. Model weights and external URLs still require their original hosts. github:mudler/LocalAI/gallery/index.yaml@master is expanded automatically to https://raw.githubusercontent.com/mudler/LocalAI/master/gallery/index.yaml.
Note: the url are expanded automatically for github and huggingface, however https:// and http:// prefix works as well.
Using Local Gallery Files
You can also use local gallery index files by using the file:// prefix. For security reasons, local gallery files must be located within your models directory (the directory specified by MODELS_PATH or the default models/ directory).
If you want to build your own gallery, there is no documentation yet. However you can find the source of the default gallery in the LocalAI repository.
List Models
To list all the available models, use the /models/available endpoint:
Models can be installed by passing the full URL of the YAML config file, or either an identifier of the model in the gallery. The gallery is a repository of models that can be installed by passing the model name.
To install a model from the gallery repository, you can pass the model name in the id field. For instance, to install the bert-embeddings model, you can use the following command:
localai is the repository. It is optional and can be omitted. If the repository is omitted LocalAI will search the model by name in all the repositories. In the case the same model name is present in both galleries the first match wins.
bert-embeddings is the model name in the gallery
(read its config here).
Model variants
Some gallery entries offer several builds of the same model: different
quantizations, or the same weights served by a different engine. Such an entry
carries a variants list, and installing it normally lets LocalAI choose:
variants whose backend cannot run on this machine are dropped;
variants that do not fit the available memory are dropped. That budget is
VRAM on a discrete-GPU host, and system RAM otherwise, including on
unified-memory machines such as Apple Silicon, where the GPU shares system
RAM and reports no separate VRAM pool;
the entry’s own build is never dropped. It competes with whatever survived
rather than waiting for everything else to fail, so an entry that is itself
the largest build that fits keeps its own payload;
among the remaining builds the engine this machine prefers wins first: a vLLM
build on an NVIDIA or AMD host, an MLX build on Apple Silicon, llama.cpp
otherwise. The native accelerated runtime is worth more than a bigger
download, so preference is settled before size;
the largest build on the preferred engine then wins, because a bigger
footprint means a higher quality build of the same model. A machine with no
preferred engine picks purely by size;
a build whose size could not be measured ranks below the entry’s own build,
so an unreadable size never quietly displaces the payload the entry ships;
if nothing else survives, the entry’s own build is installed. The entry is
always installable, on any machine.
Because the entry’s own build competes like every other candidate, the order of
the list means nothing and a variants list may offer smaller builds, larger
ones, or both.
Sizes are measured from the model’s weights rather than downloaded, and cached.
The gallery listing only flags which entries offer variants, with a
has_variants field. It deliberately does not describe them: measuring a
variant is a network round trip per referenced build, so describing every
entry inline would make one listing request cost as many round trips as the
whole page has variants.
By default the listing returns every entry, including the individual builds a
parent entry offers as variants, so one model can occupy several rows. Pass
collapse_variants=true for the deduplicated view: every entry that is
installable in its own right, with nothing shown twice.
An entry is hidden only when another entry already offers it as a variant, so
it stays reachable by installing that entry. Entries that declare variants are
always kept, and so is any entry nobody references. The filter is applied
before pagination, so page counts stay correct.
Searching respects the collapse.term is matched against every entry the
gallery holds, builds another entry offers included, so nothing becomes
unfindable. The collapse then decides how a match is reported: a hit on a build
another entry offers comes back as that entry, since that is the row installable
in its own right. Looking a model up by name must not answer “not found” for an
entry the gallery holds, and must not answer with a row the requested view has
no place for either. A term that is empty or only whitespace does not count as a
search:
# Collapsed: the parent stands in for the build it offers.curl 'http://localhost:8080/api/models?collapse_variants=true'# Collapsed, searching a build the parent offers: the parent comes back.curl 'http://localhost:8080/api/models?collapse_variants=true&term=nanbeige4.1-3b-q8'# Uncollapsed, same term: the build itself comes back.curl 'http://localhost:8080/api/models?term=nanbeige4.1-3b-q8'
A parent appears once however many of its builds match, and once when it matches
in its own right as well. The substitution runs before the count and the page
math, so both describe the rows actually handed out.
term, tag and backend are all applied before the substitution, so each is
judged against the build that really carries the name, tag or backend rather
than against a parent that merely offers it. The consequence is worth knowing:
filtering by a backend only one variant declares returns that variant’s parent,
whose own backend field may say something else. The alternative would be to
claim the gallery holds no such build.
The web UI requests the collapsed view by default and has a toggle for the other
one. The parameter stays on the API, off by default, for clients that want
either view.
Ask for the description one entry at a time, as the web UI does when you open
a model’s variant menu:
auto_selected is what installing without a choice would pick right now. fits
is whether auto-selection would consider that variant on this machine, and
is_base marks the entry’s own build. memory_bytes is omitted entirely, as on
the second entry above, when the size could not be measured; read a missing
memory_bytes as unknown rather than as a free build.
An entry that declares no variants carries no has_variants field and answers
this endpoint with an empty list, so a client never has to ask about it.
To install a specific one, pass its name as variant:
An explicit choice is honored even when the machine looks too small for it, so
you can deliberately install a build LocalAI would not have picked. A variant
the entry does not declare fails the install and names what was requested; it
never quietly falls back to auto-selection. The choice is recorded, so a later
reinstall or upgrade of the same model stays on the variant you picked.
The Activity tab of the notification panel, the Activity
page and GET /api/operations expose currentBytes and totalBytes as raw
transport bytes. Cancelling an active download leaves its partial files in
place so a retry can resume. A verification failure never
exposes a completed snapshot, while a retry or another installation reuses an
already verified content-addressed snapshot.
Deleting a model configuration does not delete its content-addressed snapshot
bytes. This allows another configuration or a later reinstall to reuse the
cache; safe cache garbage collection is deferred.
How to install a model not part of a gallery
If you don’t want to set any gallery repository, you can still install models by loading a model configuration file.
In the body of the request you must specify the model configuration file URL (url), optionally a name to install the model (name), extra files to install (files), and configuration overrides (overrides). When calling the API endpoint, LocalAI will download the models files and write the configuration to the folder used to store models.
To preload models on start instead you can use the PRELOAD_MODELS environment variable.
To preload models on start, use the PRELOAD_MODELS environment variable by setting it to a JSON array of model uri:
PRELOAD_MODELS='[{"url": "<MODEL_URL>"}]'
The value must be a JSON array. Boolean values such as true are not valid model preload configurations.
Note: url or id must be specified. url is used to a url to a model gallery configuration, while an id is used to refer to models inside repositories. If both are specified, the id will be used.
LocalAI will create a batch process that downloads the required files from a model definition and automatically reload itself to include the new model.
Input: url or id (required), name (optional), files (optional)
An optional, list of additional files can be specified to be downloaded within files. The name allows to override the model name. Finally it is possible to override the model config file with override.
The url is a full URL, or a github url (github:org/repo/file.yaml), or a local file (file:///path/to/file.yaml).
Warning
Local file security restriction: When using file:// URLs, the file path must be within your models directory (specified by MODELS_PATH). Files outside this directory will be rejected for security reasons.
The id is a string in the form <GALLERY>@<MODEL_NAME>, where <GALLERY> is the name of the gallery, and <MODEL_NAME> is the name of the model in the gallery. Galleries can be specified during startup with the GALLERIES environment variable.
Returns an uuid and an url to follow up the state of the process:
Installations are processed one at a time. A job submitted while another install
is still running is reported as queued until the installer picks it up:
A job ID is queryable from the moment /models/apply returns it, so a 404/500
from this endpoint means the ID is genuinely unknown rather than merely waiting
its turn.
Subsections of Models and backends
What models can do
Pick the kind of model you want to run. Each page shows the endpoint, an example request and the backends that serve it. The API features are on by default for new users.
Overview The chat endpoint supports the grammar parameter, which allows users to specify a grammar in Backus-Naur Form (BNF). This feature enables the Large Language Model (LLM) to generate outputs adhering to a user-defined schema, such as JSON, YAML, or any other format that can be defined using BNF. For more details about BNF, see Backus-Naur Form on Wikipedia.
Reasoning models can “think” before they answer. When such a model also calls a tool, the useful behaviour is for the thinking and the tool call to travel together, and for that thinking to survive the tool-result round trip. LocalAI calls this interleaved thinking: a single assistant turn carries both reasoning and tool_calls, and the client hands the reasoning back on the next turn so the model’s chain of thought is not lost when the tool result is appended.
A reranking model, often referred to as a cross-encoder, is a core component in the two-stage retrieval systems used in information retrieval and natural language processing tasks. Given a query and a set of documents, it will output similarity scores.
We can use then the score to reorder the documents by relevance in our RAG system to increase its overall accuracy and filter out non-relevant results.
LocalAI exposes an OpenAI-compatible text moderation endpoint at POST /v1/moderations. It uses a local text-generation model with a constrained JSON grammar, so no separate moderation service or cloud API is required.
curl http://localhost:8080/v1/moderations \ -H "Content-Type: application/json" \ -d '{ "model": "your-instruct-model", "input": "Text to classify" }' input may be one string or an array of strings. The response contains one result per input with flagged, categories, category_scores, and category_applied_input_types fields. The category names match the OpenAI moderation API, including harassment, hate, illicit activity, self-harm, sexual content, and violence categories.
LocalAI forecasts numeric time series with timestral.cpp, a C++/ggml port of Mistral’s Timestral models. You send one or more series, with optional covariates, to POST /v1/forecast and get quantile trajectories for the next steps.
A forecast model has its own usecase, forecast. It does not appear in the chat model picker. It shows in the gallery filter and in the /v1/models capability list.
Models Gallery entry Parameters Builds timestral-5m 5 million F32 (default), F16 timestral-28m 28 million F32 (default), F16 timestral-123m 123 million F32 (default), F16 timestral-209m 209 million F32 (default), F16 local-ai models install timestral-28m The weights have a licence limit. Read the licence below before you use them.
Use local-ai benchmark to compare text inference through a running LocalAI server. Install and configure the models first. The command sends sequential, non-streaming requests to /v1/chat/completions and reports full request latency and end-to-end completion tokens per second.
Pass one or more configured model names. To compare backends, configure separate model aliases with the desired backend, then pass those aliases. Backend names alone are not model names. The command does not install, discover, or unload models; the server’s normal loading and eviction settings still apply.
Subsections of Text and retrieval
Text generation
LocalAI generates text with the llama-cpp backend and with other backends, such as vllm and transformers. See also the Model compatibility for an up-to-date list of the supported model families.
Note:
You can also specify the model name as part of the OpenAI token.
If only one model is available, the API will use it for all the requests.
For example, to generate a chat completion, you can send a POST request to the /v1/chat/completions endpoint with the instruction as the request body:
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "ggml-koala-7b-model-q4_0-r2.bin",
"messages": [{"role": "user", "content": "Say this is a test!"}],
"temperature": 0.7
}'
Available additional parameters: top_p, top_k, max_tokens, service_tier (see Request priority)
When a request omits max_tokens, the vLLM and SGLang backends do not cap generation at 200 tokens. Generation is bounded only by the context window of the model.
Reasoning models return their thinking in the reasoning field. When a model reasons and calls a tool in the same turn, see Interleaved Thinking with Tool Calls.
When stream: true is set and the llama.cpp backend fails before the first chunk, for example because the prompt exceeds the context size, the request fails with an HTTP error. The error message is not streamed as assistant content. An error after streaming has started is reported inside the stream.
To generate a completion, you can send a POST request to the /v1/completions endpoint with the instruction as per the request body:
curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d '{
"model": "ggml-koala-7b-model-q4_0-r2.bin",
"prompt": "A long time ago in a galaxy far, far away",
"temperature": 0.7
}'
Available additional parameters: top_p, top_k, max_tokens, service_tier (see Request priority)
Request priority
/v1/chat/completions, /v1/completions and /v1/responses accept the OpenAI service_tier field. It sets the priority class of the request. When requests wait for a free slot, a backend that queues requests (llama.cpp) serves a higher class first. Requests of one class are served in the order they arrive.
service_tier
Class
Use it for
flex
batch (-1)
Work that nobody waits on, such as bulk jobs
auto, default or not set
default (0)
Normal requests
priority
interactive (1)
Requests that a person waits on
Any caller can lower the priority of its own requests with flex. Only an administrator can use priority. For other callers, LocalAI changes priority to default. On a server without authentication (no user accounts and no API keys), every caller can use priority. An unknown value returns HTTP 400.
The response includes the tier that LocalAI used in service_tier, in every chunk of a streamed chat or text completion too.
LocalAI also sets the class of its own requests. A chat in the web UI and a chat from a connector are interactive. Sub-agents, jobs, triggers, pages and the indexing of collections are batch.
LocalAI supports the Anthropic Messages API, which is compatible with Claude clients. This endpoint provides a structured way to send messages and receive responses, with support for tools, streaming, and multimodal content.
curl http://localhost:8080/v1/messages \
-H "Content-Type: application/json"\
-H "anthropic-version: 2023-06-01"\
-d '{
"model": "ggml-koala-7b-model-q4_0-r2.bin",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Say this is a test!"}
]
}'
Request Parameters
Parameter
Type
Required
Description
model
string
Yes
The model identifier
messages
array
Yes
Array of message objects with role and content
max_tokens
integer
Yes
Maximum number of tokens to generate (must be > 0)
system
string
No
System message to set the assistant’s behavior
temperature
float
No
Sampling temperature (0.0 to 1.0)
top_p
float
No
Nucleus sampling parameter
top_k
integer
No
Top-k sampling parameter
stop_sequences
array
No
Array of strings that will stop generation
stream
boolean
No
Enable streaming responses
tools
array
No
Array of tool definitions for function calling
tool_choice
object
No
Tool choice strategy: {"type": "auto"}, {"type": "any"}, {"type": "none"}, or {"type": "tool", "name": "..."}. The bare strings “auto”, “any” and “none” are accepted too
metadata
object
No
Per-request metadata passed to the backend (e.g., {"enable_thinking": "true"})
Message Format
Messages can contain text or structured content blocks:
Streaming responses use Server-Sent Events (SSE) format with event types: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, and message_stop.
Response Format
{"id":"msg_abc123","type":"message","role":"assistant","content":[{"type":"text","text":"This is a test!"}],"model":"ggml-koala-7b-model-q4_0-r2.bin","stop_reason":"end_turn","usage":{"input_tokens":10,"output_tokens":5}}
stop_reason is end_turn, tool_use, or max_tokens when the reply used up max_tokens.
Open Responses API
LocalAI supports the Open Responses API specification, which provides a standardized interface for AI model interactions with support for background processing, streaming, tool calling, and advanced features like reasoning.
curl http://localhost:8080/v1/responses \
-H "Content-Type: application/json"\
-d '{
"model": "ggml-koala-7b-model-q4_0-r2.bin",
"input": "Say this is a test!",
"max_output_tokens": 1024
}'
Reuse assistant messages
When you manage conversation history in your client, append assistant messages from a response’s output array to the next request’s input.
Keep their content type as output_text. Use input_text for new user messages.
Include earlier conversation items that the model still needs.
For example, submit this body to POST /v1/responses:
{"model":"ggml-koala-7b-model-q4_0-r2.bin","input":[{"type":"message","role":"user","content":[{"type":"input_text","text":"What is the capital of France?"}]},{"type":"message","role":"assistant","content":[{"type":"output_text","text":"Paris is the capital of France."}]},{"type":"message","role":"user","content":[{"type":"input_text","text":"Which river flows through it?"}]}]}
WebSocket Responses
Connect to ws://localhost:8080/v1/responses (or wss:// when TLS is
enabled) and send response.create messages over the WebSocket. Only one
response may be in progress on a connection. Wait for response.completed or
response.failed for the active response before sending the next
response.create. An error that rejects an invalid or additional
response.create applies only to that rejected message; it does not terminate
a response that is already in progress.
Set the WebSocket-only generate field to false to prepare a request without
running inference:
{"type":"response.create","model":"ggml-koala-7b-model-q4_0-r2.bin","generate":false,"store":false,"input":"Say this is a test!"}
LocalAI emits response.created followed by response.completed with no
generated output. The completed response still has an ID that can continue the
prepared request:
Response IDs created with store: false are available only on the WebSocket
connection that created them and are removed when that connection closes. A
previous_response_id chain can contain multiple responses; LocalAI replays the
complete conversation from the oldest response through the referenced response
before appending the new input. The replay includes server-side MCP tool calls
and their results, which are stored as function_call and
function_call_output output items. Keep store: false for every descendant of a
connection-local response. LocalAI rejects a store: true response that depends
on connection-local history because the resulting stored chain would be broken
after the WebSocket closes.
After delivery, LocalAI discards buffered stream events for store: false
responses but retains their request and final response for continuation. A
connection admits at most 128 local responses and accepts a new local request
only while its current serialized history plus that request is at most 64 MiB.
When either admission threshold is reached, LocalAI returns
connection_store_limit_reached; reconnect to start a new local history. With
authentication enabled, globally stored response IDs can be continued only by
the identity that created them.
Request Parameters
Parameter
Type
Required
Description
model
string
Yes
The model identifier
input
string/array
Yes
Input text or array of input items
max_output_tokens
integer
No
Maximum number of tokens to generate
temperature
float
No
Sampling temperature
top_p
float
No
Nucleus sampling parameter
instructions
string
No
System instructions
tools
array
No
Array of tool definitions: function tools, and namespace entries such as the ones Codex sends for MCP servers. The model sees a namespace member as ns_{namespace}___{name}; the function_call items returned carry the namespace and name again
tool_choice
string/object
No
Tool choice: “auto”, “required”, “none”, or specific tool. To force a namespace member, name it with namespace and name
A string input is a user chat message, not a raw text-completion prefix.
For models configured with template.use_tokenizer_template: true, LocalAI
sends the input messages, instructions, history and tools to the backend as
structured messages, and the backend applies the model’s native chat template.
This applies to buffered and streaming responses. The same routing applies to
/v1/chat/completions, /v1/messages and the Ollama /api/chat endpoint.
Some backends (vLLM, SGLang, transformers and MLX) apply the chat template only
when the prompt is empty. If LocalAI sent them a flattened prompt, they would
continue the input text instead of answering it.
Streaming responses
Set "stream": true to receive Server-Sent Events. Each response.output_item.added event assigns an output_index to an item.
Use that index and the item ID to associate later deltas and completion events with the same item.
If a request without explicit tools produces reasoning, the stream uses separate items for reasoning and answer text.
Each item keeps its original index throughout the stream.
The response.completed event includes both items in the same index order, followed by any automatically parsed tool calls.
Background Processing
Run requests in the background for long-running tasks:
curl http://localhost:8080/v1/responses \
-H "Content-Type: application/json"\
-d '{
"model": "ggml-koala-7b-model-q4_0-r2.bin",
"input": "Generate a long story",
"max_output_tokens": 4096,
"background": true
}'
The response will include a response ID that can be used to poll for completion:
Use the GET endpoint to retrieve background responses:
# Get response by IDcurl http://localhost:8080/v1/responses/resp_abc123
# Resume streaming with query parameterscurl "http://localhost:8080/v1/responses/resp_abc123?stream=true&starting_after=10"
Canceling Background Responses
Cancel a background response that’s still in progress:
curl -X POST http://localhost:8080/v1/responses/resp_abc123/cancel
Multiple Replicas (Distributed Mode)
In distributed mode LocalAI replicates response metadata across frontend
replicas, so retrieval, previous_response_id chaining and cancellation work
regardless of which replica the load balancer picks:
GET /v1/responses/{id} returns the response from any replica.
POST /v1/responses/{id}/cancel is delegated over NATS to the replica that is
actually generating, so generation really stops. If that replica is gone, the
response is reported as cancelled without blocking.
Streaming resume (?stream=true&starting_after=N) works on any replica,
because the event buffer is read from the database (see Durable Storage
below). Without a database (it always exists in distributed mode, so this only
concerns a build that cannot reach it) the buffer is in the memory of the
replica that generates, and a resume that reaches another replica returns
HTTP 409 naming the owning replica.
State mode (see the distributed-state rules): the response metadata is
shared state, a SyncedMap with a database Store. The table is the source
of truth, a replica that starts later loads the newest rows (up to 10000), and
changes reach the other replicas as deltas over NATS. The events are not sent
over NATS: every replica reads them from the table. The generation itself, and
its cancel function, live on one replica, the owner of the response; a cancel
reaches it over NATS and through the cancel_requested flag.
Durable Storage
When LocalAI has a database (authentication enabled, or distributed mode),
stored responses and the events of a background run are kept in two tables,
open_responses and open_response_events. Without a database the store stays
in memory, as before, and ends with the process.
With the tables:
A response and its event buffer outlive a restart. GET /v1/responses/{id},
previous_response_id chaining and ?stream=true&starting_after=N read the
tables, so any replica serves them and they work after a restart.
The owner writes events in batches: at once for any event that is not a
.delta event, and for deltas every 250 ms or 64 events. If the process dies,
the deltas of the last 250 ms are lost.
The buffer keeps the same caps as the memory store (8192 events and 64 MiB per
response, oldest first). A resume below the oldest kept event returns HTTP 409
(ErrOffsetLost).
Every read still checks the owner of the response: a caller who did not create
it gets 404. An item_reference finds only an item of a response the caller
created; the item of another user’s response is “not found”.
Rows expire after OPEN_RESPONSES_STORE_TTL. With the TTL at 0 a database
store applies a default of 7 days, because a table does not end with the
process.
A running background response holds a lease in its row, which its owner renews
every 15 seconds (the lease lasts 45 seconds). When the owner dies, for example
because the pod is replaced, the lease runs out and the response is ended as
failed with the error code server_restarted. A final response.failed event
is added, so a client that resumes the stream gets every kept event and then
the end. LocalAI does not run the request again: a generation cannot continue
from a cut point, and tools may have had effects. Send the request again, with
previous_response_id to keep the context. A standalone server ends the runs a
previous process left when it starts. In distributed mode one frontend at a time
runs the sweep.
POST /v1/responses/{id}/cancel sets a cancel_requested flag in the row. The
owner checks it on every lease renewal, so a cancel works even if the bus message
is lost. If the owner died before it could stop, the response ends as cancelled.
Tool Calling
Open Responses API supports function calling with tools:
curl http://localhost:8080/v1/responses \
-H "Content-Type: application/json"\
-d '{
"model": "ggml-koala-7b-model-q4_0-r2.bin",
"input": "What is the weather in San Francisco?",
"tools": [
{
"type": "function",
"name": "get_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state"
}
},
"required": ["location"]
}
}
],
"tool_choice": "auto",
"max_output_tokens": 1024
}'
For streaming requests with JSON tool output, LocalAI waits for the complete JSON
object before emitting a completed function_call item. Arguments can span
multiple tokens. Read the arguments from the response.output_item.done event
before executing the tool.
Reasoning Configuration
Configure reasoning effort and summary style:
curl http://localhost:8080/v1/responses \
-H "Content-Type: application/json"\
-d '{
"model": "ggml-koala-7b-model-q4_0-r2.bin",
"input": "Solve this complex problem step by step",
"reasoning": {
"effort": "high",
"summary": "detailed"
},
"max_output_tokens": 2048
}'
Response Format
{"id":"resp_abc123","object":"response","created_at":1234567890,"completed_at":1234567895,"status":"completed","model":"ggml-koala-7b-model-q4_0-r2.bin","output":[{"type":"message","id":"msg_001","role":"assistant","content":[{"type":"output_text","text":"This is a test!","annotations":[],"logprobs":[]}],"status":"completed"}],"error":null,"incomplete_details":null,"temperature":0.7,"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"usage":{"input_tokens":10,"output_tokens":5,"total_tokens":15,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0}}}
Backends
RWKV
RWKV support is available through llama.cpp (see below)
llama.cpp
llama.cpp is a popular port of Facebook’s LLaMA model in C/C++.
Note
The ggml file format has been deprecated. If you are using ggml models and you are configuring your model with a YAML file, specify, use a LocalAI version older than v2.25.0. For gguf models, use the llama backend. The go backend is deprecated as well but still available as go-llama.
Features
For the llama-server options you can set on a model, and for pasting a llama-server command into the model editor, see Engine runtime settings.
The llama.cpp model supports the following features:
Prompt templates are useful for models that are fine-tuned towards a specific prompt.
With the llama.cpp backend, streaming and non-streaming chat requests preserve
the template’s grammar, stop strings, and message boundaries.
Automatic setup
LocalAI supports model galleries which are indexes of models. For instance, the huggingface gallery contains a large curated index of models from the huggingface model hub for ggml or gguf models.
For instance, if you have the galleries enabled and LocalAI already running, you can just start chatting with models in huggingface by running:
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "TheBloke/WizardLM-13B-V1.2-GGML/wizardlm-13b-v1.2.ggmlv3.q2_K.bin",
"messages": [{"role": "user", "content": "Say this is a test!"}],
"temperature": 0.1
}'
LocalAI will automatically download and configure the model in the model directory.
Models can be also preloaded or downloaded on demand. To learn about model galleries, check out the model gallery documentation.
YAML configuration
To use the llama.cpp backend, specify llama-cpp as the backend in the YAML file:
name:llamabackend:llama-cppparameters:# Relative to the models pathmodel:file.gguf
Backend Options
The llama.cpp backend supports additional configuration options that can be specified in the options field of your model YAML configuration. These options allow fine-tuning of the backend behavior:
Option
Type
Description
Example
use_jinja or jinja
boolean
Enable Jinja2 template processing for chat templates. When enabled, the backend uses Jinja2-based chat templates from the model for formatting messages.
use_jinja:true
context_shift
boolean
Enable context shifting, which allows the model to dynamically adjust context window usage.
context_shift:true
cache_ram
integer
Size budget in MiB for the server-side prompt cache (a host-RAM store of idle slot KV states that’s reloaded on a prompt-prefix hit, see upstream PR #16391). Default: 8192 MiB (llama.cpp default). -1 removes the limit. 0 disables the prompt cache entirely. Together with kv_unified and cache_idle_slots this is what makes a repeated system prompt skip prefill on subsequent calls.
cache_ram:4096
slot_save_path
string
Directory where the slot save and restore API writes and reads prompt-cache files. Save and restore are off unless this is set. LocalAI creates the directory with mode 0700 if it is missing. See Saving and restoring a prompt cache.
slot_save_path:/var/lib/localai/slots
parallel or n_parallel
integer
Enable parallel request processing. When set to a value greater than 1, enables continuous batching for handling multiple requests concurrently.
parallel:4
grpc_servers or rpc_servers
string
Comma-separated list of gRPC server addresses for distributed inference. Allows distributing workload across multiple llama.cpp workers.
grpc_servers:localhost:50051,localhost:50052
fit_params or fit
boolean
Enable auto-adjustment of model/context parameters to fit available device memory. Default: true.
fit_params:true
fit_params_target or fit_target
integer
Target margin per device in MiB when using fit_params. Default: 1024 (1GB).
fit_target:2048
fit_params_min_ctx or fit_ctx
integer
Minimum context size that can be set by fit_params. Default: 4096.
fit_ctx:2048
n_cpu_ffn
integer
Keep the dense FFN weights of the first N layers on the CPU (upstream --n-cpu-ffn), the counterpart of n_cpu_moe for dense models. Default: 0.
n_cpu_ffn:12
yarn_orig_ctx
integer
Original context size of the model for YaRN scaling (upstream --yarn-orig-ctx). 0 uses the model’s training context size.
yarn_orig_ctx:32768
moe_cache_mib
integer
Size in MiB of a GPU cache for MoE expert weights that stay in host memory (upstream --moe-cache-mib). Off by default (0). It helps only when experts are in host memory, with cpu_moe, n_cpu_moe or a fit_params spill. The cache uses GPU memory, so lower gpu_layers or the fit result may change. Experimental upstream. A cache that is too small can thrash, because every token evicts its own experts. A rough starting point is about 10% of the total expert size.
moe_cache_mib:4096
moe_cache_cpu_share
float
Share of the MoE cache misses that the CPU computes from the host experts instead of uploading them to the GPU once the cache is full, from 0 to 1 (upstream --moe-cache-cpu-share). Default 0: every miss is uploaded. It applies only when the cache is on (moe_cache_mib > 0). Values outside 0 to 1 are ignored with a warning. The best value depends on the hardware. In the upstream tests a small cache did best with a high share and a large cache with a low one. Upstream ships scripts/moe-cache-tune.py, which wraps a plain llama-server command, to find both values.
moe_cache_cpu_share:0.5
n_cache_reuse or cache_reuse
integer
Minimum chunk size to attempt reusing from the cache via KV shifting. Default: 0 (disabled).
cache_reuse:256
slot_prompt_similarity or sps
float
How much the prompt of a request must match the prompt of a slot to use that slot. Default: 0.1. Set to 0 to disable.
sps:0.5
swa_full
boolean
Use full-size SWA (Sliding Window Attention) cache. Default: false.
swa_full:true
cont_batching or continuous_batching
boolean
Enable continuous batching for handling multiple sequences. Default: true.
cont_batching:true
check_tensors
boolean
Validate tensor data for invalid values during model loading. Default: false.
check_tensors:true
warmup
boolean
Enable warmup run after model loading. Default: true.
warmup:false
no_op_offload
boolean
Disable offloading host tensor operations to device. Default: false.
no_op_offload:true
device or devices
string
Select the llama.cpp backend devices to use. Repeat the option or pass a comma-separated list; unlisted devices are excluded. Use the names reported by llama-server --list-devices / --list-devices.
devices:CUDA1,CUDA2,CUDA3
kv_unified or unified_kv
boolean
Use a single unified KV buffer shared across all sequences. Default: true (LocalAI override; upstream defaults to false but auto-enables it when slot count is auto). Required for cache_idle_slots and scoring: without it the server force-disables idle-slot saving at init, and score-enabled models are rejected at load time.
kv_unified:false
kv_unified_per_slot
integer
Context limit per parallel slot (upstream --kv-unified-per-slot). When context_size is not set, the shared KV cache is sized to parallel times this value. Default: unset.
kv_unified_per_slot:8192
paged_kv or paged_serving
boolean
Paged serving: the slots share one KV pool, requests start only when the pool has room, and a request is preempted when it runs out. See Paged serving. Default: true; paged_kv:false turns it off.
paged_kv:false
kv_pool_tokens
integer
Total size of the shared KV pool in tokens. Sets the context size. Default: context_size.
kv_pool_tokens:32768
prefill_budget or max_prefill_tokens
integer or auto
Prompt tokens read per step while other requests generate, so a long prompt does not stall them. auto adapts it to the number of decoding streams. Works with or without paged_kv. 0 turns it off. Default: 256.
prefill_budget:auto
prefill_long
integer
The prefill budget holds back only prompts longer than this many tokens; shorter prompts are read whole. 0 holds back every prompt. Default: 1024.
prefill_long:0
kv_output_reserve
integer
Free cells a request needs beyond its prompt before it starts, capped at its max tokens. Only with paged_kv. Default: 256.
kv_output_reserve:512
paged_preempt
boolean
With paged serving, preempt a request when the pool runs out, and resume it later. Default: true. Not recommended to turn off: with paged_preempt:false a pool that overflows fails every in-flight stream with HTTP 500 “Context size has been exceeded”.
paged_preempt:false
spec_max_streams
integer
Speculative drafting pauses while more than this many streams decode, and resumes when the count drops by a quarter (at least one). 0 never pauses. Default: 4.
spec_max_streams:8
admission_order
boolean
With paged serving, waiting requests go by priority class (with aging), then fewest prompt tokens not covered by a cache, then arrival, with an overtake cap; false keeps first come, first served. Default: true.
admission_order:false
prefill_cap
integer
With paged serving, the most prompt tokens one request reads per step while other requests read prompts too; a request alone gets the whole step. 0 turns it off. Default: 512.
prefill_cap:0
slot_attach or prefix_attach
boolean
With paged serving, a request whose prompt starts with what another slot holds (busy or idle, at least 256 tokens) shares those KV cells instead of reading them again. Default: true.
slot_attach:false
cache_idle_slots or idle_slots_cache
boolean
On a new task, save the previous slot’s KV state into the prompt cache (and clear the slot) so a later request with the same prefix can warm-load it. Default: true. Auto-disabled by the server if kv_unified=false or cache_ram=0.
cache_idle_slots:false
n_ctx_checkpoints or ctx_checkpoints
integer
Maximum number of context checkpoints per slot (used for partial-prefix recovery, e.g. SWA). Default: 32.
ctx_checkpoints:16
checkpoint_min_step or checkpoint_min_spacing (aliases: checkpoint_every_nt, checkpoint_every_n_tokens)
integer
Minimum spacing in tokens between context checkpoints. 0 disables the minimum-spacing gate. Default: 256. (Renamed upstream from checkpoint_every_nt; semantics shifted from a fixed cadence to a minimum spacing.)
checkpoint_min_step:1024
split_mode or sm
string
How to split the model across multiple GPUs: none (single GPU only), layer (default - split layers and KV across GPUs), row (deprecated upstream; use tensor), tensor (experimental tensor parallelism: each layer is split across all GPUs for lower token latency). tensor needs flash attention (flash_attention: "on", or "auto", which llama.cpp turns on in this mode), fit_params:false and a context_size you set yourself, and it is not implemented for every architecture. Quantized KV cache (cache_type_k/cache_type_v) works with it on the bundled llama.cpp (#23792); f16 is the safe choice. The NVIDIA CUDA backends ship NCCL for the GPU-to-GPU reductions. See the tensor split configuration.
split_mode:tensor
backend_sampling or gpu_sampling
string
Where tokens are sampled: off (default, on the CPU), on (on the device that holds the output, such as the GPU) or auto (decided per request). true/false and 1/0 also work. See Backend sampling below.
backend_sampling:auto
backend_sampling_min_slots
integer
With backend_sampling:auto, the number of requests that must run at the same time before a request samples on the GPU. Default: 16.
backend_sampling_min_slots:8
grammar_engine
string
Engine of the grammars that LocalAI builds from a JSON schema (response_format and tool calls): auto (default), gbnf or llguidance. See Grammar engine below.
grammar_engine:gbnf
grammar_max_repetition
integer
Limit of the GBNF repetition check. llama.cpp stops at 2000, which the grammar of a large tool set exceeds: the request then fails with “number of rules that are going to be repeated … exceeds sane defaults”. Default: 100000. The LLAMA_GRAMMAR_MAX_REPETITION environment variable sets it for every model when the option is not set.
Note: The parallel option can also be set via the LLAMACPP_PARALLEL environment variable, and grpc_servers can be set via the LLAMACPP_GRPC_SERVERS environment variable. Options specified in the YAML file take precedence over environment variables.
An explicit parallel: 1 (or n_parallel: 1) in the model options takes precedence over LLAMACPP_PARALLEL, like any other value. The environment variable is only used when neither option is set; if it is missing or not a number, the backend uses 8 slots with paged serving (the default) and one slot without it.
Backend sampling
By default llama.cpp copies the logits of every slot to the host after each decode step and samples the slots one after the other on the CPU. With backend sampling (upstream --backend-sampling, ggml-org/llama.cpp#25532) the sampler chain runs on the device that holds the output, so the copy goes away and the slots are sampled in parallel. The gain grows with the number of slots that decode together: one stream gains little, many concurrent streams gain the most. The feature is experimental upstream and is off by default.
backend_sampling:on asks for backend sampling on every request.
backend_sampling:auto decides per request. A request samples on the backend only when all of these hold: the model is offloaded to a GPU (a GPU device is present and gpu_layers is not 0), split_mode is not tensor, the request has no grammar (no JSON schema, no response_format grammar, no tool-call grammar), no reasoning-budget sampler and no logprobs, and at least backend_sampling_min_slots requests (default 16) are running, this one included. The decision is made when the request starts and holds for its whole generation.
backend_sampling:off keeps sampling on the CPU. A raw --backend-sampling flag in options still turns it on.
Measured on a GB10 (DGX Spark) with Qwen3-8B: backend_sampling:on was neutral at 1 and 8 decoding streams and gave 2.5% more throughput at 12, 6.5% at 16 and 10% at 32, with the inter-token latency p99 25 to 40 ms higher. auto with 16 slots behind LocalAI was slower than off: about 16 requests in flight gave 277 against 300 tok/s and an inter-token latency p99 of 363 against 110 ms, because one batch then mixes requests sampled on the GPU and on the CPU. Use on for a model that serves many concurrent requests, and keep off (the default) otherwise.
llama.cpp turns backend sampling off for a request by itself when the request uses a grammar, a reasoning budget (thinking models with tool calls) or logprobs taken before sampling, and for text-to-speech; auto leaves those requests on the CPU from the start. Only a prefix of the sampler chain made of top-k, top-p, min-p, temperature, penalties, logit bias and the final draw runs on the device; other samplers (typical-p, XTC, mirostat, DRY) run on the CPU.
Known upstream issues at the time of writing: #32141 (min_keep and min_p handling), #31840 (pinned host buffers are allocated again each time a request ends) and #32637 (an invalid token on Metal with a small vocabulary). Test greedy output against off before you turn it on for a model.
Grammar engine
LocalAI constrains the output of the model with a grammar for JSON mode (response_format with a json_schema) and for tool calls when it builds the tool-call grammar itself. llama.cpp has two engines for these grammars:
GBNF: the grammar sampler of llama.cpp. It works in every build. It can be slow on a large schema, such as a big tool set, and llama.cpp rejects a grammar whose repetitions expand too far.
llguidance: a Rust engine that takes the JSON schema directly. It computes the allowed tokens faster on large schemas and supports more of JSON Schema. The llama.cpp backend images for Linux and macOS are built with it.
The grammar_engine option selects the engine:
Value
Behavior
auto (default)
Use llguidance for the grammars LocalAI builds when the backend build has it, GBNF otherwise. The tool-call grammars of the chat template use GBNF.
gbnf
Always use GBNF, exactly as upstream llama.cpp.
llguidance
Use llguidance, also for the tool-call grammars of the chat template (see below). A build without it logs a warning and uses GBNF.
options:- grammar_engine:gbnf
These grammars always use GBNF:
a grammar you write yourself (the grammar request field or the grammar key of the model config),
response_format of type json_object,
function calling with mixed_mode: true (free text or JSON) or schema_type: llama3.1.
Tool-call grammars of the chat template
When llama.cpp parses tool calls itself (grammar.disable: true with use_tokenizer_template: true), it builds a GBNF grammar from the chat template of the model. With grammar_engine:llguidance, the backend translates that grammar to llguidance when the request starts. It is the same grammar, for every template: no format has its own rules.
Speed. On GBNF, the cost of the allowed-token mask grows with the tool set, to tens of milliseconds per token with 48 or 128 tools. On llguidance it stays below about 1 ms. The backend first checks the token the model picked and computes the full mask only when that token is rejected, so text outside a tool call costs almost nothing.
Large tool sets. GBNF rejects some large schemas, for example an array with maxItems: 2000 or hundreds of optional properties (“exceeds sane defaults”, “chained more than 256 levels deep”). llguidance accepts them.
Fallback. If the grammar does not translate or llguidance rejects it, the request uses GBNF and the backend logs one warning. If llguidance fails during generation, or rejects a token that GBNF accepts, the request goes on with GBNF from that point. The output is never left without a grammar because of llguidance.
Lazy grammars. Most templates constrain the output only after a trigger such as <tool_call>. The trigger rules are the same as on GBNF.
Under auto, these grammars stay on GBNF for now. To go fully stock, set grammar_engine:gbnf: every grammar then uses llama.cpp’s GBNF sampler, as upstream.
With llguidance (any grammar, also the JSON-schema grammars above), tokens that a model adds to its vocabulary, such as <tool_call> in Qwen, count as special tokens: the grammar matches them by token, not by text. As a result, such a token cannot appear inside a JSON string of the output as one token; the model can still write the same characters with ordinary tokens.
With llguidance, an object in the schema that has no required list requires all its properties, and an object without additionalProperties allows no other property, as with the GBNF grammar of LocalAI. A required list and additionalProperties that the schema sets are kept, and keywords such as minLength, pattern and maxItems, which the GBNF converter ignores, are enforced. Between two JSON tokens the model may write one space or none, as with the GBNF grammar.
Use gbnf when a model must behave exactly as before, for example when a prompt relies on whitespace that the GBNF grammar allows. Other backends ignore the option.
Hardware auto-tuning (and how to override it)
On a detected GPU, LocalAI fills a few performance-relevant defaults the model config leaves unset - a larger physical batch on NVIDIA Blackwell, and a VRAM-scaled parallel slot count for concurrent serving. Both are gated on per-device VRAM at the model’s context: when a large context already fills a single card (e.g. a 27B model with a 200k context across 2×16 GiB), the batch boost and the extra parallel slots are suppressed so they can’t tip the tighter GPU into CUDA out-of-memory.
Anything you set explicitly in the model YAML always wins, so to pin a value just set it (e.g. batch: 512 or options: ["parallel:1"]). The effective values are logged at INFO when a model loads (effective runtime tuning …). To turn the hardware auto-tuning off entirely and run llama.cpp’s stock behavior, set:
LOCALAI_DISABLE_HARDWARE_DEFAULTS=true
Paged serving
With parallel above 1, the slots of a model share one KV cache (kv_unified, on by default). Without scheduling, when more requests arrive than that cache holds, the server runs out of cells mid-generation and fails every running request with “Context size has been exceeded”. Paged serving, on by default, schedules the shared cache as a pool instead:
Admission. A request starts reading its prompt only when the pool has room for the prompt and its output reserve (kv_output_reserve), after what the running requests still need. Otherwise it waits in its slot, first come, first served. A waiting request holds no KV cells: its prompt cache entry is loaded when it is admitted.
Preemption. When the running requests outgrow the pool, one request is preempted: the one holding the fewest cells (the cheapest to recompute), the youngest on a tie. Its cells are freed, it waits ahead of newer requests, and when there is room for it plus some spare (twice kv_output_reserve, at least 256 cells) its tokens are computed again and it continues where it stopped. One request is preempted at most twice while another can be preempted instead. Keep preemption on: without it, a pool that overflows fails every in-flight stream with HTTP 500, and in a CPU benchmark with output lengths the clients did not declare, 25% to 67% of the requests failed; with it, all completed. The output does not change, apart from rare near ties in greedy decoding. Hybrid and recurrent models (Qwen3.5, LFM2, Granite-H) and speculative decoding with a draft model or MTP resume the same way: the recompute rebuilds the recurrent state and the draft’s cache too. A request that cannot be recomputed (an image or audio prompt, aLoRA) is preempted only when nothing else can be: its state is saved to a RAM stash, capped by cache_ram, and restored when there is room. Score requests are never preempted. If the stash is full (or cache_ram is 0), such a request fails with the retryable error “KV pool full, preempted; retry the request”.
Prefix sharing. A request whose prompt starts with the prompt of another request (a shared system prompt, the earlier turns of a conversation) starts from that slot’s KV cells, even while the other request is still generating: the shared part is neither copied nor computed again. It needs at least 256 shared tokens and is off for sliding-window, hybrid and recurrent models, multimodal prompts and draft models. slot_attach:false turns it off.
Drafting. Speculative drafting is off unless the model asks for it: a draft model, or spec_type:ngram-mod to draft from n-grams of the model’s own context. N-gram drafting speeds up repetitive output (code edits, lists, quoting the prompt) but on ordinary chat output it rarely finds a match: on a GB10 (DGX Spark) with Qwen3-8B it cost 3% on one stream and 6-7% at 32 streams. When drafting is on, it pauses while more than spec_max_streams streams decode, where batching pays more than drafting, and resumes when the count drops by a quarter.
Order of waiting requests. Requests that wait for a slot or for room in the pool go by priority class first (interactive chats before default API calls before batch work such as sub-agents, jobs and collection indexing; see service_tier), then by the prompt tokens no cache covers (cache hits and short prompts first), then by arrival. A request gains a class for every 20 s it waits, and goes by arrival once 8 later requests went first or it waited 30 s, so nothing starves. admission_order:false keeps first come, first served.
Idle slots. When the pool needs cells held by idle slots, the least recently used idle slot is saved to the RAM prompt cache and trimmed from the tail, only as much as needed (at least 256 cells). With lazy_idle_save:true, idle slots also skip the save-and-clear that happens after each new request and keep their cells until the pool needs them; it is off by default because in the GPU A/B it served fewer repeated prompts from the cache.
Prefill budget.prefill_budget (default 256) limits how many prompt tokens a step reads while other requests generate. A long prompt then no longer stops the other streams for seconds. Only prompts longer than prefill_long (default 1024 tokens) are held back: a burst of short prompts is read whole, as without a budget, because spreading it over budget-sized steps cost 4 to 5% of throughput and doubled the inter-token latency p99 in bursts of 16 and 32 requests, with no long prompt to protect the other streams from. prefill_long:0 applies the budget to every prompt. It also works when paged serving is off. With prefill_budget:auto the budget follows the load: the whole batch while at most one stream decodes, then 2048 divided by the number of decoding streams, never below 128. A number sets a fixed budget.
To turn it off for one model:
options:- paged_kv:false # no admission control or preemption- prefill_budget:0 # no prefill budget
A model that sets the pool and the slots explicitly:
name:qwen3-8bbackend:llama-cppcontext_size:32768# the shared pool; or set kv_pool_tokensparameters:model:Qwen3-8B-Q4_K_M.ggufoptions:- parallel:16- prefill_budget:512
Notes:
When parallel is not set in the options or in LLAMACPP_PARALLEL, paged serving uses 8 slots and logs it. The KV cache does not grow with the slots: they share context_size. On a GPU, LocalAI’s hardware defaults set parallel from the VRAM, and set parallel:1 on a GPU without room for more slots, so a tight fit keeps one slot.
Each slot keeps a little state of its own: the sampler, and for hybrid and recurrent models (Qwen3.5, Granite-H, Nemotron-H, LFM2) a recurrent state and up to n_ctx_checkpoints copies of it (context checkpoints, in host memory). For such a model LocalAI reads the state size from the GGUF header and:
sets n_ctx_checkpoints so the checkpoints of all slots stay within the smaller of cache_ram (8 GiB by default) and a quarter of the host memory: slots x state x checkpoints, between 4 and 32 per slot. For example 6 for Qwen3.8-27B or Granite-4.0-H-Small at 8 slots, 20 for Qwen3.5-9B, and the default 32 for small models;
on a GPU, counts one state per slot in the headroom check that picks the default parallel, so a tight fit gets fewer slots.
An explicit n_ctx_checkpoints or parallel always wins.
A model that sets kv_unified:false, context_shift:true or cont_batching:false runs without paged serving, with one info line in the log. Only paged_kv:true set explicitly together with one of those options fails the load, with an error that names the option.
A purely recurrent model (Mamba, RWKV) has no KV pool to share, so paged serving turns itself off for it at load, with one info line. Hybrid models (attention plus recurrent layers) keep it.
Embedding and rerank models run with paged serving too: their requests need no output reserve, and admission only waits when the pool is full.
parallel is the limit of requests in flight, waiting or running. Each slot can use the whole pool unless kv_unified_per_slot caps it.
The backend logs every admission wait (waits = N), every preemption (preemptions = N), how long a preempted request waited (resuming after waiting), and every last-resort abort (aborts = N).
Builds of the forks that do not carry LocalAI’s llama.cpp patches (for example turboquant) run without paged serving; they warn only when a model sets paged_kv:true or prefill_budget.
Server-side prompt cache (repeated system prompts)
Agents, coding assistants, and Anthropic/OpenAI-compatible CLIs typically resend the same large system prompt on every turn. The llama.cpp server can short-circuit prefill for the matching prefix by stashing idle slot KV states in host RAM and reloading them on a hit. Three settings interact:
Setting
Default
Role
cache_ram:N
8192 (llama.cpp default)
Allocates the host-side prompt cache. 0 disables it.
kv_unified:true
true
Single unified KV buffer (prerequisite for idle-slot saving).
cache_idle_slots:true
true
Persists the idle slot’s KV into the prompt cache on task switch.
All three are on by default since LocalAI v4.3, so the prompt cache works out of the box for the common single-slot setup. If you’re on an older release, or you’ve explicitly disabled one of them, add the following to recover the behaviour:
options:- cache_ram:4096 # or -1 for no limit- kv_unified:true- cache_idle_slots:true
Set cache_ram:0 to opt out of the prompt cache entirely (saves host RAM at the cost of re-prefilling repeated prompts).
cache_ram:-1 removes the limit. With idle-slot saving on, every distinct prompt then leaves its slot state in host RAM, so a workload with many different prompts (classification, ingestion) grows the backend by roughly the KV size of each prompt until the host runs out of memory.
Saving and restoring a prompt cache
The server-side prompt cache lives in RAM and is lost when the model unloads. To keep the prompt state of one slot on disk, set slot_save_path and use the slot API. A typical use is a voice assistant with a long system prompt: save the state once, then restore it when the wake word fires, so the first request does not wait for prefill.
options:- slot_save_path:/var/lib/localai/slots
Both calls need an admin API key when authentication is on. Without slot_save_path they return 400.
The server chooses the name of every saved file. A save returns an id, and a restore takes that id. A client cannot pick a file name or a path.
# Save slot 0 of the model. The reply contains the id.curl http://localhost:8080/v1/slots/save \
-H "Content-Type: application/json"\
-d '{"model": "my-model", "slot": 0}'# Load that state back into slot 0curl http://localhost:8080/v1/slots/restore \
-H "Content-Type: application/json"\
-d '{"model": "my-model", "slot": 0, "id": "0123456789abcdef0123456789abcdef"}'
Field
Description
model
Name of a llama-cpp model.
slot
Slot id. Default 0. With parallel:N the ids are 0 to N-1.
id
Restore only. The id that a save returned for this model: 32 lowercase hex characters. Do not send it on save.
The save reply gives the id, the slot, the number of tokens and bytes, and the time taken in duration_ms. The message field lists the IDs of any older saves that were deleted to make room. The restore reply has the same fields. Neither reply contains a path on the host.
Keep these points in mind:
A client cannot choose names. The backend creates a directory for each model under slot_save_path (mode 0700) and writes a manifest.json in it. A restore works only for an id in the manifest of that model. Any other id returns 404 with no saved state with this id for this model.
The backend keeps at most 32 saves for each model. When a save would go over that, it deletes the oldest one and lists its id in message. A save larger than 8 GiB is deleted and fails.
A restore also checks that the file is a plain file and has the size that was recorded at save time. A file that was replaced or cut short is refused.
Keep slot_save_path private to the user that runs LocalAI. LocalAI creates it with mode 0700 when it is missing, and writes a warning to the log when an existing directory is open to other users. The checks above cannot stop a local user who can write to the directory.
A saved state is only as fresh as its save. To change the cached prompt, save again and use the new id.
A saved state holds the prompt state for the model and quantisation it came from. Do not restore it into a different model, quantisation or context size. The restore call fails if the state does not fit, but a state from another model is not always detected.
A slot that is busy with a request is served after that request ends.
The API is for llama-cpp only. Other backends return 501.
Disk prompt cache
The RAM prompt cache is lost when the model unloads. The disk prompt cache keeps the state of long prompts (1,024 tokens or more, seen in at least two requests) on disk, per user, so a reload does not compute them again. It is on by default; prompt_cache_disk:false in options: turns it off for one model. See Disk Prompt Cache for the options, the sizes and the retention.
ik_llama.cpp is a hard fork of llama.cpp by Iwan Kawrakow that focuses on superior CPU and hybrid GPU/CPU performance. It ships additional quantization types (IQK quants), custom quantization mixes, Multi-head Latent Attention (MLA) for DeepSeek models, and fine-grained tensor offload controls - particularly useful for running very large models on commodity CPU hardware.
Note
The ik-llama-cpp backend requires a CPU with AVX2 support. The IQK kernels are not compatible with older CPUs.
Features
The ik-llama-cpp backend supports the following features:
IQK quantization types for better CPU inference performance
Multimodal models (via clip/llava)
Setup
The backend is distributed as a separate container image and can be installed from the LocalAI backend gallery, or specified directly in a model configuration. GGUF models loaded with this backend benefit from ik_llama.cpp’s optimized CPU kernels - especially useful for MoE models and large quantized models that would otherwise be GPU-bound.
YAML configuration
To use the ik-llama-cpp backend, specify it as the backend in the YAML file:
name:my-modelbackend:ik-llama-cppparameters:# Relative to the models pathmodel:file.gguf
The aliases ik-llama and ik_llama are also accepted.
Flash attention is on by default, as in ik_llama.cpp itself. ik_llama.cpp has no automatic mode, so flash_attention: auto (the value LocalAI uses when the key is not set) and on turn it on, and off turns it off. A quantized V cache (cache_type_v) needs it on.
turboquant (llama.cpp fork with TurboQuant KV-cache)
llama-cpp-turboquant is a llama.cpp fork that adds the TurboQuant KV-cache quantization scheme. It reuses the upstream llama.cpp codebase and ships as a drop-in alternative backend inside LocalAI, sharing the same gRPC server sources as the stock llama-cpp backend - so any GGUF model that runs on llama-cpp also runs on turboquant.
You would pick turboquant when you want smaller KV-cache memory pressure (longer contexts on the same VRAM) or to experiment with the fork’s quantized KV representations on top of the standard cache_type_k / cache_type_v knobs already supported by upstream llama.cpp.
Features
Drop-in GGUF compatibility with upstream llama.cpp.
TurboQuant KV-cache quantization (see fork README for the current set of accepted cache_type_k / cache_type_v values).
Same feature surface as the llama-cpp backend: text generation, embeddings, tool calls, multimodal via mmproj.
Available on CPU (AVX/AVX2/AVX512/fallback), NVIDIA CUDA 12/13, AMD ROCm/HIP, Intel SYCL f32/f16, Vulkan, and NVIDIA L4T.
Setup
turboquant ships as a separate container image in the LocalAI backend gallery. Install it like any other backend:
local-ai backends install turboquant
Or pick a specific flavor for your hardware (example tags: cpu-turboquant, cuda12-turboquant, cuda13-turboquant, rocm-turboquant, intel-sycl-f16-turboquant, vulkan-turboquant).
YAML configuration
To run a model with turboquant, set the backend in your model YAML and optionally pick quantized KV-cache types:
name:my-modelbackend:turboquantparameters:# Relative to the models pathmodel:file.gguf# Use TurboQuant's own KV-cache quantization schemes. The fork accepts# the standard llama.cpp types (f16, f32, q8_0, q4_0, q4_1, q5_0, q5_1)# and adds three TurboQuant-specific ones: turbo2, turbo3, turbo4.# turbo3 / turbo4 auto-enable flash_attention (required for turbo K/V)# and offer progressively more aggressive compression.cache_type_k:turbo3cache_type_v:turbo3context_size:8192
The cache_type_k / cache_type_v fields map to llama.cpp’s -ctk / -ctv flags. The stock llama-cpp backend only accepts the standard llama.cpp types - to use turbo2 / turbo3 / turbo4 you need this turboquant backend, which is where the fork’s TurboQuant code paths actually take effect. Pick q8_0 here and you’re just running stock llama.cpp KV quantization; pick turbo* and you’re running TurboQuant.
OVHai-LLM/llama.cpp is a llama.cpp fork (MIT) that adds the olala architecture, a Mamba3 hybrid mixture-of-experts. Upstream llama.cpp cannot load these models, so they run on this separate backend. It shares the gRPC server sources with the stock llama-cpp backend, which stays unchanged.
The backend is pinned to a fork commit. Models of the Olala v1.0 mini 7A1B family are in the model gallery (olala-v1.0-mini-7a1b-*).
Notes
Use the bf16 file on GPU. Quantized weights on GPU backends can produce NaN. The Q5_K_M, Q6_K and q8_0-safe2 files are for CPU.
Do not quantize the model with a generic recipe: it can produce NaN. Use the files published by the model authors.
The context size is at most 32768 and is shared by parallel requests. The model cannot shift its context, so a prompt longer than the context fails.
The chat template takes a reasoning_effort of disabled, low, medium (default) or high. Set it per request with reasoning_effort, or per model with reasoning_effort: in the model YAML. The model card recommends temperature: 0.8, top_p: 0.9 and top_k: 40.
The reasoning text and tool calls come back in the usual reasoning_content and tool_calls fields.
This build ships for Linux x86-64 (CPU and NVIDIA CUDA 12). Other platforms are not built yet.
The backend will automatically download the required files in order to run the model.
Usage
Use the completions endpoint by specifying the vllm backend:
curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d '{
"model": "vllm",
"prompt": "Hello, my name is",
"temperature": 0.1, "top_p": 0.1
}'
Passing arbitrary vLLM options with engine_args
A subset of AsyncEngineArgs is exposed as typed YAML fields
(tensor_parallel_size, gpu_memory_utilization, quantization,
max_model_len, dtype, trust_remote_code, enforce_eager, …).
Anything else can be passed through the generic engine_args: map.
Keys are forwarded verbatim to vLLM’s engine; unknown keys fail at load
time with the closest valid name as a hint. Nested maps materialise
into vLLM’s nested config dataclasses (SpeculativeConfig,
KVTransferConfig, CompilationConfig, …).
Speculative decoding (DFlash, ngram, eagle, deepseek_mtp, …) is
configured this way:
method picks the algorithm, the remaining keys are method-specific.
Drafters from z-lab are paired with
specific target models; pick the one that matches your target. The
drafter loads in its native precision regardless of the target’s
quantization: setting.
Another example - picking a non-default attention backend (e.g. on
hardware where the default cutlass kernels aren’t supported):
engine_args:attention_backend:TRITON_ATTN
CLI-style engine flags in options
Engine arguments can also be written in options: with vLLM’s own CLI
spelling, which is handy when copying a command line out of vLLM’s
documentation:
Only -- prefixed entries are treated as engine flags; everything
else in options: (tool_parser:, reasoning_parser:, …) keeps its
existing meaning. Both --flag:value and --flag=value are accepted.
Dashes become underscores (--enable-prefix-caching →
enable_prefix_caching) and the value is coerced to the target
field’s type. A bare --flag sets a boolean field to true.
Unknown or uncoercible flags are logged on the backend’s stderr and
skipped rather than failing the load. engine_args: stays strict and
is applied last, so it wins on conflict.
engine_args: remains the form to use for anything structured (nested
configs, maps); options: is a convenience for flat flags.
Multi-node data parallelism
engine_args.data_parallel_size > 1 combined with the
local-ai worker vllm follower lets a single model span multiple
GPU nodes. See vLLM Multi-Node (Data-Parallel)
for the head/follower configuration and a worked Kimi-K2.6 example.
SGLang
SGLang is a fast serving
framework for LLMs and VLMs with a focus on prefix caching, speculative
decoding, and multi-modal generation. LocalAI ships a gRPC backend that
wraps SGLang’s async Engine, including its native function-call and
reasoning parsers.
The backend will pull the model from HuggingFace on first load.
Passing arbitrary SGLang options with engine_args
The same engine_args: map that the vLLM backend accepts is also
honoured by the SGLang backend. Keys are validated against
ServerArgs
SGLang’s central configuration dataclass - and forwarded verbatim to
Engine(**kwargs). Unknown keys fail at load time with the closest
valid name as a hint. Unlike vLLM, ServerArgs is flat: speculative
decoding fields are top-level (speculative_algorithm,
speculative_draft_model_path, etc.) rather than nested under a
speculative_config: dict.
The typed YAML fields shared with vLLM are mapped to their SGLang
equivalents (gpu_memory_utilization → mem_fraction_static,
enforce_eager → disable_cuda_graph, tensor_parallel_size →
tp_size, max_model_len → context_length). Anything else,
including all speculative-decoding flags, goes under engine_args:.
Speculative decoding: Gemma 4 with Multi-Token Prediction
Google publishes paired “assistant” drafters for every Gemma 4 size.
The drafters use Multi-Token Prediction (MTP) to propose several
candidate tokens per target step, which SGLang then verifies in
parallel. Flags below are transcribed verbatim from the
SGLang Gemma 4 cookbook.
For consumer GPUs in the 16-24 GB range, use E4B (8 B total /
4 B effective parameters):
For smaller cards (8-12 GB), drop to E2B (5 B total / 2 B effective)
by swapping the model paths to google/gemma-4-E2B-it and
google/gemma-4-E2B-it-assistant; the rest of the flags stay the same.
NEXTN is normalised to EAGLE inside ServerArgs.__post_init__, so
either value works - the cookbook uses NEXTN. mem_fraction_static
is the share of GPU memory SGLang reserves for the model + KV pool;
0.85 is the cookbook’s default and adapts to whatever single GPU the
backend is running on.
The 31 B dense and 26 B-A4B MoE Gemma 4 variants exist in the same
cookbook but require --tp-size 2, so they’re not in the gallery as
single-GPU recipes.
SGLang version requirement. Gemma 4 support landed in SGLang via
PR #21952. The
LocalAI sglang backend pins a release that includes it; if you’ve
overridden the pin to an older version, this recipe will fail with a
“model architecture not recognised” error at load time.
Other speculative algorithms
speculative_algorithm: also accepts EAGLE/EAGLE3 (paired with an
EAGLE-style draft head), DFLASH (block-diffusion drafters from
z-lab for the Qwen3 family), STANDALONE
(a smaller draft LLM verifying a larger target), and NGRAM (no draft
model - pure prefix-history speculation). See SGLang’s
speculative-decoding docs
for the full algorithm matrix.
Tool calling and reasoning parsers
SGLang’s native parsers stream tool_calls and reasoning_content
inside ChatDelta - the LocalAI Python backend wires them up
per-request rather than via engine_args:. Pick a parser by name:
thinking_budget sets a positive integer token budget for reasoning on each request.
Invalid, zero, and negative values produce a warning and leave the budget unset.
SGLang requires engine_args.enable_strict_thinking: true to enforce the budget.
LocalAI warns if you configure a budget without that engine option.
Keep the budget well below the max_tokens of your requests: if max_tokens is reached first,
the budget never triggers and the whole reply can be spent on reasoning, leaving the answer empty.
effort_budgets maps the request’s reasoning_effort to its own budget, so the levels differ in how long the model may think:
options:- thinking_budget:256 # fallback: no effort, or a level not listed below- effort_budgets:low=256;medium=1024;high=4096;xhigh=16384;max=16384
Entries are separated by ; and use the same parsing rules as thinking_budget (invalid entries are skipped with a warning).
A request whose effort is not listed falls back to thinking_budget; without either, no budget is sent.
A level listed here also turns reasoning on for that request, even when reasoning_default:off is set; an explicit enable_thinking: "false" in the request metadata (also sent when the model sets reasoning.disable: true) still wins.
The budget is an upper bound, not a target: the model may stop thinking earlier.
reasoning_default:on or reasoning_default:off sets the default for LocalAI’s tokenizer chat template.
Request metadata enable_thinking set to "true" or "false" overrides this default.
An explicit prompt bypasses tokenizer template rendering.
When no default or request override is set, the template keeps its own behavior.
LocalAI signals required reasoning when the rendered prompt ends with the configured parser’s opening reasoning token.
An explicit output grammar disables this detection.
Configure a reasoning parser that matches your model.
The backend reads these options when it loads the model.
POST /models/reload rereads model configuration files but does not update options in an already loaded backend.
Restarting only the backend does not reread configuration files.
Restart LocalAI after changing these options to reload both the configuration and the backend.
vllm.cpp
vllm.cpp is the LocalAI team’s C++ port of
vLLM: the same continuous-batching scheduler, paged KV cache and prefix caching,
with no Python at inference time. It consumes either a HuggingFace safetensors
model directory or a .gguf file, and applies the model’s chat template,
tool-call parsing and reasoning split engine-side.
This section is the configuration reference. For installing the backend and the
ready-made models the gallery ships for it, see the
vllm.cpp backend page.
The same engine_args: map the vLLM and SGLang backends accept is honoured
here, with keys spelled exactly as vLLM’s own CLI flags - so a speculative_config
or kv_transfer_config block written for vLLM works verbatim. Unknown keys are
ignored rather than fatal; the engine validates the documents it is handed and
reports a precise error at load.
name:qwen35-a3bbackend:vllm-cppparameters:model:"Qwen/Qwen3.5-A3B"context_size:16384template:use_tokenizer_template:trueengine_args:# KV cache sizing: num_blocks * block_size tokens of cache.block_size:32num_blocks:1024# Concurrency and the per-step chunked-prefill token budget.max_num_seqs:32max_num_batched_tokens:8192# Automatic prefix caching. Omit to keep the model's own default# (on for dense models, off for hybrid / attention-free ones).enable_prefix_caching:true# Scheduler admission order: fcfs (default), priority, or lpm# (cache-aware longest-prefix-match; needs prefix caching to have any effect).scheduling_policy:lpm
Key
Meaning
Default
block_size
KV-cache block size, in tokens per block
32
num_blocks
KV-cache blocks to allocate
256
max_model_len
Max sequence length; also settable as context_size / max_model_len
model config
max_num_seqs
Max concurrent sequences the scheduler admits
8
max_num_batched_tokens
Per-step chunked-prefill token budget
per-arch (2048 dense, 4096/8192 MoE)
enable_prefix_caching
Automatic prefix caching; enable_radix_attention is an accepted alias
model default
enable_jump_forward
Jump-forward decoding, which emits grammar-forced tokens without a model step. Only affects constrained requests (grammar, JSON schema)
off
scheduling_policy
fcfs, priority, or lpm
fcfs
tool_parser / reasoning_parser
Force a parser instead of chat-template auto-detection
auto
tokenizer_config
Override the tokenizer_config.json the chat template is read from
<model_dir>/tokenizer_config.json
speculative_config
Speculative decoding (see below)
disabled
kv_transfer_config
External KV connector / LMCache (see below)
none
hf_overrides
JSON object of config.json keys merged over the model directory’s own, as vLLM’s --hf-overrides (see the vllm.cpp backend page)
none
Raising max_num_batched_tokens lets more prefill land in a single step, at the
cost of decode latency for requests queued behind it. The default deliberately
does not scale with max_num_seqs, which is what keeps a large concurrent
prefill from blowing up the per-step activation on the hybrid architectures.
enable_prefix_caching and enable_jump_forward are tri-state at the engine
boundary: omitting the key defers to a default (the model’s own capability for
prefix caching, an environment variable for jump forward), while an explicit
false forces the feature off. Those are genuinely different - prefix caching
defaults on for dense models - so write the key only when you mean to override.
Speculative decoding
speculative_config: takes the same JSON object as vLLM’s
--speculative-config. Three methods are supported.
Architecture limit. At the current engine pin, mtp and dflash are
Qwen3.5 / Qwen3.6 only. The engine builds a widened speculative KV cache
directly for those families rather than through the model registry, so a
speculative config on any other architecture (Llama, GLM, Gemma, Mistral, …)
will not work regardless of checkpoint format. ngram needs no draft weights
and is not subject to this limit.
Format support.mtp and dflash now work from a .gguf target as well
as safetensors. An MTP head is read from the GGUF’s nextn.* tensors when the
file declares <arch>.nextn_predict_layers; a GGUF exported WITHOUT the head
(converted with --no-mtp, or predating llama.cpp’s Qwen3.5 MTP support) is
refused at load naming that as the reason. A DFlash draft may itself be a
dflash-arch GGUF, and the target may be a GGUF too. ngram needs no draft
weights and works on any format.
MTP (Multi-Token Prediction) uses a draft head shipped inside the target
checkpoint’s own mtp.* tensors, so there is no second model to download. It
requires a safetensors checkpoint - the mtp.* tensors do not survive GGUF
conversion, and an MTP config over a .gguf model is rejected at load.
engine_args:speculative_config:method:mtp# Optional; defaults to the checkpoint's own head depth, which is# usually the right value. Must be a multiple of that depth.num_speculative_tokens:1
DFlash uses a separate block-diffusion drafter that proposes a whole block
of tokens in one non-autoregressive forward pass. Unlike MTP, the draft is its
own checkpoint, so model: is required:
The draft shares the target’sembed_tokens and lm_head, so both must come
from the same model family and the target must be safetensors.
The engine does not download the draft.model: is resolved, in order,
as a path as given, then as the last path segment under LocalAI’s models
directory (z-lab/Qwen3.6-27B-DFlash → <models>/Qwen3.6-27B-DFlash, which is
what LocalAI’s own downloader produces), then as the whole reference under the
models directory. Install the draft into LocalAI first, or give an absolute path
to a directory containing config.json. If none of those resolve, the load
fails immediately naming every location that was tried, rather than reporting a
missing checkpoint from inside the engine.
N-gram needs no draft model at all - it proposes from the prompt’s own
suffix history. num_speculative_tokens is required:
Auto-configuration on import. When you import a safetensors repository
with backend: vllm-cpp, LocalAI reads the checkpoint’s config.json and, if
it declares an MTP head (mtp_num_hidden_layers), writes
speculative_config: {method: mtp} into the generated engine_args for you.
An explicit speculative_config in your own config is never overwritten.
Importing a DFlash draft repository is refused with a warning: a drafter
cannot serve on its own, so import the target model and point
speculative_config.model at the draft.
External KV cache with LMCache
kv_transfer_config: takes vLLM’s --kv-transfer-config JSON and selects an
external KV-cache connector. The lm:// LMCache client lets prefill KV be
stored to and reloaded from a shared lmcache.v1.server, so a prefix computed
by one replica does not have to be recomputed by the next:
engine_args:kv_transfer_config:kv_connector:LMCacheConnectorkv_role:kv_both # required whenever kv_connector is setkv_connector_extra_config:host:127.0.0.1port:65432
kv_role is one of kv_producer (store only), kv_consumer (load only), or
kv_both. An unregistered connector name, a missing role, or a malformed
document fails the load with an explicit error rather than silently running
without the cache.
Legacy options: list
Earlier versions configured this backend through the flat options: list, and
those configs keep working. Every key in the table above is still read from
there in key:value form, and engine_args wins on any key set in both:
New configs should prefer engine_args:, which is the only place the nested
speculative_config / kv_transfer_config documents can be written naturally
rather than as a single-line JSON string.
Transformers
Transformers is a State-of-the-art Machine Learning library for PyTorch, TensorFlow, and JAX.
LocalAI has a built-in integration with Transformers, and it can be used to run models.
This is an extra backend - in the container images (the extra images already contains python dependencies for Transformers) is already available and there is nothing to do for the setup.
Setup
Create a YAML file for the model you want to use with transformers.
To setup a model, you need to just specify the model name in the YAML config file:
name:transformersbackend:transformersparameters:model:"facebook/opt-125m"type:AutoModelForCausalLMquantization:bnb_4bit# One of: bnb_8bit, bnb_4bit, xpu_4bit, xpu_8bit (optional)
The backend will automatically download the required files in order to run the model.
Parameters
Type
Type
Description
AutoModelForCausalLM
AutoModelForCausalLM is a model that can be used to generate sequences. Use it for NVIDIA CUDA and Intel GPU with Intel Extensions for Pytorch acceleration
OVModelForCausalLM
for Intel CPU/GPU/NPU OpenVINO Text Generation models
OVModelForFeatureExtraction
for Intel CPU/GPU/NPU OpenVINO Embedding acceleration
N/A
Defaults to AutoModel
OVModelForCausalLM requires OpenVINO IR Text Generation models from Hugging face
OVModelForFeatureExtraction works with any Safetensors Transformer Feature Extraction model from Huggingface (Embedding Model)
Please note that streaming is currently not implemented in AutoModelForCausalLM for Intel GPU.
AMD GPU support is not implemented.
Although AMD CPU is not officially supported by OpenVINO there are reports that it works: YMMV.
Embeddings
Use embeddings: true if the model is an embedding model
Inference device selection
Transformer backend tries to automatically select the best device for inference, anyway you can override the decision manually overriding with the main_gpu parameter.
Inference Engine
Applicable Values
CUDA
cuda, cuda.X where X is the GPU device like in nvidia-smi -L output
OpenVINO
Any applicable value from Inference Modes like AUTO,CPU,GPU,NPU,MULTI,HETERO
Example for CUDA:
main_gpu: cuda.0
Example for OpenVINO:
main_gpu: AUTO:-CPU
This parameter applies to both Text Generation and Feature Extraction (i.e. Embeddings) models.
Inference Precision
Transformer backend automatically select the fastest applicable inference precision according to the device support.
CUDA backend can manually enable bfloat16 if your hardware support it with the following parameter:
f16: true
Quantization
Quantization
Description
bnb_8bit
8-bit quantization
bnb_4bit
4-bit quantization
xpu_8bit
8-bit quantization for Intel XPUs
xpu_4bit
4-bit quantization for Intel XPUs
Trust Remote Code
Some models like Microsoft Phi-3 requires external code than what is provided by the transformer library.
By default it is disabled for security.
It can be manually enabled with:
trust_remote_code: true
Maximum Context Size
Maximum context size in bytes can be specified with the parameter: context_size. Do not use values higher than what your model support.
Usage example:
context_size: 8192
Auto Prompt Template
Usually chat template is defined by the model author in the tokenizer_config.json file.
To enable it use the use_tokenizer_template: true parameter in the template section.
Usage example:
template:
use_tokenizer_template: true
Custom Stop Words
Stopwords are usually defined in tokenizer_config.json file.
They can be overridden with the stopwords parameter in case of need like in llama3-Instruct model.
Usage example:
stopwords:
- "<|eot_id|>"
- "<|end_of_text|>"
Usage
Use the completions endpoint by specifying the transformers model:
curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d '{
"model": "transformers",
"prompt": "Hello, my name is",
"temperature": 0.1, "top_p": 0.1
}'
Examples
OpenVINO
A model configuration file for openvion and starling model:
The chat endpoint supports the grammar parameter, which allows users to specify a grammar in Backus-Naur Form (BNF). This feature enables the Large Language Model (LLM) to generate outputs adhering to a user-defined schema, such as JSON, YAML, or any other format that can be defined using BNF. For more details about BNF, see Backus-Naur Form on Wikipedia.
Note
Compatibility Notice: This feature is only supported by models that use the llama.cpp backend. For a complete list of compatible models, refer to the Model Compatibility page. For technical details, see the related pull requests: PR #1773 and PR #1887.
Setup
To use this feature, follow the installation and setup instructions on the LocalAI Functions page. Ensure that your local setup meets all the prerequisites specified for the llama.cpp backend.
💡 Usage Example
The following example demonstrates how to use the grammar parameter to constrain the model’s output to either “yes” or “no”. This can be particularly useful in scenarios where the response format needs to be strictly controlled.
In this example, the grammar parameter is set to a simple choice between “yes” and “no”, ensuring that the model’s response adheres strictly to one of these options regardless of the context.
Example: JSON Output Constraint
You can also use grammars to enforce JSON output format:
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "gpt-4",
"messages": [{"role": "user", "content": "Generate a person object with name and age"}],
"grammar": "root ::= \"{\" \"\\\"name\\\":\" string \",\\\"age\\\":\" number \"}\"\nstring ::= \"\\\"\" [a-z]+ \"\\\"\"\nnumber ::= [0-9]+"
}'
Moderation - OpenAI-compatible safety classification whose response is constrained to the moderation schema
Interleaved Thinking with Tool Calls
Reasoning models can “think” before they answer. When such a model also calls a tool, the useful behaviour is for the thinking and the tool call to travel together, and for that thinking to survive the tool-result round trip. LocalAI calls this interleaved thinking: a single assistant turn carries both reasoning and tool_calls, and the client hands the reasoning back on the next turn so the model’s chain of thought is not lost when the tool result is appended.
This matters because a tool-calling loop is multi-turn. The model reasons, asks for a tool, your client runs the tool, and then you call the model again with the tool result. Without interleaved thinking the reasoning produced in the first turn is discarded, and the model has to reconstruct its plan from scratch. With it, the reasoning is echoed back and the model continues where it left off.
An assistant turn that both reasons and calls a tool returns the two fields side by side:
reasoning holds the model’s thinking.
tool_calls holds the structured calls.
finish_reason is tool_calls.
Your client runs the tool, then sends the conversation back with:
the original assistant message (including its reasoning and tool_calls), and
a tool role message carrying the tool result.
LocalAI reads the returned reasoning back into the model’s context so the chain is continuous.
Field naming
OpenAI chat completions (/v1/chat/completions): the response carries reasoning alongside tool_calls. On inbound assistant messages LocalAI now also accepts reasoning_content as an alias for reasoning. This alias exists because several clients (vLLM, DeepSeek, and cogito) emit the field under the name reasoning_content; either name is accepted and mapped to the same internal field.
Anthropic Messages (/v1/messages): reasoning is carried as thinking content blocks. On the local path LocalAI emits a thinking block before the tool_use block, and reads inbound thinking blocks back into reasoning. Because local models produce no cryptographic signature, LocalAI attaches a synthetic opaque signature to the emitted block, and does not validate the signature on inbound blocks. The thinking block is only emitted when the request opts in with the thinking parameter:
{"model":"your-reasoning-model","max_tokens":1024,"thinking":{"type":"enabled"},"messages":[{"role":"user","content":"What is the weather in Rome?"}]}
Enabling reasoning per backend
Interleaved thinking requires the backend to separate the model’s thinking from its final answer. How you turn that on depends on the backend.
llama.cpp
Set the reasoning_format model option. Accepted values: none, auto, deepseek, deepseek-legacy. auto lets the backend pick based on the model’s chat template; deepseek and deepseek-legacy force the DeepSeek-style <think>...</think> extraction.
Set the reasoning_parser model option to vLLM’s native reasoning parser for the model family. LocalAI also ships an auto-configuration hook (core/config/hooks_vllm.go) that sets the reasoning parser and the tool-call parser together for known families, so for gallery-imported vLLM models this is often configured for you.
Request a chat completion with a tool defined and a prompt that requires the model to reason before acting:
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "your-reasoning-model",
"messages": [
{ "role": "user", "content": "What is the weather in Rome?" }
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": { "type": "string" }
},
"required": ["city"]
}
}
}
]
}'
The response message carries both the reasoning and the tool call, and finish_reason is tool_calls:
{"choices":[{"finish_reason":"tool_calls","message":{"role":"assistant","content":"","reasoning":"Okay, the user is asking about the weather in Rome... I need to call get_weather with city Rome.","tool_calls":[{"id":"call_abc123","type":"function","function":{"name":"get_weather","arguments":"{\"city\":\"Rome\"}"}}]}}]}
To continue, run get_weather, then send the conversation back with the assistant message (keeping its reasoning and tool_calls) followed by a tool message holding the result. LocalAI feeds the returned reasoning back into context so the model resumes its chain of thought.
Known limitations
Streaming Anthropic thinking blocks. In streaming mode, a thinking block is currently emitted only on the tool-call path that goes through the llama.cpp C++ autoparser. A plain streaming text-only turn, or a tool turn resolved through the inline token path, does not stream a thinking block. The equivalent non-streaming request does return one. Non-streaming emits thinking on all branches; only the streaming path has this gap.
Upstream llama.cpp leak on newest hybrid models. On the newest hybrid reasoning models (Qwen3.5 / Qwen3.6) there is an upstream llama.cpp bug where tool calls can leak into reasoning_content instead of being parsed into tool_calls. This is tracked upstream at ggml-org/llama.cpp discussion #23351.
Reasoning budget vs the tool call. If a reasoning model’s thinking exhausts the output budget (max_tokens) before it emits the tool call, no tool call is produced. Give the model enough max_tokens to cover both the reasoning and the call. In this case LocalAI reports finish_reason: "length".
Embeddings
LocalAI supports generating embeddings for text or list of tokens.
For face embeddings specifically, see the
Face Recognition feature - it produces
512-d L2-normalized vectors tuned for face similarity.
The embedding endpoint is compatible with llama.cpp models, bert.cpp models and sentence-transformers models available in huggingface.
Choosing the model
Send the model name in the request body. If the body has no model, LocalAI uses the configured embeddings model whose name comes first alphabetically. If no embeddings model is configured, the request returns 400 Bad Request. A model name is never taken from the bearer token unless it matches a configured model name exactly.
Using Gallery Models
LocalAI provides a model gallery with pre-configured embedding models. To use a gallery model:
Ensure the model is available in the gallery (check Model Gallery)
Use the model name directly in your API calls
Example gallery models:
qwen3-embedding-4b - Qwen3 Embedding 4B model
qwen3-embedding-8b - Qwen3 Embedding 8B model
qwen3-embedding-0.6b - Qwen3 Embedding 0.6B model
Example: Using Qwen3-Embedding-4B from Gallery
curl http://localhost:8080/embeddings -X POST -H "Content-Type: application/json" -d '{
"input": "My text to embed",
"model": "qwen3-embedding-4b",
"dimensions": 2560
}'
Manual Setup
Create a YAML config file in the models directory. Specify the backend and the model file.
name:text-embedding-ada-002# The model name used in the APIparameters:model:<model_file>backend:"<backend>"embeddings:true
Hugging Face embeddings
To use sentence-transformers models from Hugging Face, set backend: transformers and type: SentenceTransformer.
curl http://localhost:8080/embeddings -X POST -H "Content-Type: application/json" -d '{
"input": "My text",
"model": "my-awesome-model"
}'| jq "."
Embedding chat conversations and Go-side pooling
/v1/embeddings also accepts a chat conversation via messages (a LocalAI
extension), plus a per-request pooling scheme that LocalAI applies itself to
the backend’s raw per-token vectors:
curl http://localhost:8080/v1/embeddings -X POST -H "Content-Type: application/json" -d '{
"model": "my-awesome-model",
"messages": [
{"role": "system", "content": "You are a support agent."},
{"role": "user", "content": "My invoice is wrong."}
],
"pooling": "decayed_mean",
"pooling_half_life_tokens": 256
}'
One conversation per request; the response is the standard OpenAI embeddings
shape with a single data[0].embedding item.
input and messages are mutually exclusive (400 otherwise); an unknown
pooling value is also a 400.
If the model config carries both template.chat and template.chat_message,
the conversation renders exactly like a chat prompt, so the embedding matches
what a chat model would actually see. Otherwise a frozen role-prefixed
fallback is used (<role>: <content> lines joined by newlines, empty-content
messages skipped). Non-text content parts (images, audio, video) are ignored.
pooling selects how the per-token vectors are reduced to one embedding:
Value
Meaning
(empty) / backend
The backend pools by itself: the default, today’s exact behavior.
mean
Average of all token vectors.
last
The last token’s vector.
decayed_mean
Recency-weighted mean: token i of T weighs 2^(-(T-1-i)/H) with half-life H = pooling_half_life_tokens (default 256): recent turns dominate without erasing earlier context.
Go-side schemes need raw per-token vectors from the backend. Each backend
declares whether an embedding result is final or per-token; LocalAI rejects a
Go-side scheme for a final vector and rejects backend pass-through for a
per-token matrix instead of guessing from its shape. Older backends that do
not declare a layout remain compatible with backend pooling only.
llama.cpp chooses this layout when the model is loaded. LocalAI automatically
adds the pooling:none backend option when a llama.cpp model sets a Go-side
parameters.pooling scheme. That raw-loaded instance can switch between
mean, last, and decayed_mean per request, but it cannot switch back to
backend pooling without reloading. Conversely, a backend-pooled llama.cpp
instance rejects per-request Go pooling. Other backends may support Go-side
pooling when they explicitly return per-token vectors.
After Go-side pooling, the vector is normalized with llama.cpp’s
embd_normalize rule (default L2; configurable through
options: ["embd_normalize:<n>"]).
Go-side pooling requires an up-to-date backend that reports its embedding
layout. A legacy backend fails closed for Go-side schemes with an error asking
you to rebuild or update it.
💡 Examples
Example that uses LLamaIndex and LocalAI as embedding: here.
⚠️ Common Issues and Troubleshooting
Issue: Embedding model not returning correct results
Symptoms:
Model returns empty or incorrect embeddings
API returns errors when calling embedding endpoint
Common Causes:
Incorrect model filename: Ensure you’re using the correct filename from the gallery or your model file location.
Gallery models use specific filenames (e.g., Qwen3-Embedding-4B-Q4_K_M.gguf)
Returned embedding dimensions don’t match expected dimensions
Solution:
Use the dimensions parameter in your API request to specify the output dimension
Qwen3-Embedding models support dimensions from 32 to 2560 (4B) or 4096 (8B)
curl http://localhost:8080/embeddings -X POST -H "Content-Type: application/json" -d '{
"input": "My text",
"model": "qwen3-embedding-4b",
"dimensions": 1024
}'
Issue: Model not found
Symptoms:
API returns 404 or “model not found” error
Solution:
Ensure the model is properly configured in the models directory
Check that the model name in your API request matches the name field in the configuration
For gallery models, ensure the gallery is properly loaded
Qwen3 Embedding Models Specifics
The Qwen3 Embedding series models have these characteristics:
Model
Parameters
Max Context
Max Dimensions
Supported Languages
qwen3-embedding-0.6b
0.6B
32k
1024
100+
qwen3-embedding-4b
4B
32k
2560
100+
qwen3-embedding-8b
8B
32k
4096
100+
All models support:
User-defined output dimensions (32 to max dimensions)
Multilingual text embedding (100+ languages)
Instruction-tuned embedding with custom instructions
Reranker
A reranking model, often referred to as a cross-encoder, is a core component in the two-stage retrieval systems used in information retrieval and natural language processing tasks.
Given a query and a set of documents, it will output similarity scores.
We can use then the score to reorder the documents by relevance in our RAG system to increase its overall accuracy and filter out non-relevant results.
LocalAI supports reranker models, and you can use them by using the rerankers backend, which uses rerankers.
Usage
You can test rerankers by using container images with python (this does NOT work with core images) and a model config file like this, or by installing cross-encoder from the gallery in the UI:
curl http://localhost:8080/v1/rerank \
-H "Content-Type: application/json"\
-d '{
"model": "jina-reranker-v1-base-en",
"query": "Organic skincare products for sensitive skin",
"documents": [
"Eco-friendly kitchenware for modern homes",
"Biodegradable cleaning supplies for eco-conscious consumers",
"Organic cotton baby clothes for sensitive skin",
"Natural organic skincare range for sensitive skin",
"Tech gadgets for smart homes: 2024 edition",
"Sustainable gardening tools and compost solutions",
"Sensitive skin-friendly facial cleansers and toners",
"Organic food wraps and storage solutions",
"All-natural pet food for dogs with allergies",
"Yoga mats made from recycled materials"
],
"top_n": 3
}'
Moderation
LocalAI exposes an OpenAI-compatible text moderation endpoint at
POST /v1/moderations. It uses a local text-generation model with a constrained
JSON grammar, so no separate moderation service or cloud API is required.
input may be one string or an array of strings. The response contains one
result per input with flagged, categories, category_scores, and
category_applied_input_types fields. The category names match the OpenAI
moderation API, including harassment, hate, illicit activity, self-harm,
sexual content, and violence categories.
The selected model must support text completion. For consistent results, use
an instruction-tuned model that follows safety-classification prompts well.
LocalAI constrains the output shape, but the model determines the classification
quality and confidence scores.
Note
This first implementation supports text only. OpenAI-style multimodal input
objects containing images return a validation error.
Time-Series Forecasting
LocalAI forecasts numeric time series with timestral.cpp, a C++/ggml port of Mistral’s Timestral models. You send one or more series, with optional covariates, to POST /v1/forecast and get quantile trajectories for the next steps.
A forecast model has its own usecase, forecast. It does not appear in the chat model picker. It shows in the gallery filter and in the /v1/models capability list.
Models
Gallery entry
Parameters
Builds
timestral-5m
5 million
F32 (default), F16
timestral-28m
28 million
F32 (default), F16
timestral-123m
123 million
F32 (default), F16
timestral-209m
209 million
F32 (default), F16
local-ai models install timestral-28m
The weights have a licence limit. Read the licence below before you use them.
The default build is F32. Install the F16 entry, for example timestral-28m-f16, for a build of about half the size. Quantized builds below F16 are not offered yet.
The engine runs on the CPU only. It is slower than the PyTorch reference at long context lengths, so keep the context short where you can and allow a long request timeout.
The gallery lists no memory size for these models.
Levels to return. Each must be a level the model was trained on. Default: 0.1, 0.5, 0.9.
max_context
integer
Most history steps the model uses. 0 or absent keeps the model default.
symmetric_averaging, clip_nonnegative
boolean or null
null or absent keeps the model default.
series
list
The series to forecast.
Each entry of series has these fields:
Field
Shape
Meaning
id
string
Optional. Returned with the result.
target
[variates][steps], or [steps] for one variate
History, oldest step first. null marks a missing value.
past_covariates
[covariates][steps]
Numeric covariates known only for the history.
known_covariates
[covariates][steps + prediction_length]
Numeric covariates that are also known for the future.
past_categorical
[covariates][steps]
Integer category codes for the history. null marks a missing code.
known_categorical
[covariates][steps + prediction_length]
Integer category codes that are also known for the future.
Series in one request can have different lengths and different numbers of variates or covariates. LocalAI groups them by shape, runs one forecast for each group, and returns the results in the order you sent the series.
values[q][h] is the value of level quantile_levels[q] at step h. Step 0 is the first step after the last step of the history. The numbers above are an example of the shape, not real output.
Errors
The endpoint returns 400 when:
prediction_length is less than 1, or series is empty.
A row has the wrong number of steps, for example a known covariate that stops at the end of the history.
A value is not a finite number, or a categorical code is not an integer. NaN and infinity are not valid JSON; use null for a missing value.
A requested quantile is not a level of the model. The error lists the valid levels.
The request is larger than the model limits.
Model options
Set these under options: in the model configuration:
History cap used when a request sets none. 0 keeps the model default.
max_series
256
Most series in one request.
max_total_points
2000000
Most input values in one request.
threads sets the number of CPU threads for each forecast.
A loaded model handles one forecast at a time.
Licence
Licence. The Timestral weights use Mistral’s Modified MIT licence. You may not use them if the global consolidated monthly revenue of your company (or your employer) exceeded USD 20 million in the preceding month, unless you get a commercial licence from Mistral AI. The restriction covers derivatives, so it also applies to the GGUF conversions in the gallery. Each gallery entry installs the licence text next to the weights. The timestral.cpp code is MIT.
Platforms
The backend image is built for Linux on amd64 and arm64. Apple silicon is not supported yet.
Benchmark text models
Use local-ai benchmark to compare text inference through a running LocalAI
server. Install and configure the models first. The command sends sequential,
non-streaming requests to /v1/chat/completions and reports full request latency
and end-to-end completion tokens per second.
Pass one or more configured model names. To compare backends, configure separate
model aliases with the desired backend, then pass those aliases. Backend names
alone are not model names. The command does not install, discover, or unload
models; the server’s normal loading and eviction settings still apply.
For example, with models named text-llama-cpp and text-vllm configured:
local-ai benchmark text-llama-cpp text-vllm --runs 5 --warmup 1\
--prompt 'Explain how a rainbow forms.' --max-tokens 128
To save settings, per-model summaries, and every measured sample:
For an authenticated server, set LOCALAI_API_KEY or API_KEY in the environment.
The API key is excluded from the JSON report. Use --endpoint for a remote server
or reverse proxy:
The endpoint accepts a server root, an optional /v1 suffix, and trailing
slashes. A reverse proxy path prefix is preserved. Redirects are refused.
Credentials in the URL, query strings, and fragments are rejected.
Arguments and flags
Argument or flag
Default
Description
MODEL ...
Required
One or more configured text model names.
--endpoint
http://127.0.0.1:8080
Server URL, optionally ending in /v1.
--api-key
Unset
API key; also reads LOCALAI_API_KEY, then API_KEY.
--prompt
Explain why the sky is blue.
Nonblank user message repeated for every request.
--max-tokens
128
Positive maximum number of completion tokens per request.
--runs
3
Positive number of measured requests per model.
--warmup
1
Unmeasured requests before each model; zero disables warmups.
--timeout
5m
Positive timeout per request, including reading its response.
--json
false
Write JSON instead of a table.
-h, --help
Show command help.
Every request sets temperature to 0 and streaming to false. Interrupting the
command cancels the active request. A failed request stops the benchmark with a
model and run error; results are written only after every model succeeds.
Reading the results
Each model has minimum, mean, and maximum latency across measured requests.
Latency runs from sending the request through parsing the complete response.
It includes transport, queueing, prompt processing, generation, and response
parsing. This command does not measure time to first token.
End-to-end completion tokens per second is the sum of server-reported completion
tokens divided by the sum of full request durations. It is not decode-only speed
or a substitute for llama-bench kernel measurements. If any measured response
omits completion token usage, throughput is null in JSON and N/A in the table.
Reported zero tokens remain zero. Missing prompt or completion counts remain
null in each JSON sample; the command never estimates tokens from text length.
Warmups run separately for each model and do not appear in measurements. They can
absorb model loading time, but repeated prompts can also benefit from prompt
caching. With --warmup 0, measured requests can include model loading. Other
clients and server queueing can affect results; compare under similar load.
Keep hardware, quantization, context size, backend settings, and prompt consistent
when comparing engines. Different model tokenizers can report different token
counts for the same text, and models can stop before --max-tokens. Temperature
zero does not guarantee identical output across models or engines. The JSON
settings describe the benchmark requests, not the server’s full model
configuration; record that configuration alongside the report.
Audio and speech
Speech to text, text to speech, sound classification, speakers and voice activity. The Voice add-on is a page for voice recognition and the voice library, and the Talk add-on is a page for a spoken conversation.
API Compatibility The LocalAI TTS API is compatible with the OpenAI TTS API and the Elevenlabs API.
LocalAI API The /tts endpoint can also be used to generate speech from text.
Usage Input: input, model
Sound-event classification (audio tagging) answers the question “what am I hearing?” - given an audio clip, it returns a list of scored AudioSet labels (e.g. Baby cry, infant cry, Glass breaking, Dog bark, Alarm).
LocalAI exposes this through the /v1/audio/classification endpoint, modelled after /v1/audio/transcriptions. The reference backend is ced.cpp (CED, a 527-class AudioSet tagger), a small ViT over a log-mel spectrogram ported to ggml with full PyTorch parity. Apache-2.0 weights are redistributable as GGUF.
Speaker diarization answers the question “who spoke when?” - given an audio clip with multiple speakers, it returns time-stamped segments labelled with a stable speaker ID (SPEAKER_00, SPEAKER_01, …).
LocalAI exposes this through the /v1/audio/diarization endpoint, modelled after /v1/audio/transcriptions. Five backends are supported today:
sherpa-onnx - pyannote-3.0 segmentation + a speaker-embedding extractor (3D-Speaker, NeMo, WeSpeaker) + fast clustering. Pure diarization - no transcription cost. Recommended when you only need speaker turns. vibevoice.cpp - produces speaker-labelled segments as a by-product of its long-form ASR pass, so you can optionally get a transcript per segment for free. NeMo-Speech.cpp - NVIDIA Sortformer, served standalone by the NeMo-Speech.cpp backend. It is end to end, so the speaker capacity is fixed by the checkpoint and the count hints are ignored. The same backend can instead put speaker tags on a transcript, by attaching a Sortformer model to an ASR one. audio.cpp - the sortformer_diar family, served by the multi-modality audio.cpp backend. parakeet.cpp - NVIDIA Nemotron-3-Diarization (Sortformer, up to 8 speakers), served standalone or paired with a Parakeet ASR model for per-segment text. See the Audio to Text page for the parakeet-cpp option reference. Because diarization is exposed as a regular OpenAI-compatible endpoint, any HTTP client works. There is no Python dependency on pyannote or NeMo on the consumer side.
The audio-transform endpoints take audio in and emit audio out, optionally conditioned on a second reference audio signal. The category is generic by design - concrete operations include joint acoustic echo cancellation + noise suppression + dereverberation (LocalVQE), voice conversion (reference = target speaker), pitch shifting, audio super-resolution, and so on.
Voice Activity Detection (VAD) identifies segments of speech in audio data. LocalAI provides a /v1/vad endpoint powered by the Silero VAD backend.
The audio.cpp backend also serves this endpoint, and ships the silero_vad and marblenet_vad assets inside its own package, so VAD works there with nothing to download (model: bundled:silero_vad plus the family:silero_vad option).
API Method: POST Endpoints: /v1/vad, /vad Request The request body is JSON with the following fields:
LocalAI supports voice (speaker) recognition: speaker verification (1:1), speaker identification (1:N) against a built-in vector store, speaker embedding, and demographic analysis (age / gender / emotion from voice).
The audio analog to Face Recognition, served over the same /v1/voice/* HTTP API by two backends:
Subsections of Audio and speech
Audio to Text
Audio to text models are models that can generate text from an audio file.
The transcription endpoint allows to convert audio files to text. The endpoint supports multiple backends:
whisper.cpp: A C++ library for audio transcription (default)
moonshine: Ultra-fast transcription engine optimized for low-end devices
faster-whisper: Fast Whisper implementation with CTranslate2
WhisperX: Whisper transcription with word alignment and optional speaker diarization. Set HF_TOKEN and pass diarize=true to load WhisperX’s gated pyannote diarization pipeline.
parakeet-cpp: A C++/ggml port of NVIDIA NeMo Parakeet (FastConformer TDT/CTC/RNNT/hybrid). Runs quantized GGUFs on CPU or GPU, emits word-level timestamps, and supports cache-aware streaming (the realtime_eou model surfaces end-of-utterance events). The same backend also loads Nemotron-3-Diarization (/v1/audio/diarization) and CED sound models (/v1/audio/classification), and can attach either as a companion to a transcription model.
llama-cpp: Route transcription to any multimodal-audio GGUF model served by the llama-cpp backend (e.g. Qwen3-ASR, Voxtral, Qwen2-Audio). Under the hood the request is converted into a chat completion with the audio attached via the model’s audio encoder - the same path the upstream llama.cpp server uses. Set backend: llama-cpp in the model YAML and point mmproj at the matching audio encoder.
voxtral: Voxtral-family models served by a dedicated backend
NeMo-Speech.cpp: NVIDIA’s C++/ggml runtime for the Nemotron Speech models. Serves offline, streaming and live transcription, with VAD, punctuation, inverse text normalization and Sortformer speaker tags attached through model options, and covers diarization, speech synthesis and translation from the same backend. See the NeMo-Speech.cpp backend page for the model options.
audio.cpp: Multi-family GGML audio engine. Serves transcription and forced alignment from families such as nemotron_asr, qwen3_asr, citrinet_asr, higgs_audio_stt and voxtral_realtime, and covers diarization, VAD, TTS and source separation from the same backend. See the audio.cpp backend page for the model options.
The endpoint input supports all the audio formats supported by ffmpeg. LocalAI runs the ffmpeg program from PATH, or the program that LOCALAI_FFMPEG_PATH names.
Looking for “who spoke when” instead of a flat transcript? See Speaker Diarization - /v1/audio/diarization returns time-stamped speaker segments and supports the rttm format used by pyannote.metrics.
Usage
Once LocalAI is started and whisper models are installed, you can use the /v1/audio/transcriptions API endpoint.
When usage statistics are enabled, successful requests to /v1/audio/transcriptions
and /audio/transcriptions contribute request counts and elapsed time for the
requested model name, including an alias. This includes streaming responses. Token counts remain zero
because transcription results do not provide canonical token usage. Failed
transcriptions, including errors reported within a stream, do not count as
successful usage.
When API tracing is enabled, multipart transcription requests appear in Traces
with the model name, response, status, and elapsed time. The captured request
body contains metadata marked multipart upload omitted; API traces do not
store the uploaded audio. Response capture follows the configured trace size
limit. Backend traces have their own payload capture behavior.
Example
Download one of the models from here in the models folder,
and create a YAML file for your model:
The transcriptions endpoint then can be tested like so:
## Get an example audio filewget --quiet --show-progress -O gb1.ogg https://upload.wikimedia.org/wikipedia/commons/1/1f/George_W_Bush_Columbia_FINAL.ogg
## Send the example audio file to the transcriptions endpointcurl http://localhost:8080/v1/audio/transcriptions -H "Content-Type: multipart/form-data" -F file="@$PWD/gb1.ogg" -F model="whisper-1"
Result:
{"segments":[{"id":0,"start":0,"end":9640000000,"text":" My fellow Americans, this day has brought terrible news and great sadness to our country.","tokens":[50364,1222,7177,6280,11,341,786,575,3038,6237,2583,293,869,22462,281,527,1941,13,50846]},{"id":1,"start":9640000000,"end":15960000000,"text":" At 9 o'clock this morning, Mission Control and Houston lost contact with our Space Shuttle","tokens":[1711,1722,277,6,9023,341,2446,11,20170,12912,293,18717,2731,3385,365,527,8705,13870,10972,51162]},{"id":2,"start":15960000000,"end":16960000000,"text":" Columbia.","tokens":[17339,13,51212]},{"id":3,"start":16960000000,"end":24640000000,"text":" A short time later, debris was seen falling from the skies above Texas.","tokens":[316,2099,565,1780,11,21942,390,1612,7440,490,264,25861,3673,7885,13,51596]},{"id":4,"start":24640000000,"end":27200000000,"text":" The Columbia's lost.","tokens":[440,17339,311,2731,13,51724]},{"id":5,"start":27200000000,"end":29920000000,"text":" There are no survivors.","tokens":[821,366,572,18369,13,51860]},{"id":6,"start":29920000000,"end":32920000000,"text":" And board was a crew of seven.","tokens":[50364,400,3150,390,257,7260,295,3407,13,50514]},{"id":7,"start":32920000000,"end":39780000000,"text":" Colonel Rick Husband, Lieutenant Colonel Michael Anderson, Commander Laurel Clark, Captain","tokens":[28478,11224,21282,4235,11,28412,28478,5116,18768,11,20857,27270,75,18572,11,10873,50857]},{"id":8,"start":39780000000,"end":50020000000,"text":" David Brown, Commander William McCool, Dr. Cooltna Chavla, and Elon Ramon, a Colonel","tokens":[4389,8030,11,20857,6740,4050,34,1092,11,2491,13,8561,83,629,761,706,875,11,293,28498,9078,266,11,257,28478,51369]},{"id":9,"start":50020000000,"end":52800000000,"text":" in the Israeli Air Force.","tokens":[294,264,19974,5774,10580,13,51508]},{"id":10,"start":52800000000,"end":58480000000,"text":" These men and women assumed great risk in the service to all humanity.","tokens":[1981,1706,293,2266,15895,869,3148,294,264,2643,281,439,10243,13,51792]},{"id":11,"start":58480000000,"end":63120000000,"text":" And an age when Space Flight has come to seem almost routine.","tokens":[50364,400,364,3205,562,8705,28954,575,808,281,1643,1920,9927,13,50596]},{"id":12,"start":63120000000,"end":68800000000,"text":" It is easy to overlook the dangers of travel by rocket and the difficulties of navigating","tokens":[467,307,1858,281,37826,264,27701,295,3147,538,13012,293,264,14399,295,32054,50880]},{"id":13,"start":68800000000,"end":72640000000,"text":" the fierce outer atmosphere of the Earth.","tokens":[264,25341,10847,8018,295,264,4755,13,51072]},{"id":14,"start":72640000000,"end":78040000000,"text":" These astronauts knew the dangers and they faced them willingly.","tokens":[1981,28273,2586,264,27701,293,436,11446,552,44675,13,51342]},{"id":15,"start":78040000000,"end":83040000000,"text":" Knowing they had a high and noble purpose in life.","tokens":[25499,436,632,257,1090,293,20171,4334,294,993,13,51592]},{"id":16,"start":83040000000,"end":90800000000,"text":" Because of their courage and daring and idealism, we will miss them all the more.","tokens":[50364,1436,295,641,9892,293,43128,293,7157,1434,11,321,486,1713,552,439,264,544,13,50752]},{"id":17,"start":90800000000,"end":96560000000,"text":" All Americans today are thinking as well of the families of these men and women who have","tokens":[1057,6280,965,366,1953,382,731,295,264,4466,295,613,1706,293,2266,567,362,51040]},{"id":18,"start":96560000000,"end":100440000000,"text":" been given this sudden shock in grief.","tokens":[668,2212,341,3990,5588,294,18998,13,51234]},{"id":19,"start":100440000000,"end":102400000000,"text":" You're not alone.","tokens":[509,434,406,3312,13,51332]},{"id":20,"start":102400000000,"end":105440000000,"text":" Our entire nation agrees with you.","tokens":[2621,2302,4790,26383,365,291,13,51484]},{"id":21,"start":105440000000,"end":112360000000,"text":" And those you loved will always have the respect and gratitude of this country.","tokens":[400,729,291,4333,486,1009,362,264,3104,293,16935,295,341,1941,13,51830]},{"id":22,"start":112360000000,"end":116600000000,"text":" The cause in which they died will continue.","tokens":[50364,440,3082,294,597,436,4539,486,2354,13,50576]},{"id":23,"start":116600000000,"end":124240000000,"text":" Man kind is led into the darkness beyond our world by the inspiration of discovery and the","tokens":[2458,733,307,4684,666,264,11262,4399,527,1002,538,264,10249,295,12114,293,264,50958]},{"id":24,"start":124240000000,"end":127000000000,"text":" longing to understand.","tokens":[35050,281,1223,13,51096]},{"id":25,"start":127000000000,"end":131160000000,"text":" Our journey into space will go on.","tokens":[2621,4671,666,1901,486,352,322,13,51304]},{"id":26,"start":131160000000,"end":136480000000,"text":" In the skies today, we saw destruction and tragedy.","tokens":[682,264,25861,965,11,321,1866,13563,293,18563,13,51570]},{"id":27,"start":136480000000,"end":142080000000,"text":" As farther than we can see, there is comfort and hope.","tokens":[1018,20344,813,321,393,536,11,456,307,3400,293,1454,13,51850]},{"id":28,"start":142080000000,"end":149800000000,"text":" In the words of the prophet Isaiah, lift your eyes and look to the heavens who created","tokens":[50364,682,264,2283,295,264,18566,27263,11,5533,428,2575,293,574,281,264,26011,567,2942,50750]},{"id":29,"start":149800000000,"end":151640000000,"text":" all these.","tokens":[439,613,13,50842]},{"id":30,"start":151640000000,"end":159960000000,"text":" He who brings out the story hosts one by one and calls them each by name because of his great","tokens":[634,567,5607,484,264,1657,21573,472,538,472,293,5498,552,1184,538,1315,570,295,702,869,51258]},{"id":31,"start":159960000000,"end":163400000000,"text":" power and mighty strength.","tokens":[1347,293,21556,3800,13,51430]},{"id":32,"start":163400000000,"end":166400000000,"text":" Not one of them is missing.","tokens":[1726,472,295,552,307,5361,13,51580]},{"id":33,"start":166400000000,"end":173600000000,"text":" The same creator who names the stars also knows the names of the seven souls we mourn","tokens":[50364,440,912,14181,567,5288,264,6105,611,3255,264,5288,295,264,3407,16588,321,22235,77,50724]},{"id":34,"start":173600000000,"end":175600000000,"text":" today.","tokens":[965,13,50824]},{"id":35,"start":175600000000,"end":183160000000,"text":" The crew of the shuttle Columbia did not return safely to earth yet we can pray that all","tokens":[440,7260,295,264,26728,17339,630,406,2736,11750,281,4120,1939,321,393,3690,300,439,51202]},{"id":36,"start":183160000000,"end":185840000000,"text":" are safely home.","tokens":[366,11750,1280,13,51336]},{"id":37,"start":185840000000,"end":192600000000,"text":" May God bless the grieving families and may God continue to bless America.","tokens":[1891,1265,5227,264,48454,4466,293,815,1265,2354,281,5227,3374,13,51674]},{"id":38,"start":196400000000,"end":206400000000,"text":" [BLANK_AUDIO]","tokens":[50364,542,37592,62,29937,60,50864]}],"text":"My fellow Americans, this day has brought terrible news and great sadness to our country. At 9 o'clock this morning, Mission Control and Houston lost contact with our Space Shuttle Columbia. A short time later, debris was seen falling from the skies above Texas. The Columbia's lost. There are no survivors. And board was a crew of seven. Colonel Rick Husband, Lieutenant Colonel Michael Anderson, Commander Laurel Clark, Captain David Brown, Commander William McCool, Dr. Cooltna Chavla, and Elon Ramon, a Colonel in the Israeli Air Force. These men and women assumed great risk in the service to all humanity. And an age when Space Flight has come to seem almost routine. It is easy to overlook the dangers of travel by rocket and the difficulties of navigating the fierce outer atmosphere of the Earth. These astronauts knew the dangers and they faced them willingly. Knowing they had a high and noble purpose in life. Because of their courage and daring and idealism, we will miss them all the more. All Americans today are thinking as well of the families of these men and women who have been given this sudden shock in grief. You're not alone. Our entire nation agrees with you. And those you loved will always have the respect and gratitude of this country. The cause in which they died will continue. Man kind is led into the darkness beyond our world by the inspiration of discovery and the longing to understand. Our journey into space will go on. In the skies today, we saw destruction and tragedy. As farther than we can see, there is comfort and hope. In the words of the prophet Isaiah, lift your eyes and look to the heavens who created all these. He who brings out the story hosts one by one and calls them each by name because of his great power and mighty strength. Not one of them is missing. The same creator who names the stars also knows the names of the seven souls we mourn today. The crew of the shuttle Columbia did not return safely to earth yet we can pray that all are safely home. May God bless the grieving families and may God continue to bless America. [BLANK_AUDIO]"}
You can also specify the response_format parameter to be one of lrc, srt, vtt, text, json or verbose_json (default):
## Send the example audio file to the transcriptions endpointcurl http://localhost:8080/v1/audio/transcriptions -H "Content-Type: multipart/form-data" -F file="@$PWD/gb1.ogg" -F model="whisper-1" -F response_format="srt"
Result (first few lines):
1
00:00:00,000 --> 00:00:09,640
My fellow Americans, this day has brought terrible news and great sadness to our country.
2
00:00:09,640 --> 00:00:15,960
At 9 o'clock this morning, Mission Control and Houston lost contact with our Space Shuttle
3
00:00:15,960 --> 00:00:16,960
Columbia.
4
00:00:16,960 --> 00:00:24,640
A short time later, debris was seen falling from the skies above Texas.
5
00:00:24,640 --> 00:00:27,200
The Columbia's lost.
6
00:00:27,200 --> 00:00:29,920
There are no survivors.
Supported request parameters
In addition to file and model, the endpoint accepts the following multipart form fields, matching the OpenAI audio transcription API:
Field
Description
language
ISO-639-1 language hint (e.g. en). Passed through to the backend.
prompt
Optional context hint to bias the decoder.
temperature
Sampling temperature (float). Honored by backends that support it.
timestamp_granularities[]
Multi-value form field: word and/or segment. Honored when the backend produces the requested granularity.
response_format
One of json (default for backwards-compat), verbose_json, text, srt, vtt, lrc.
stream
When true, the endpoint emits an SSE stream of transcript.text.delta events followed by a final transcript.text.done event.
diarize
LocalAI extension - speaker diarization. WhisperX requires HF_TOKEN; requests fail with FailedPrecondition when it is missing.
If speaker diarization fails after transcription succeeded, the WhisperX backend logs the error and returns the transcript without speaker labels. Other transcription failures return an error instead of an empty transcript. Diarization still requires HF_TOKEN.
The response body for verbose_json includes text, language, duration, and segments[] (with speaker populated when diarization is enabled).
Streaming transcriptions
Set -F stream=true to receive token-by-token SSE events as the backend produces them. The event shape matches the OpenAI streaming transcription format:
data: {"type":"transcript.text.delta","delta":"And so, my"}
data: {"type":"transcript.text.delta","delta":" fellow Americans..."}
data: {"type":"transcript.text.done","text":"And so, my fellow Americans..."}
data: [DONE]
Backends that do not natively stream tokens fall back to emitting one delta plus a done event with the full text - the SSE contract is identical either way.
Using the llama-cpp backend with an audio-capable model
Any GGUF model whose mmproj contains an audio encoder can be used for transcription via the llama-cpp backend. This reuses the model’s own audio front-end rather than shelling out to whisper.cpp, which is useful when you want a single backend serving both chat-with-audio and transcription.
The gallery entries lfm3-audio-2b and lfm3-audio-2b-q8 also transcribe through the llama-cpp backend, using the same model as speech-to-speech and TTS. When a language is given, the request asks for transcription in that language with the system prompt Perform ASR in <Language>.. Without one, the model is asked to infer the language. Transcription uses the second slot (parallel:2), so it can run next to a realtime session. A realtime session does not use it for the input transcript by default; see Realtime. This needs a llama.cpp build with LFM3-Audio support.
Using the parakeet-cpp backend
parakeet.cpp is a C++/ggml port of NVIDIA NeMo Parakeet that matches the upstream PyTorch models on CPU. GGUF weights for every model and quant are published in a single repo, mudler/parakeet-cpp-gguf. F16 is the recommended default, and Q4_K stays near-lossless on the small models. The easiest path is to import directly (the GGUFs auto-detect to this backend):
For real-time use, load a cache-aware streaming model (e.g. realtime_eou_120m-v1-*.gguf) and pass -F stream=true. Deltas are emitted as the audio is decoded, with end-of-utterance events closing each segment.
A request without stream=true to a model that emits end-of-utterance tokens is also decoded as a stream, with one segment per utterance. The offline decode of such a model stops at the first end-of-utterance token, so a file with more than one sentence would otherwise return only the first one. The vad:true and guard_* options keep the offline decode.
Diarization and sound classification
The same backend also serves the /v1/audio/diarization and /v1/audio/classification endpoints, and can attach a diarization or sound model to a live transcription session. options: accepts paths relative to the models directory, or absolute:
Option
Allowed on
Used for
asr_model:<path>
a diarization model
include_text on /v1/audio/diarization
diarization_model:<path>
an ASR model
a speaker on transcript segments (and words), and speaker segments during realtime live transcription
sound_model:<path>
an ASR or diarization model
sound events during realtime live transcription, sounds on /v1/audio/diarization with include_sounds=true, and /v1/audio/classification on the loaded model
extra encoder tag for registered voices that carry only a file-name tag (see Voice Recognition)
speaker_threshold:<float>
a model with speaker_model
distance (1 minus cosine similarity) under which a speaker is named, in (0, 2); default 0.5
speaker_margin:<float>
a model with speaker_model
how much the best match must beat the runner-up, in [0, 1); default 0.05
speaker_strict:<bool>
a model with speaker_model
do not use registered voices that have no encoder fingerprint (see Voice Recognition); default false
With a diarization_model companion, /v1/audio/transcriptions labels each segment with its speaker ("0", "1", … in order of first appearance) and splits segments where the speaker changes; with timestamp_granularities[]=word each word carries its speaker too. With stream=true the closing transcript.text.done event lists the segments with their speakers. Pass -F diarize=false to skip diarization for one request. The diarization GGUF can also be imported directly: local-ai models import https://huggingface.co/mudler/parakeet-cpp-gguf/resolve/main/nemotron-3-diarization-f16.gguf.
speaker_model: needs libparakeet with C-API v10. A wrong setup fails at load time with one of these errors: parakeet-cpp: speaker_model needs libparakeet.so ABI 10 (parakeet_capi_speaker_registry_add_embedding); the loaded library is older, parakeet-cpp: speaker_model needs a diarization model (the primary or diarization_model:), parakeet-cpp: a speaker model cannot be the primary model; use it as speaker_model: next to a diarization model, parakeet-cpp: speaker_model "<path>" is a <kind> model, expected a speaker model (the file is not a speaker encoder GGUF), or parakeet-cpp: speaker_threshold "<value>" must be a distance in (0, 2) (1 minus cosine similarity) / parakeet-cpp: speaker_margin "<value>" must be a number in [0, 1) for a bad number.
The loader rejects a companion whose role duplicates the primary’s own (for example asr_model: on an already-ASR primary, or sound_model: on a CED primary), and rejects a companion GGUF that does not match the role its option names (for example sound_model: pointing at an ASR GGUF fails to load, naming the kind it expected). See Speaker Diarization for the Diarize RPC and Sound Classification for SoundDetection, and Realtime API for the live speaker/sound events emitted during a realtime session.
Segment timestamps
Transcriptions are split into segments the same way NVIDIA NeMo does: a new segment starts after sentence-ending punctuation (., ?, !), and each segment carries start/end times. This is the default (NeMo’s punctuation-only segmentation) and needs no configuration. While streaming, each end-of-utterance closes a segment, now with timestamps.
You can additionally split on silence by setting segment_gap_threshold (NeMo’s segment_gap_threshold, in encoder frames; off by default). When set, a gap between two words wider than the threshold also starts a new segment. The value is in frames to match NeMo exactly; the backend converts it to seconds using the model’s frame stride (frame_sec, reported by the engine):
The backend can coalesce concurrent transcription requests into a single batched engine call, which improves throughput on GPU when many requests arrive at once. Batching is off by default (batch_max_size:1, one request at a time); raise it to opt in. Two options: knobs control it:
name:parakeet-110mbackend:parakeet-cppparameters:model:tdt_ctc-110m-f16.ggufoptions:- batch_max_size:8 # max requests coalesced into one batch (default 1 = off)- batch_max_wait_ms:15 # how long to wait to fill a batch, in ms (default 15)
By default each request runs on its own. Raise batch_max_size (for example 4 to 16) to enable batching; it pays off on GPU under concurrent load, where coalescing the per-step decode GEMMs across requests is a large throughput win. Leave it at 1 on CPU and for low-concurrency setups, where batching only adds latency. Batching only affects concurrent unary requests; streaming sessions always run on their own.
Moondream Ultra and Redux
Moondream publishes two derivatives of NVIDIA parakeet-tdt-0.6b-v3, Ultra and Redux. Both have a voice-activity-detection (VAD) head. The gallery has five entries, built from the GGUFs in mudler/parakeet-cpp-gguf:
Gallery entry
File
Runs on
parakeet-cpp-moondream-ultra-f16
ultra-f16.gguf
CPU and GPU
parakeet-cpp-moondream-ultra-q8_0
ultra-q8_0.gguf
CPU and GPU
parakeet-cpp-moondream-redux-packed
redux-packed.gguf
CPU only, offline only
parakeet-cpp-moondream-redux-f16
redux-f16.gguf
any backend, can stream
parakeet-cpp-moondream-redux-q8_0
redux-q8_0.gguf
any backend
The packed Redux file stores the encoder as ternary weights (213 MB). It cannot load on a GPU backend and cannot stream. If a GPU build fails to load it, check the backend log for the library message and use the redux-f16 or redux-q8_0 entry instead. The weights are CC-BY-4.0: credit Moondream and NVIDIA.
VAD-only slices
If you only need the VAD head, for the VAD endpoint or to cut audio before transcription, the same repository has two small files with the head cut out of the full model. The weights are not retrained, and the files cannot transcribe:
Gallery entry
File
Size
Cut from
parakeet-cpp-vad-moondream-redux
redux-vad.gguf
9.9 MB
Redux (213 MB packed to 1.4 GB)
parakeet-cpp-vad-moondream-ultra
ultra-vad-q8_0.gguf
6.0 MB
Ultra Q8_0
Measured by the parakeet.cpp author against loading a whole Redux or Ultra model: the files are 6 to 10 MB instead of 213 MB to 1.4 GB, load in a few milliseconds instead of 0.1 to 0.7 s, and use about 245 MiB peak memory for a 33 s clip instead of 0.6 to 1.6 GiB. The output is byte-identical to the full parent model, and the speed is the same as the parent’s head. A transcription request on a slice fails with an error. The slices load only with a parakeet.cpp build that includes VAD-only GGUF support, so an older backend build fails to load them. The weights are CC-BY-4.0: credit Moondream and NVIDIA.
With vad:true, long audio is cut at pauses found by the model’s VAD head into pieces of at most 30 seconds, and each piece is transcribed in turn. Word timestamps stay relative to the whole file. Audio of 30 seconds or less gives the same result as without the option. The gallery entries set it. Add it to your own model YAML like this:
name:moondream-ultrabackend:parakeet-cppparameters:model:ultra-q8_0.ggufoptions:- vad:true # cut long audio at pauses (default false); needs a model with a VAD head
vad:true applies to offline transcription only and bypasses dynamic batching, because the batched entry point has no VAD variant. Streaming is not affected. A model without a VAD head fails each request with model has no VAD head, and a libparakeet.so that is too old to export the VAD entry point fails the load. Remove the option for models that have no VAD head.
Cutting long audio with Silero (vad_model)
A model without a VAD head, such as parakeet-cpp-tdt-0.6b-v3 or a Nemotron model, can cut long audio with Silero VAD instead. Name a Silero GGUF in the vad_model option. The path is resolved against the models directory, like the other companion files. vad_model implies vad:
name:parakeet-v3-silerobackend:parakeet-cppparameters:model:parakeet-cpp/tdt-0.6b-v3-f16.ggufoptions:- vad_model:parakeet-cpp/silero-vad-f16.gguf # Silero GGUF that cuts long audio at pauses- vad_min_pause:0.3 # optional, seconds
The gallery entry parakeet-cpp-tdt-0.6b-v3-silero-vad installs both files with this configuration. Audio of 30 seconds or less is transcribed whole and the VAD does not run. vad:true alone keeps meaning “use the model’s own head”. With vad_model set, the Silero model is used even if the ASR model has a head.
The segmenter options below apply to both vad:true and vad_model. Each is optional; an unset value keeps the default of the detector in use, and a bad value fails the load:
Option
Unit
Meaning
vad_threshold
0 to 1
A frame is speech when its probability is at least this
vad_min_pause
seconds
A silence this long separates two pieces
vad_min_speech
seconds
Shorter speech runs are dropped
vad_max_segment
seconds
Cap on the length of a piece (default 30)
vad_trim
seconds
Each piece shrinks to its first and last speech frame plus this much. Default 0.3; 0 keeps the whole cuts, as before this option existed
vad_speech_pad (seconds) pads each region and only affects the VAD endpoint. vad_model needs a libparakeet.so that exports parakeet_capi_transcribe_path_json_vad_with; an older library fails the load with a message that names it.
Dropping noise words (guard_*)
A decode of noise or silence can contain words that no one said. An opt-in filter removes the words that stand alone or sit among low-confidence words, and the words that are only punctuation. It runs on the finished decode. It is off unless one of these options is set, and a bad value fails the load:
Option
Unit
Meaning
guard_min_local_conf
0 to 1
A word is dropped when the mean confidence of the words that start within guard_local_radius seconds of it, itself included, is below this. 0 is off. 0.5 is a good start; higher values also drop real words on some models
guard_local_radius
seconds, above 0
The window of that mean. Default 5
guard_drop_punct_only
true or false
Drop words that are only punctuation. A CTC model can emit a lone . on noise. Default false
The filter applies to offline transcription, and with vad:true or vad_model to each piece on its own. It bypasses dynamic batching, like vad:true. Streaming is not affected. Speech with confident words comes out the same as without the filter. The number of dropped words is written to the backend log at debug level; the transcription response has no field for it. The options need a libparakeet.so that exports parakeet_capi_transcribe_path_json_with; an older library fails the load with a message that names it.
Bundle GGUF files (several models in one file)
A bundle is one GGUF file that holds several models, called components. Each component keeps its own licence. The backend opens the components it needs from the one file, so a single model YAML can serve transcription, VAD, diarization, speaker naming and sound events. A bundle needs a libparakeet.so from parakeet.cpp with bundle support (pin 781a973 or newer); the format is described in the parakeet.cpp bundle documentation. Single-model files and every existing option work as before.
Parakeet TDT 0.6B v3 (Q8_0), plus the same four components
the same, with the multilingual 0.6B model
parakeet-cpp-bundle-moondream-redux
215 MB
Moondream Redux (packed ternary), Silero VAD (F16)
transcription and VAD; CPU only and offline only
The component that each role uses, and the option that picks another one:
Role
Component used
Option
Transcription
the only asr component
bundle_asr:<name> picks one when the bundle has several
VAD (/v1/vad, and vad:true for long audio)
the vad (Silero) component, loaded with no option; without one the VAD head of the ASR model
vad_component:<name> picks one, and implies vad:true
Diarization
the diar component, only when asked for
diar_component:<name>
Sound events
the ced component, only when asked for
sound_component:<name>
Speaker naming
the voice component, only when asked for
speaker_component:<name> (needs a diarization component)
Voice embedding and verification (/v1/voice/*, the realtime voice_recognition stage)
the voice component, only when asked for
speaker_component:<name>; declare speaker_recognition in known_usecases. Needs a libparakeet.so with parakeet_capi_speaker_embed_pcm. See Voice Recognition
speaker_component: also names registered speakers: LocalAI sends the voices from /v1/voice/register to the bundle’s speaker component, as it does for speaker_model:. This works in /v1/audio/diarization and in realtime live transcription, and it needs no speaker_model:. speaker_threshold, speaker_margin and speaker_strict apply too. Only voices that carry an encoder fingerprint (voices enrolled from speaker_profiles) and voices with no tag at all are used by default. A voice registered with a tag only matches through speaker_tag:. See Voice Recognition.
A *_component option without the matching companion option takes the component from the model file itself. The companion options (diarization_model:, sound_model:, speaker_model:, vad_model:, asr_model:) can also name a bundle file, even the same file as the model: the only component of the wanted kind is used, and the *_component option picks one when there are several. This YAML loads the same file for four roles:
name:parakeet-bundlebackend:parakeet-cppparameters:model:parakeet-cpp/parakeet-bundle-small.ggufoptions:- vad:true # cut long audio at pauses, with the Silero component- diar_component:diar # same as diarization_model:parakeet-cpp/parakeet-bundle-small.gguf- sound_component:ced- speaker_component:voice
A role that the bundle cannot fill fails with a message that lists the components, for example parakeet-cpp: diarization_model needs a "diar" component, but the bundle "<path>" has none (components: asr (asr), vad (vad)). A request for a role the loaded model does not have (diarization from a bundle without a diar component) returns parakeet-cpp: model is not a diarization model (the model file is a bundle without a "diar" component; ...). A *_component option on a file that is not a bundle, or on a library without bundle support, fails the load.
Licences: a bundle has no single licence, so the gallery entries use license: other. The licence, source and credit of every component are in the file header, and the NOTICE file next to each bundle in the repository (NOTICE-<bundle>.txt) has the credits and the full licence texts. Keep it with any copy of the file you pass on.
Component
Licence
Credit
Parakeet TDT+CTC 110M, Parakeet TDT 0.6B v3
CC-BY-4.0
NVIDIA
Moondream Redux
CC-BY-4.0
Moondream, derived from Parakeet TDT 0.6B v3 by NVIDIA
Nemotron-3-Diarization
OpenMDW-1.1
NVIDIA
CED-Small
Apache-2.0, as stated on the model card
Heinrich Dinkel et al., Xiaomi (mispeech)
WeSpeaker ResNet34-LM
CC-BY-4.0
the WeSpeaker project
Silero VAD
MIT
Silero Team
The licence of the CED weights is not consistent upstream: the model card says Apache-2.0, the upstream code repository is GPL-3.0 and the original checkpoint records say CC-BY-4.0. The file here is converted, not trained, and follows the model card. The weights of all components were converted to GGUF, and quantised where the table shows it; nothing was retrained.
See also
Audio Transform - clean up the audio (echo cancellation, noise suppression, dereverberation) before passing it to a transcription model.
LocalAI returns 404 when the requested model is not installed. Models without
voice metadata do not appear in the unfiltered response.
The Instructions field in the Text to Speech studio maps to the optional
instructions property on /v1/audio/speech. Use it to describe delivery,
such as tone or pace:
Backend support for speech instructions varies. Backends that do not support
this control may ignore it.
Voice Library
Every user who may use speech can keep reusable voice-cloning references of their own, and administrators manage all of them. Use the Library tab of the Voice add-on (Add-ons → Voice) in the LocalAI WebUI. (Recognition, the first tab of that page, is a separate feature: voiceprints for recognising who is speaking. See Voice recognition.) The library replaces per-model filesystem and YAML setup for supported cloning backends:
Select Add a speech voice and upload or record a clear reference clip. A speech voice can also be made while enrolling a speaker, from the enrol sheet.
Enter the exact words spoken in the clip. Add more audio/transcript pairs when the personality needs more examples.
Confirm that you have permission to clone the voice, then save the profile.
Open Text to Speech, choose a model marked Cloning ready, and select the saved voice.
The browser converts uploads and recordings to mono, 24 kHz, 16-bit PCM WAV so the same profile works across compatible backends. A profile can contain up to ten ordered references. Each clip must be between 1 and 120 seconds and no larger than 50 MiB; 6-30 seconds of clean audio is recommended. Profile audio is private biometric source material: LocalAI stores it below its configured data path, serves previews only to authenticated TTS users who may see that profile, and never returns its filesystem path.
Voice profile API
The WebUI uses the following endpoints. Every route needs access to the audio speech feature (audio_speech).
Method
Endpoint
Purpose
GET
/api/voice-profiles
List the profiles you may use: your own and the instance-wide ones. An administrator sees all.
POST
/api/voice-profiles
Create a profile from multipart form data or JSON with base64 audio. The profile belongs to you.
GET
/api/voice-profiles/{id}/audio
Stream the authenticated WAV preview, including range requests.
DELETE
/api/voice-profiles/{id}
Permanently delete a profile of yours.
Who owns a profile
A profile has an owner: the user who created it. These rules apply to the endpoints above, to voice in /v1/audio/speech and /tts, and to the voice of a realtime session:
You see, preview and speak with your own profiles and with the instance-wide ones.
An instance-wide profile has no owner. Profiles an administrator creates are instance-wide, and so are profiles stored before ownership existed. Every user can use them; only an administrator can delete them (other users get 403).
You can delete your own profiles. An administrator can list, use and delete all profiles.
The profile of another user answers 404, never 403, in every endpoint and in speech requests, so nobody can learn that it exists.
A user who is not an administrator may own at most 20 profiles. A request over the limit answers 409. The limit is a constant, not a setting. Each clip is limited to 50 MiB, as before. The reference audio of one such user is also limited to 100 MiB in total; a request over it answers 409. Administrators have neither limit. A profile that an administrator creates is visible to all users.
A user who is not an administrator cannot set voice to a file path (a value with /, \ or ..): the request answers 400. They use a voice of the model or a localai://voice-profiles/<id> voice. Administrators, and servers without accounts, may still give a path.
A server without accounts (authentication off) has no owners: every profile is instance-wide, as before.
The profiles are files below the data path of the instance (voice-profiles/, one folder per profile; owner_id in its profile.json). They follow the data path: frontends that share a data path share the profiles, and frontends with separate data paths each have their own library, as before. The profile limit is counted on the files under a lock of one process, so two frontends that create profiles for the same user at the same moment can exceed it by a few.
For example, you can create a profile without the WebUI:
curl http://localhost:8080/api/voice-profiles \
-F 'name=Documentary narrator'\
-F 'language=en-US'\
-F 'transcript=The exact words spoken in this reference.'\
-F 'consent_confirmed=true'\
-F 'audio=@reference.wav;type=audio/wav'
Repeat transcript and audio in matching order to create a multi-reference personality:
The response includes an opaque voice reference such as localai://voice-profiles/550e8400-e29b-41d4-a716-446655440000. Pass that value as voice to either TTS-compatible endpoint:
curl http://localhost:8080/v1/audio/speech \
-H 'Content-Type: application/json'\
-d '{
"model": "qwen3-tts-base",
"input": "This sentence will use the saved voice.",
"voice": "localai://voice-profiles/550e8400-e29b-41d4-a716-446655440000"
}' --output speech.wav
LocalAI resolves the opaque reference only for models that advertise voice-cloning support. Existing named speakers, backend-specific voice IDs, and explicit model YAML voice configuration remain available for models and advanced workflows that do not use the library.
The Voice Library uses the same server-side capability resolver for installed models and gallery recommendations. Administrators can inspect the currently configured galleries without maintaining a separate backend list:
Each returned model includes a non-null voice_cloning contract. Variant checks are applied before the model is returned, so TTS-only CustomVoice, VoiceDesign, or preset-prompt variants are not offered as reference-audio models. When the WebUI detects that no compatible model is installed, it uses this response to offer direct installation.
Model configuration
Voice Library support is automatic for known backends and model variants. A custom model can override that detection with tts.voice_cloning:
name:private-qwen-basebackend:qwen3-tts-cppparameters:model:private/qwen-talker-checkpoint.ggufknown_usecases:- ttstts:# Optional: omit this for automatic backend and variant detection.voice_cloning:true# Optional model-wide fallback when a request does not select a saved profile.audio_path:voices/default-reference.wavoptions:- tokenizer:private/qwen-tokenizer.gguf
tts.voice_cloning has three states:
Value
Behavior
omitted
Detect support from the backend plus name, parameters.model, and compatibility options. This is recommended for gallery models.
true
Advertise Voice Library support for a custom-named variant of a backend that LocalAI already knows can clone voices. This cannot add cloning to an unsupported backend.
false
Hide the model from Voice Library compatibility results and reject localai://voice-profiles/... references for it. Backend-specific named voices and manual reference paths remain available.
The older options: ["voice_cloning:true"] and options: ["voice_cloning:false"] spellings remain accepted for compatibility. Prefer tts.voice_cloning; generic options may be forwarded to a backend, whereas the typed field is consumed only by LocalAI.
Reference selection follows this order:
A request voice, including a saved localai://voice-profiles/... URI.
The model’s tts.voice default.
The model’s tts.audio_path reference-audio fallback.
A backend-specific default voice or option.
When a saved profile is selected, LocalAI supplies its ordered private WAV and transcript pairs to Fish Speech and audio.cpp. Other cloning backends receive the first pair, which preserves their existing single-reference behavior. LocalAI does not rewrite the model YAML or copy recordings into the model directory.
Realtime pipeline default
Set tts.voice on a realtime pipeline model to use a saved Voice Library profile as the session default:
If the same update changes model, the explicit audio.output.voice value takes precedence over the new model’s tts.voice default. The selected model must support Voice Library cloning.
Reference-audio cloning models served by these dedicated backends.
qwen-tts, qwen3-tts-cpp, vllm-omni
Base or VoiceClone variants. CustomVoice and VoiceDesign variants are not raw reference-audio models.
llama-cpp
Models that declare known_usecases: [tts], which the Qwen3-TTS gallery entries (qwen3-tts-llamacpp, qwen3-tts-llamacpp-q4) do. A reference clip is required, since the Base checkpoints have no built-in speaker. Ordinary GGUF chat and vision models served by this backend are excluded.
vibevoice-cpp
1.5B reference-WAV variants. The realtime 0.5B preset-prompt model is excluded.
coqui
XTTS and YourTTS variants.
crispasr
F5-TTS variants. ASR, Piper, Orpheus, and other CrispASR model families are excluded.
This table describes the built-in resolver, not a frontend allowlist. Gallery entries and installed configs are evaluated by the server, and tts.voice_cloning can make a verified custom filename explicit.
Streaming TTS
LocalAI supports streaming TTS generation, allowing audio to be played as it’s generated. This is useful for real-time applications and reduces latency.
To enable streaming, add "stream": true to your request:
curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"input": "Hello world, this is a streaming test",
"model": "voxcpm",
"stream": true
}'| aplay
The audio will be streamed chunk-by-chunk as it’s generated, allowing playback to start before generation completes. This is particularly useful for long texts or when you want to minimize perceived latency.
You can also pipe the streamed audio directly to audio players like aplay (Linux) or save it to a file:
# Stream to aplay (Linux)curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"input": "This is a longer text that will be streamed as it is generated",
"model": "voxcpm",
"stream": true
}'| aplay
# Stream to a filecurl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"input": "Streaming audio to file",
"model": "voxcpm",
"stream": true
}' > output.wav
Note: Streaming TTS is implemented by the audio-cpp, crispasr, llama-cpp, magpie-tts-cpp, moss-tts-cpp, omnivoice-cpp, qwen3-tts-cpp, sherpa-onnx, supertonic, vibevoice-cpp and voxcpm backends. Other backends will fall back to non-streaming mode if streaming is not supported.
Backends
🐸 Coqui
Required: Don’t use LocalAI images ending with the -core tag,. Python dependencies are required in order to use this backend.
Coqui works without any configuration, to test it, you can run the following curl command:
curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"backend": "coqui",
"model": "tts_models/en/ljspeech/glow-tts",
"input":"Hello, this is a test!"
}'
You can use the env variable COQUI_LANGUAGE to set the language used by the coqui backend.
You can also use config files to configure tts models (see section below on how to use config files).
Fish Speech
Fish Speech models accept the compile backend option. Enabling it can improve
inference performance on CUDA hardware, but the first request after loading the
model includes the torch.compile warmup cost:
backend:fish-speechoptions:- compile:true
When compilation is enabled, the backend uses the CUDA toolkit’s executable
ptxas from $CUDA_HOME/bin (defaulting to /usr/local/cuda/bin) instead of
the copy bundled with Triton. This allows newer GPU architectures supported by
the installed CUDA toolkit to compile kernels. Set TRITON_PTXAS_PATH on the
backend explicitly to select a different assembler.
aplay is a Linux command. You can use other tools to play the audio file.
The model name is the filename with the extension.
The model name is case sensitive.
LocalAI must be compiled with the GO_TAGS=tts flag.
Transformers-musicgen
LocalAI also has experimental support for transformers-musicgen for the generation of short musical compositions. Currently, this is implemented via the same requests used for text to speech:
Future versions of LocalAI will expose additional control over audio generation beyond the text prompt.
ACE-Step
ACE-Step 1.5 is a music generation model that can create music from text descriptions, lyrics, or audio samples. It supports both simple text-to-music and advanced music generation with metadata like BPM, key scale, and time signature.
Setup
Install the ace-step-turbo model from the Model gallery or run local-ai models install ace-step-turbo.
Usage
ACE-Step supports two modes: Simple mode (text description + vocal language) and Advanced mode (caption, lyrics, BPM, key, and more).
Simple mode:
curl http://localhost:8080/v1/audio/speech -H "Content-Type: application/json" -d '{
"model": "ace-step-turbo",
"input": "A soft Bengali love song for a quiet evening",
"vocal_language": "bn"
}' --output music.flac
Advanced mode (using the /v1/sound-generation endpoint):
curl http://localhost:8080/v1/sound-generation -H "Content-Type: application/json" -d '{
"model": "ace-step-turbo",
"caption": "A funky Japanese disco track",
"lyrics": "[Verse 1]\n...",
"bpm": 120,
"keyscale": "Ab major",
"language": "ja",
"duration_seconds": 225
}' --output music.flac
Music and sound generation API (/v1/sound-generation)
The /v1/sound-generation endpoint is compatible with the ElevenLabs sound generation API and can produce music, sound effects, and other audio content. It responds with a binary audio file and the appropriate Content-Type header (for example audio/wav, audio/mpeg, audio/flac, or audio/ogg). The request body is JSON and supports two usage modes.
Each generated sound has a unique filename. The filename remains unique when
LocalAI changes its extension to match the audio format, so later generations
do not overwrite earlier recordings in the WebUI history.
Simple mode:
Parameter
Type
Required
Description
model_id
string
Yes
Model identifier (for example ace-step-turbo)
text
string
Yes
Audio description or prompt
instrumental
bool
No
Generate instrumental audio (no vocals)
vocal_language
string
No
Language code for vocals (for example bn, ja)
Advanced mode:
Parameter
Type
Required
Description
model_id
string
Yes
Model identifier (for example ace-step-turbo)
text
string
Yes
Text prompt or description
duration_seconds
float
No
Target duration in seconds
prompt_influence
float
No
Temperature / prompt influence parameter
do_sample
bool
No
Enable sampling
think
bool
No
Enable extended thinking for generation
caption
string
No
Caption describing the audio
lyrics
string
No
Lyrics for the generated audio
bpm
int
No
Beats per minute
keyscale
string
No
Musical key/scale (for example Ab major)
language
string
No
Language code
vocal_language
string
No
Vocal language (fallback if language is empty)
timesignature
string
No
Time signature (for example 4)
instrumental
bool
No
Generate instrumental audio (no vocals)
params
object
No
Backend-specific options with string keys and string values
Use params to pass backend-specific string options that do not have fixed request
fields. Every value in params must be a string. Existing fixed fields remain
authoritative when a fixed field and params contain the same option.
The audio-cpp backend uses a nonempty caption as the default style option.
An explicit params.style takes precedence, including an empty string. In
Studio → Sound, select Advanced mode and enter the musical style in Caption
and the song text in Lyrics to use YuE2.
Install the YuE2 gallery model and generate a song:
Error responses: 400 for a missing or invalid model or request parameters, and 500 for a backend error during sound generation.
AudioLDM 2
AudioLDM 2 generates sound effects,
music, and speech from a text description. Install the gallery model:
local-ai models install audioldm2
Generate a WAV file through the sound-generation endpoint:
curl http://localhost:8080/v1/sound-generation \
-H "Content-Type: application/json"\
-d '{
"model_id": "audioldm2",
"text": "Waves breaking on a rocky beach during a distant thunderstorm",
"duration_seconds": 10
}' --output storm.wav
AudioLDM 2 uses the AudioLDM2Pipeline from the diffusers backend. The
duration_seconds field maps to the pipeline’s audio_length_in_s option, and
prompt_influence maps to guidance_scale.
Configuration
You can configure ACE-Step models with various options:
name:ace-step-turbobackend:ace-stepparameters:model:acestep-v15-turboknown_usecases:- sound_generation- ttsoptions:- "device:auto"- "use_flash_attention:true"- "init_lm:true"# Enable LLM for enhanced generation- "lm_model_path:acestep-5Hz-lm-0.6B"# or acestep-5Hz-lm-4B- "lm_backend:pt"# or vllm- "temperature:0.85"- "top_p:0.9"- "inference_steps:8"- "guidance_scale:7.0"
VibeVoice
VibeVoice-Realtime is a real-time text-to-speech model that generates natural-sounding speech from precomputed voice presets.
Setup
Install the vibevoice model in the Model gallery or run local-ai models install vibevoice.
Usage
Use the tts endpoint by specifying the vibevoice backend:
The Python vibevoice realtime 0.5B model uses .pt voice preset files. You can configure a model with a specific preset:
name:vibevoicebackend:vibevoiceparameters:model:microsoft/VibeVoice-Realtime-0.5Btts:voice:"Frank"# or use audio_path to specify a .pt file path# Available English voices: Carter, Davis, Emma, Frank, Grace, Mike
Note
The realtime 0.5B preset model is not advertised to the Voice Library because it does not accept a raw reference WAV per request. For Voice Library profiles, use a vibevoice-cpp 1.5B reference-WAV model; LocalAI detects the 1.5B variant automatically, or a custom name can set tts.voice_cloning: true.
OmniVoice (omnivoice-cpp backend) is a native C++ / GGML text-to-speech engine. It supports voice cloning (from reference audio plus its transcript), voice design (steering the voice with attribute keywords such as gender, age, pitch, style, volume, and emotion), and streaming synthesis. Output is 24kHz mono audio and it covers 646 languages.
Setup
Install the omnivoice-cpp model in the Model gallery or run local-ai models install omnivoice-cpp. A higher-quality BF16 variant is available as omnivoice-cpp-hq (the default omnivoice-cpp ships Q8_0 GGUFs).
Usage
Use the speech endpoint by specifying the omnivoice-cpp backend:
curl http://localhost:8080/v1/audio/speech -H "Content-Type: application/json" -d '{
"model": "omnivoice-cpp",
"input": "Hello world, this is a test."
}'| aplay
Voice cloning
Pass a reference audio file via the voice parameter and its transcript via the ref_text generation parameter:
curl http://localhost:8080/v1/audio/speech -H "Content-Type: application/json" -d '{
"model": "omnivoice-cpp",
"input": "Hello world, this is a test.",
"voice": "path/to/reference_audio.wav",
"params": { "ref_text": "This is the transcript of the reference audio." }
}'| aplay
You can also pin a default cloned voice in the model config so callers do not have to pass it on every request. Both tts.voice and tts.audio_path are honored as the reference audio (a per-request voice overrides them); paths are resolved relative to the model directory:
name:omnivoice-cppbackend:omnivoice-cppparameters:model:omnivoice-cpp/omnivoice-base-Q8_0.gguftts:voice_cloning:true# optional explicit declaration; gallery models are auto-detectedaudio_path:"voices/my_reference.wav"# default cloning reference (or use tts.voice)options:- "tokenizer:omnivoice-cpp/omnivoice-tokenizer-Q8_0.gguf"
Voice design
Steer the synthesized voice with attribute keywords (gender, age, pitch, style, volume, emotion) by passing an instructions string per request:
curl http://localhost:8080/v1/audio/speech -H "Content-Type: application/json" -d '{
"model": "omnivoice-cpp",
"input": "Hello world, this is a test.",
"instructions": "female young high soft emotion:happy"
}'| aplay
Configuration
The backend loads the base GGUF from parameters.model and its tokenizer from the tokenizer: option. A few optional generation knobs are available as options:
name:omnivoice-cppbackend:omnivoice-cppparameters:model:omnivoice-cpp/omnivoice-base-Q8_0.ggufoptions:- "tokenizer:omnivoice-cpp/omnivoice-tokenizer-Q8_0.gguf"- "use_fa:true"# enable flash attention- "clamp_fp16:true"# clamp activations for fp16 stability- "seed:42"# deterministic generation- "denoise:true"# denoise the generated audio
A per-request seed can also be supplied through the params map alongside ref_text.
Duration and postprocessing
For omnivoice-cpp, set these request-local controls in params, not as top-level fields:
duration accepts a finite numeric string of seconds greater than zero and at most 30, inclusive. Whitespace, empty strings, and nonfinite values are invalid.
The backend uses max(1, floor(seconds * 25)) generation frames. Each frame represents 40 milliseconds at the bundled codec rate. Thus, 2.5 selects 62 frames; tiny positive values select one frame.
postprocess accepts only the exact strings "true" and "false". Buffered synthesis accepts either value, with or without duration.
A supplied duration forces single-shot generation and bypasses chunking. The 30-second cap is a conservative wrapper resource policy, aligned with the engine’s default chunk threshold. It is not an engine positional limit or a guarantee of available memory or successful synthesis.
Duration controls generation frames, not playback speed or guaranteed final WAV duration. Buffered postprocessing can trim or pad audio. With postprocess="false", buffered output preserves the raw decoded frame length; reference loudness matching remains active. Quantization does not guarantee perceptual accuracy.
Streaming accepts duration and explicit postprocess="true". It rejects postprocess="false" before reference reads, native synthesis, or audio output because the streaming engine always postprocesses audio.
Pocket TTS
Pocket TTS is a lightweight text-to-speech model designed to run efficiently on CPUs. It supports voice cloning through HuggingFace voice URLs or local audio files.
Setup
Install the pocket-tts model in the Model gallery or run local-ai models install pocket-tts.
Usage
Use the tts endpoint by specifying the pocket-tts backend:
curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"model": "pocket-tts",
"input":"Hello world, this is a test."
}' | aplay
Voice cloning
Pocket TTS supports voice cloning through built-in voice names, HuggingFace URLs, or local audio files. You can configure a model with a specific voice:
name:pocket-ttsbackend:pocket-ttstts:voice:"azelma"# Built-in voice name# Or use HuggingFace URL: "hf://kyutai/tts-voices/alba-mackenna/casual.wav"# Or use local file path: "path/to/voice.wav"# Available built-in voices: alba, marius, javert, jean, fantine, cosette, eponine, azelma
To make a reference recording the model-wide fallback, use tts.audio_path. The gallery model is detected automatically; tts.voice_cloning is only needed when you want an explicit declaration:
Supported values depend on the installed pocket-tts version; current releases accept english, french, german, italian, spanish, portuguese and dutch, plus variants such as french_24l and english_2026-04. The built-in voice names are resolved against the selected language model.
Qwen3-TTS
Qwen3-TTS is a high-quality text-to-speech model that supports three modes: custom voice (predefined speakers), voice design (natural language instructions), and voice cloning (from reference audio).
Setup
qwen-tts is the name of the backend. Install a gallery model that uses it, for example local-ai models install qwen3-tts-0.6b-custom-voice, or pick one in the model gallery.
C++ / GGML gallery variants
For a native backend, install one of the Base variants qwen3-tts-cpp, qwen3-tts-cpp-0.6b-base-q4, qwen3-tts-cpp-1.7b-base, or qwen3-tts-cpp-1.7b-base-q4. These variants accept saved Voice Library profiles and are advertised automatically. Gallery entries containing customvoice or voicedesign provide their respective Qwen modes but are intentionally excluded from raw reference-audio cloning.
A private Qwen C++ Base conversion with an opaque filename can declare the capability explicitly. The tokenizer GGUF can sit beside the talker GGUF for automatic discovery:
By default qwen3-tts-cpp synthesizes one request at a time. Set max_batch to let qwentts.cpp batch up to N concurrent /v1/audio/speech requests (streaming or not) into shared decode steps; further requests queue inside the engine:
options:- max_batch:4
The contributor measured four concurrent streaming requests through LocalAI on an RTX 5060 Ti (1.7B Base Q4_K_M): the first audio arrived after 0.31–0.33 seconds for all four with max_batch:4, compared with 0.30, 0.94, 1.48 and 2.02 seconds with max_batch:1. VRAM grows with max_batch (roughly 2.6 GB at 1, 6 GB at 4, 10.5 GB at 8 for that talker).
At load the backend attempts concurrent warmup to reduce graph initialization delays; this does not guarantee that every batch width is warmed. CustomVoice and VoiceDesign models reject these generic warmup requests because they require a speaker or instruction, so the backend logs a warning and continues loading. max_batch_warmup:false skips warmup.
Incremental synthesis (TTSLive, used by a realtime pipeline with streaming.tts: true) requires max_batch:1. On ROCm before 10.1 with RDNA4 (gfx1201), batched requests can hang the GPU in hipBLASLt (fixed in ROCm 10.1 by ROCm/rocm-libraries#8909); on those stacks add env: {ROCBLAS_USE_HIPBLASLT: "0"} to the model configuration.
llama.cpp gallery variants
llama.cpp gained native Qwen3-TTS support in ggml-org/llama.cpp#26254, so the llama-cpp backend can serve it on the same accelerator matrix it already uses for text generation: CUDA, ROCm, SYCL, Vulkan and Metal.
Install qwen3-tts-llamacpp (Q8_0 backbone) or qwen3-tts-llamacpp-q4 (Q4_K_M backbone) from the Model gallery, or run local-ai models install qwen3-tts-llamacpp-q4.
These models load two files: the backbone GGUF and a multimodal projector holding the speaker encoder and code predictor. A hand-written configuration must point at both:
known_usecases: [tts] is not optional here. It is how LocalAI tells a Qwen3-TTS checkpoint apart from the text and vision GGUFs the same backend serves: without it the model is treated as a chat model, its projector is read as a vision tower, and Voice Library profiles are refused.
Importing such a repo through the Models page or local-ai models import writes that declaration for you. The importer reads the projector’s header and recognises the speech-synthesis pipeline, so ggml-org/Qwen3-TTS-12Hz-1.7B-Base-GGUF imports as a TTS model rather than as a chat model with a vision projector.
The upstream checkpoints are Base variants with no built-in speaker, so voice is required on every request. Pass either a path to a reference clip or a saved Voice Library profile. A request without one is rejected rather than served in an arbitrary voice:
curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"model": "qwen3-tts-llamacpp",
"input": "Hello world, this is a test.",
"voice": "voices/my-reference.wav"
}' > output.wav
Output is always 24 kHz mono 16-bit WAV. Streaming works on this backend, so "stream": true returns audio chunk by chunk as it is generated.
Set language to an ISO 639-1 code to pin the output language. The supported codes are zh, en, de, it, pt, es, ja, ko, fr and ru.
Three optional knobs travel in params: top_k and top_p adjust sampling, and max_frames caps how much audio a single request may generate. The model runs at 12.5 frames per second, so one frame is 0.08 seconds and the maximum duration in seconds is max_frames / 12.5. Leave it unset for the engine default of 512 frames, which is 40.96 seconds.
max_frames exists because generation occasionally fails to stop on its own. The model normally ends an utterance by emitting its end-of-speech token, but once in a while it does not, and the request then runs to the cap and returns far more audio than the text called for. It is uncommon, and it happens more on short inputs than on long ones. If you are synthesising predictable text and want a hard bound, allow roughly 8 frames per word: about 100 frames (8 seconds) for a short sentence, about 300 frames (24 seconds) for a paragraph.
curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"model": "qwen3-tts-llamacpp",
"input": "Hello world, this is a test.",
"voice": "voices/my-reference.wav",
"params": {"max_frames": "100"}
}' > output.wav
This backend accepts but ignores instructions, speed and sample_rate. The Base checkpoints have no expressive-style or rate control, and the output rate is fixed at 24 kHz.
Note that qwen3-tts-cpp (qwentts.cpp) remains available and is unaffected. It is a separate, independently maintained path to the same family of weights, not something this replaces.
Usage
Use the tts endpoint with the name of the model you installed (the examples use qwen3-tts-0.6b-custom-voice):
curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"model": "qwen3-tts-0.6b-custom-voice",
"input":"Hello world, this is a test."
}' | aplay
Language
You can hint the synthesis language with the language request field:
Supported languages: en (English), zh (Chinese), ru (Russian), ja (Japanese), ko (Korean), de (German), fr (French), es (Spanish), it (Italian), pt (Portuguese).
The value is matched case-insensitively and accepts a few forms for convenience:
the two-letter code (fr, FR)
a locale/region form, whose region is ignored (fr-FR, pt_BR, zh-Hans → fr/pt/zh)
the English full name (french, Portuguese)
If the field is omitted or the value isn’t one of the supported languages, the backend defaults to English.
Custom Voice Mode
Qwen3-TTS supports predefined speakers. You can specify a speaker using the voice parameter:
curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"model": "qwen-tts-design",
"input":"Hello world, this is a test."
}' | aplay
Per-request instructions
Instead of (or in addition to) the static YAML instruct option, you can pass an
instructions string per request. It maps to the OpenAI
instructions field
and takes precedence over the YAML option when set, falling back to it when empty. This lets
a single model config serve a different emotion (CustomVoice) or a different designed voice
(VoiceDesign) on every request - useful for roleplay/narration clients that need many voices:
curl http://localhost:8080/v1/audio/speech -H "Content-Type: application/json" -d '{
"model": "qwen-tts-design",
"input": "Hello world, this is a test.",
"instructions": "A calm, low-pitched elderly storyteller with a warm tone."
}' | aplay
Backends that do not support style/voice instructions simply ignore the field.
You can also pass backend-specific generation parameters per request via the LocalAI
params extension (a string-to-string map; values are coerced to the backend’s expected
types). For example, with the Chatterbox backend:
curl http://localhost:8080/v1/audio/speech -H "Content-Type: application/json" -d '{
"model": "chatterbox",
"input": "Hello world, this is a test.",
"params": { "exaggeration": "0.7", "cfg_weight": "0.3", "temperature": "0.8" }
}' | aplay
Voice Clone Mode
Voice Clone allows you to clone a voice from reference audio. Configure the model with an AudioPath and optional ref_text:
name:qwen-tts-clonebackend:qwen-ttsparameters:model:Qwen/Qwen3-TTS-12Hz-1.7B-Basetts:voice_cloning:true# optional for this Base model; useful when a private checkpoint has an opaque nameaudio_path:"path/to/reference_audio.wav"# Reference audio fileoptions:- "ref_text:This is the transcript of the reference audio."- "x_vector_only_mode:false"# Set to true to use only speaker embedding (ref_text not required)
You can also use URLs or base64 strings for the reference audio. The backend automatically detects the mode based on available parameters (AudioPath → VoiceClone, instruct option → VoiceDesign, voice parameter → CustomVoice).
Then use the model:
curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"model": "qwen-tts-clone",
"input":"Hello world, this is a test."
}' | aplay
Multi-Voice Clone Mode
Qwen3-TTS also supports loading multiple voices for voice cloning, allowing you to select different voices at request time. Configure multiple voices using the voices option:
The voices option accepts a JSON array where each voice entry must have:
name: The voice identifier (used in API requests)
audio: Path to the reference audio file (relative to model directory or absolute)
ref_text: Path to the reference text file for the audio it is paired with
Then use the model with voice selection:
curl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"model": "qwen-tts-multi-voice",
"input":"Hello world, this is Jane speaking.",
"voice": "jane"
}'| aplay
# Switch to a different voicecurl http://localhost:8080/tts -H "Content-Type: application/json" -d '{
"model": "qwen-tts-multi-voice",
"input":"Hello world, this is John speaking.",
"voice": "john"
}'| aplay
Voice Selection Priority:
voice parameter in the API request (highest priority)
voice option in the model configuration
Error if voice is not found among configured voices
Error Handling:
If you request a voice that doesn’t exist in the voices list, the API will return an error with a list of available voices:
{"error":"Voice 'unknown' not found. Available voices: jane, john"}
Backward Compatibility:
The multi-voice mode is backward compatible with existing single-voice configurations. Models using audio_path in the tts section will continue to work as before.
You can also use a config-file to specify TTS models and their parameters.
In the following example, a custom config loads xtts_v2 with a default cloning reference and language.
For XTTS/YourTTS, tts.audio_path is the default cloning reference and a saved Voice Library profile overrides it per request. Other Coqui model families are not advertised as Voice Library-compatible unless they match the supported variant rules or are explicitly verified with tts.voice_cloning: true.
With this config, you can now use the following curl command to generate a text-to-speech audio file:
curl -L http://localhost:8080/tts \
-H "Content-Type: application/json"\
-d '{
"model": "xtts_v2",
"input": "Bonjour, je suis Ana Florence. Comment puis-je vous aider?"
}'| aplay
audio.cpp
audio.cpp is a multi-family GGML audio engine, so
one installed backend covers TTS (supertonic, vibevoice, voxcpm2, fish_audio,
pocket_tts, omnivoice, higgs_audio_tts), voice cloning (chatterbox, index_tts2,
irodori_tts, moss_tts_local, moss_tts_nano) and voice design (qwen3_tts, irodori_tts), alongside ASR, VAD,
diarization and separation.
Higgs Audio v3 is available directly from the model gallery as
audio-cpp-higgs-audio-v3. It uses the Q8_0 GGUF validated by audio.cpp and supports
expressive multilingual TTS and zero-shot voice cloning. For cloning, pass the path to a
server-local WAV file in the OpenAI voice field. Use only reference audio for which you
have the necessary rights and consent, and review the model’s research and non-commercial
license before deployment.
The family is read from the GGUF’s own metadata, so family: is only needed for a
safetensors file or a package directory. Sending a speaker reference clip routes the
request to the family’s voice-cloning task automatically, and supplying instructions routes
it to voice design, where the family supports them. Cloning-only families such as
chatterbox advertise no plain TTS task, so every request to them must carry a reference
clip. See the
audio.cpp backend page for the full option list,
including the load. and session. namespaces and the supertonic packaging caveat.
NeMo-Speech.cpp (MagpieTTS)
NeMo-Speech.cpp is NVIDIA’s C++/ggml runtime
for the Nemotron Speech models. Its magpietts family synthesizes speech through a
NanoCodec decoder, and the same installed backend also covers transcription, diarization
and translation.
The codec and the tokenizer directory are both required. Both are discovered from the
model’s own directory when left unset: a sibling file whose name contains nanocodec and
a sibling directory named extracted. MagpieTTS conditions on a speaker rather than on a
prose style, so voice selects a speaker index or a voice name and instructions has no
equivalent. See the NeMo-Speech.cpp backend
page for the full option list and the conversion steps.
LFM3-Audio (llama.cpp, experimental)
LFM3-Audio-2B synthesises speech through the llama-cpp backend. Install the gallery entry lfm3-audio-2b (or lfm3-audio-2b-q8). Its voices are female (the default) and male. The language field takes a language code, and the default is en. The model uses the sampling defaults stored in its GGUF files. This needs a llama.cpp build with LFM3-Audio support.
Response format
To provide some compatibility with OpenAI API regarding response_format, ffmpeg must be installed (or a docker image including ffmpeg used) to leverage converting the generated wav file before the api provide its response.
Warning regarding a change in behaviour. Before this addition, the parameter was ignored and a wav file was always returned, with potential codec errors later in the integration (like trying to decode a mp3 file from a wav, which is the default format used by OpenAI)
Supported format thanks to ffmpeg are wav, mp3, aac, flac, opus, defaulting to wav if an unknown or no format is provided.
If a response_format is added in the query (other than wav) and ffmpeg is not available, the call will fail.
Sound prompt expansion
POST /v1/sound-generation accepts optional expansion_model to expand a sound
description with an installed chat model before audio generation:
curl http://localhost:8080/v1/sound-generation \
-H 'Content-Type: application/json'\
-d '{
"model_id": "music",
"text": "A gentle piano instrumental with warm strings",
"expansion_model": "chat",
"instrumental": true
}' --output music.wav
Replace music and chat with your installed audio and chat model names.
The server requires non-empty text when you select expansion_model.
Select an installed llama-cpp chat model with use_tokenizer_template: true
and a tokenizer template that supports native tool calls. Expansion sends one
strict, schema-backed expand_sound function tool with tool_choice: required.
Other backends and configurations without tokenizer templates are rejected before
inference. An explicit grammar is cleared for this request only; the installed
model configuration is unchanged. The configuration flag alone does not guarantee
that the selected model and template support native tools.
The server validates the arguments and stops before audio generation if invalid.
If your account has a model allowlist, it must allow both the resolved audio
model and the selected expansion model. Sound permission covers this internal
expansion; separate Chat permission is not required.
Omit expansion_model to preserve the backend’s existing prompt behavior.
Python ACE-Step then keeps its native Simple-mode expansion.
Advanced requests can continue to send caption, lyrics, and metadata directly.
The chat model must return exactly one expand_sound tool call with required
caption and lyrics strings in its arguments. Assistant prose and reasoning
are never used as fallback arguments.
The server caps output at 2,048 tokens and accepts only these fields:
Field
Accepted value
caption
1–500 characters
lyrics
0–4000 characters
bpm
Integer from 1 through 400
keyscale
One of 504 musical key spellings, such as C, F# minor, or bb dorian (see below)
timesignature
N/D, with each integer from 1 through 32
language
String of at most 32 characters
duration_seconds
Number from 1 through 600
The keyscale tool schema enumerates the accepted spellings instead of using a
regular expression. Use a root from A–G or a–g, optionally followed by
# or b. The root can stand alone or have one space followed by major,
minor, maj, min, dorian, phrygian, lydian, mixolydian, locrian,
ionian, or aeolian. Mode names are lowercase; extra whitespace and other
spellings are not accepted. This preserves the server’s existing vocabulary.
Omit optional fields when unspecified; do not use an empty string or null
for an unknown key. Empty lyrics remains valid for instrumental sound.
Invalid-key errors quote and escape the rejected key, showing at most 64
characters and the total character count if truncated. They do not include
other generated arguments.
Explicit instrumental: true clears generated lyrics. Your selected language
(or vocal_language) takes precedence over generated language.
An explicit duration takes precedence over generated duration.
Conflicting caption, style, lyrics, and music metadata in params cannot replace
expanded fields. The audio backend receives structured fields and an expansion
marker, with the original text cleared. Backend support for expanded requests varies.
An unavailable model, a model without native tool support, a missing or wrong
tool call, multiple calls, or invalid arguments returns a request error. Expansion failures stop the request before audio generation.
Cancellation propagates to model loading, text inference, and audio generation.
In Studio → Sound → Simple, choose a Prompt expansion model before
submitting. Sound uses the same model picker as Home, with search for longer
model lists and keyboard navigation. The list contains installed, enabled chat
models. You must explicitly choose a model or Backend default; opening or
dismissing the picker does not select a model. Backend default
omits expansion_model and uses the audio backend’s existing prompt behavior.
Sound remembers either choice in this browser, separately from your chat model.
If a remembered model disappears or loses chat support, choose again.
Sound refreshes the list when you return to the browser tab.
Without an installed chat model, choose Backend default to continue.
Re-run with edits restores the expansion choice from that result.
Older results without a saved expansion choice use Backend default.
Advanced keeps its caption, lyrics, metadata, and thinking controls;
it never sends expansion_model.
Expanded requests support these audio families:
Backend family
Expanded input
audio-cpp YuE2
Caption as style, generated lyrics
audio-cpp HeartMuLa
Caption as tags, generated lyrics; instrumental requests are rejected because lyrics are required
audio-cpp ACE-Step
Caption as prompt, generated lyrics and supported metadata
audio-cpp Stable Audio
Caption as prompt
Python ACE-Step
Structured caption and lyrics, bypassing its native Simple expansion
Other audio-cpp families reject expanded requests before audio inference.
The chat expansion may already have run when the backend reports this error.
Choose Backend default to use that backend’s existing behavior.
The UI does not detect backend families or silently retry without expansion.
Sound Classification
Sound-event classification (audio tagging) answers the question “what am I hearing?” - given an audio clip, it returns a list of scored AudioSet labels (e.g. Baby cry, infant cry, Glass breaking, Dog bark, Alarm).
LocalAI exposes this through the /v1/audio/classification endpoint, modelled after /v1/audio/transcriptions. The reference backend is ced.cpp (CED, a 527-class AudioSet tagger), a small ViT over a log-mel spectrogram ported to ggml with full PyTorch parity. Apache-2.0 weights are redistributable as GGUF.
parakeet.cpp can also load a CED model (through third_party/ced.cpp) and serve /v1/audio/classification from the same backend used for ASR and diarization. It scores the clip in 10 s windows and averages each class’s score across the windows before sorting and applying top_k/threshold - CED’s own method for clips longer than one window. Install parakeet-cpp-ced-tiny or parakeet-cpp-ced-base from the gallery, or point parameters.model at a CED GGUF under backend: parakeet-cpp. A parakeet-cpp ASR model can also point sound_model at a CED GGUF to add live sound events during realtime transcription - see Realtime API - and to add timed sound events to an offline diarization call with include_sounds=true - see Speaker Diarization. Such a model also answers /v1/audio/classification itself when it declares the sound_classification usecase, as the gallery entry parakeet-cpp-multilingual-diarization-speakers-sounds does.
Because classification is exposed as a regular OpenAI-style endpoint, any HTTP client works - there is no Python dependency on the consumer side.
In distributed mode, LocalAI stages uploaded audio and realtime sound-detection
windows on the selected worker before classification. The API server and worker
do not need a shared temporary directory.
Endpoint
POST /v1/audio/classification
Content-Type: multipart/form-data
Field
Type
Description
file
file (required)
audio file in any format ffmpeg accepts
model
string (required)
name of the sound-classification-capable model (e.g. ced-base-f16)
top_k
int
number of top tags to return (0 = backend default)
The bundle entries parakeet-cpp-bundle-small and parakeet-cpp-bundle-standard also serve this endpoint: they hold CED-Small next to the transcription, VAD and diarization models (sound_component:ced). See Bundle GGUF files.
Speaker diarization answers the question “who spoke when?” - given an audio clip with multiple speakers, it returns time-stamped segments labelled with a stable speaker ID (SPEAKER_00, SPEAKER_01, …).
LocalAI exposes this through the /v1/audio/diarization endpoint, modelled after /v1/audio/transcriptions. Five backends are supported today:
sherpa-onnx - pyannote-3.0 segmentation + a speaker-embedding extractor (3D-Speaker, NeMo, WeSpeaker) + fast clustering. Pure diarization - no transcription cost. Recommended when you only need speaker turns.
vibevoice.cpp - produces speaker-labelled segments as a by-product of its long-form ASR pass, so you can optionally get a transcript per segment for free.
NeMo-Speech.cpp - NVIDIA Sortformer, served standalone by the NeMo-Speech.cpp backend. It is end to end, so the speaker capacity is fixed by the checkpoint and the count hints are ignored. The same backend can instead put speaker tags on a transcript, by attaching a Sortformer model to an ASR one.
parakeet.cpp - NVIDIA Nemotron-3-Diarization (Sortformer, up to 8 speakers), served standalone or paired with a Parakeet ASR model for per-segment text. See the Audio to Text page for the parakeet-cpp option reference.
Because diarization is exposed as a regular OpenAI-compatible endpoint, any HTTP client works. There is no Python dependency on pyannote or NeMo on the consumer side.
In distributed mode, LocalAI stages uploaded audio on the remote worker before
running dedicated diarization and releases the staged input after the request.
The worker does not need access to the frontend’s temporary upload directory.
Endpoint
POST /v1/audio/diarization
Content-Type: multipart/form-data
Field
Type
Description
file
file (required)
audio file in any format ffmpeg accepts
model
string (required)
name of the diarization-capable model
num_speakers
int
exact speaker count when known (>0 forces; 0 = auto)
min_speakers
int
hint when auto-detecting
max_speakers
int
hint when auto-detecting
clustering_threshold
float
cosine distance threshold used when num_speakers is unknown
min_duration_on
float
discard segments shorter than this many seconds
min_duration_off
float
merge gaps shorter than this many seconds
language
string
only meaningful for backends that bundle ASR (e.g. vibevoice)
include_text
bool
when the backend can emit per-segment transcript for free, populate it
include_sounds
bool
add the closed sound events of the clip as sounds. Needs a model with a sound companion; see Sound events. Default false
response_format
string
json (default), verbose_json, or rttm
Response - json (default)
Compact payload, no transcription, no per-speaker summary:
speaker is the normalized, zero-padded label clients should display. label preserves the raw backend-emitted ID for clients that maintain their own speaker dictionary.
Response - verbose_json
Adds per-speaker totals and (when the backend supports it and include_text=true) the per-segment transcript:
{"task":"diarize","duration":12.34,"language":"en","num_speakers":2,"segments":[{"id":0,"speaker":"SPEAKER_00","label":"0","start":0.00,"end":2.34,"text":"Hello, world."},{"id":1,"speaker":"SPEAKER_01","label":"1","start":2.34,"end":4.10,"text":"How are you?"}],"speakers":[{"id":"SPEAKER_00","label":"0","total_speech_duration":5.6,"segment_count":3},{"id":"SPEAKER_01","label":"1","total_speech_duration":1.76,"segment_count":1}]}
Speaker names
With a parakeet-cpp model that has a speaker_model: (or a speaker_component:, for a bundle file such as parakeet-cpp-bundle-standard) and voices registered through /v1/voice/register, segments whose speaker matches a registered voice gain name and name_score (the cosine similarity of the match), and the matching speakers entry gains name. Both fields are omitted for a speaker that was not identified, so an unnamed response looks exactly as before. speaker stays SPEAKER_NN, and RTTM output still uses SPEAKER_NN. See Voice Recognition for the setup and the limits.
{"task":"diarize","duration":12.34,"num_speakers":2,"segments":[{"id":0,"speaker":"SPEAKER_00","label":"0","start":0.00,"end":2.34,"text":"Hello, world.","name":"Alice","name_score":0.82},{"id":1,"speaker":"SPEAKER_01","label":"1","start":2.34,"end":4.10,"text":"How are you?"}],"speakers":[{"id":"SPEAKER_00","label":"0","name":"Alice","total_speech_duration":5.6,"segment_count":3},{"id":"SPEAKER_01","label":"1","total_speech_duration":1.76,"segment_count":1}]}
Sound events
With include_sounds=true the response gains a sounds array: the sound events (AudioSet labels such as Dog, Applause, Cough) found anywhere in the clip, in the same call that returns the speakers, the text and the voice prints. Each item is {start, end, label, confidence}: start and end are in seconds from the start of the audio, and confidence is the peak score the tagger reached while the event lasted (0 to 1). Items are sorted by start. Both json and verbose_json carry the array; rttm has no place for it and returns 400.
An empty sounds array means the sound model ran and found no event. The field is absent when include_sounds is not set. The events come from the same sound stream, with the same on and off thresholds, that a realtime session runs, so a clip gives the same events offline and live. The thresholds are not request fields.
The model needs a sound companion, a sound_model: option pointing at a CED GGUF (the gallery entry parakeet-cpp-multilingual-diarization-speakers-sounds has one). Without it the request fails with HTTP 501 and a message that starts with the stable code include_sounds_unsupported; the same happens for a backend that cannot report sound events. LocalAI never answers with an empty list in place of that error. The speaker segments, text and voice prints are independent of the sound model and cost nothing extra when include_sounds is off.
Response - rttm
NIST RTTM, the standard interchange format used by pyannote.metrics / dscore:
Returned as Content-Type: text/plain; charset=utf-8.
Quick start
First install a diarization-capable model from the gallery. The example below uses vibevoice-cpp-asr, which serves the vibevoice.cpp backend and returns speaker-labelled segments (and, optionally, a transcript):
The sections below show how to configure the two supported backends by hand when you want full control over the segmentation and embedding models.
Backend setup - sherpa-onnx (pure diarization)
Sherpa-onnx needs two ONNX models: pyannote segmentation and a speaker-embedding extractor. Place them under your LocalAI models directory and reference them from the YAML:
The complete -asr-speakers entry downloads Nemotron-3-Diarization, Parakeet TDT+CTC 110M ASR, and the WeSpeaker ResNet34 speaker encoder.
It configures both asr_model and speaker_model; no custom gallery configuration is needed.
See Remember speakers in the Web UI for installation and enrollment.
The parakeet-cpp-multilingual-diarization-speakers-sounds entry downloads Parakeet TDT 0.6B v3 (25 European languages), Nemotron-3-Diarization, the WeSpeaker ResNet34 speaker encoder and CED-Tiny, and sets diarization_model, speaker_model and sound_model. It answers the whole request above from one model name. See Sound events.
The entries parakeet-cpp-bundle-small and parakeet-cpp-bundle-standard hold Nemotron-3-Diarization, an ASR model and the WeSpeaker speaker encoder in one file (diar_component:diar and speaker_component:voice), so one install serves the transcript and the identification options above. See Bundle GGUF files.
For manual configuration, this example pairs Sortformer with ASR:
Getting text on each segment needs both: an asr_model companion loaded on the model, and include_text=true on the request. With only one of the two, segments carry no text and no error is raised. Sortformer has a fixed speaker capacity and no clustering stage, so num_speakers, min_speakers, max_speakers and clustering_threshold are ignored (logged at debug); min_duration_on and min_duration_off are honored. Speaker labels are the decimal index the model assigned ("0", "1", …), or "unknown" when a segment has no diarized speaker.
Sortformer clusters on voice-like characteristics, not on “is this a human”. A loud non-speech sound with voice-like pitch and rhythm (a rooster crow, in one test clip) can come back as its own speaker segment alongside the real speakers. This is model behavior, not a bug in the LocalAI integration: treat an unexpected extra speaker as a hint the clip may contain a non-speech sound, and use Sound Classification to confirm what it is.
Notes
Speaker identity across files: speaker IDs (SPEAKER_00, SPEAKER_01, …) are local to each request. To track the same person across multiple recordings, combine /v1/audio/diarization with /v1/voice/embed (speaker embedding) and maintain your own embedding store.
Hints vs. forces: num_speakers overrides clustering when set; min_speakers / max_speakers are advisory and only honored by backends that expose a range hint. vibevoice.cpp and parakeet-cpp (Sortformer) ignore them - the model picks the count itself.
Sample rate: input is automatically converted to 16 kHz mono via ffmpeg before the backend sees it; sherpa-onnx pyannote-3.0 requires 16 kHz.
See also
Sound Classification - tag non-speech sound events (alarms, glass breaking, baby cry) in a clip.
Backend profile transport
The parakeet backend supports opt-in speaker profile export through the internal
DiarizeRequest.include_speaker_profiles field. This native transport underpins
HTTP profile export and explicit enrollment through POST /v1/voice/register,
as described in Portable speaker enrollment below.
It requires a configured speaker_model and a library
with parakeet_capi_diarize_profiles_pcm_json; an empty recognition registry
is supported. Export does not register anyone. With include_text and a loaded
ASR companion, one profile-capable diarization supplies all speaker slots,
profiles, names, and intervals. Timestamped ASR words are assigned to those
same slots; the backend does not run a second diarization. Either inference
failure fails the request. If no ASR companion is loaded, the existing fallback
applies: the response includes profiles and diarization segments without text.
A loaded ASR companion without the timestamped PCM API returns an explicit error.
DiarizeResponse.speaker_profiles_json carries the native version-1
speaker_profiles object, including original clean preview intervals and one
embedding per usable speaker. Normal requests retain their existing output.
Profile speaker values are raw native slot IDs. Match their decimal string to
segment label or speaker-summary label, not to normalized SPEAKER_NN,
array position, or display name. Slots can be sparse, and profile order can
differ from transcript order. Profiles retain their original clean intervals
even when transcript segments use word boundaries or duration filters.
These vectors are sensitive biometric data: callers must authorize export and
explicit enrollment separately.
The internal backend Status response supplies speaker_encoder, derived from
the loaded encoder’s SHA-256 identity and dimension. Enrollment code must use
backend.ModelSpeakerEncoder with server-selected model configuration and
validate profiles against that result, never against caller-provided metadata.
Unavailable metadata or unsupported export fails closed. Renaming a GGUF does
not change its identity; modifying or quantizing its bytes does.
Recognition replay carries registration IDs separately from display names.
Distinct IDs with the same display name remain independent native entries,
and both offline and realtime matches are translated back to display names.
Legacy transport clients without IDs retain name-keyed behavior. The native
registry’s aggregation defaults are unchanged. LocalAI’s recognition registry
remains global and in-memory; this adds neither persistence nor automatic
registration and is unrelated to persistent TTS voice cloning.
Portable speaker enrollment
Profile-capable parakeet models can export one biometric embedding per discovered
speaker, including when the recognition registry is empty. Export is opt-in:
The /audio/diarization alias has the same protection. With user authentication,
export additionally requires the voice-recognition permission. Existing model
access controls still apply. Without opt-in, speaker_profiles is omitted.
Both json and verbose_json support profiles; rttm with profiles returns 400.
include_text=true retains supported transcripts in either JSON format.
Unsupported profile backends return 501 rather than silently omitting profiles.
The speaker_profiles response object contains version: 1,
encoder: {"identity": "sha256:<64 lowercase hex digits>", "dimension": N},
and speakers. Each speaker contains:
speaker: the raw numeric speaker slot;
clean_duration: retained clean speech in seconds;
intervals: {start, end} ranges in seconds in the original recording;
unavailable_reason: null for usable profiles, otherwise a reason string;
embedding: one vector for a usable speaker, omitted when unavailable.
UI association: convert each profile’s numeric speaker to a decimal string
and match segment/summary label. Do not use SPEAKER_NN, array position, or
human name. Slots may be sparse and out of order; display names may repeat.
Preview intervals against the original audio, not separated audio. Disable
saving unavailable profiles. Enrollment is explicit, never automatic; only
relabel after a successful registration response. See
portable voice registration.
Profiles are sensitive, unsigned biometric data, not proof of identity or consent.
Do not log their vectors. Obtain the speaker’s consent before enrollment.
API tracing excludes the entire exchange for /v1/audio/diarization, its
/audio/diarization alias, and /v1/voice/register before capturing bodies.
This also protects JSON base64 audio when profile export is off. These routes
produce no in-memory or persisted API trace; other routes keep their existing
tracing behavior. External proxies and client logs must apply the same privacy
policy. Existing trace files from older versions are not retroactively scrubbed.
Remember speakers in the Web UI
Use a LocalAI build with portable enrollment support and a profile-capable parakeet-cpp backend.
The backend needs the profile APIs from merged upstream commit
bee7c14 or a compatible later build.
Installing the model weights alone does not update an older backend.
Open Models → Explore and search for parakeet-cpp-nemotron-3-diarization-asr-speakers.
Select Install and wait for installation to complete. Check Admin → Activity for progress or errors.
Open Studio → Diarization (or /app/diarization). Select that model and upload your recording.
Obtain the speaker’s consent before enrollment. To remember a speaker from that recording:
Select Prepare speakers to remember, then select Diarize. This
requests profiles, transcript text, and speaker summaries. Use a
profile-capable parakeet-cpp model configured with a speaker encoder.
In Speakers, select Preview 1, Preview 2, or another available
interval to listen to clean speech from the original recording. Playback
stops at the end of that interval. Stop preview stops it earlier.
Your browser must support the recording’s audio format.
For an unknown speaker, select Name and remember. Enter a name and
select Remember. No second recording or audio upload is needed.
After the server confirms registration, the name appears on all turns for
that speaker. A failed save keeps the entered name so you can retry.
Upload another recording and select Diarize to match remembered voices.
You can turn off Prepare speakers to remember; recognition does not require another profile export.
Matches show their names; unmatched speakers keep their speaker labels.
With preparation off, the UI requests speaker turns without transcript text.
Use the API example below to request text without exporting profiles.
Speakers without a usable profile cannot be
remembered; try longer speech without overlapping speakers. Duplicate names
are allowed: each save creates a separate registration, not a merged voice.
Changing the model or recording clears the current results and save dialog.
A save already sent to the server can still complete, but cannot rename turns
in a different recording.
The page requires the Audio Diarization permission and access to the selected model. Preparing profiles and
remembering speakers additionally require Voice Recognition. Users without
that permission can still run normal diarization. If the backend does not
support profiles, the page reports an error: choose a compatible model or
turn off Prepare speakers to remember. It does not silently retry without
profiles.
Warning
Remembered voices are shared globally on this server and are lost when it
restarts. Nothing is enrolled automatically. The browser stores only the new
registration’s ID, name, and registration time for the existing voice
management list, not its embedding or recording. That list is local to the
browser and is not a durable server registry.
Use Manage remembered voices, then the Enrollment tab, to see or
remove registrations saved in this browser. Clean-clip voice enrollment stays
available there and does not require diarization.
API example: install, export, and remember
This example uses the same complete gallery entry and requires curl and jq.
The commands assume a local server without authentication.
If authentication is enabled, add -H "Authorization: Bearer <key>" to every request using your authorized key.
Keep keys out of shared scripts, logs, and shell history; see Authentication.
Installation requires model-management access; inference and enrollment require the permissions described above.
Installation is asynchronous. Wait for successful completion in Admin → Activity before continuing.
API clients can query the returned job status URL; see the model gallery API.
Warning
Exported profiles contain biometric vectors. Obtain consent before enrollment.
Keep the recording, response, and registration files private. Do not log or share their contents.
Use a new private directory so existing files cannot retain broader permissions. Delete these files when no longer needed.
Export profiles and transcript text from your recording, keeping the complete JSON response:
Choose a usable raw speaker slot whose decimal string matches the intended segment label.
Listen to its intervals in the original recording before assigning a name.
Do not select by array position, normalized SPEAKER_NN, or display name.
If unavailable_reason indicates insufficient speech, try a longer recording without overlapping speakers.
Replace 0 below with your chosen raw slot. Zero is valid, but does not mean “the first array element.”
Keep the complete speaker_profiles object unchanged:
Matching speakers can now carry name, even though this request omits include_speaker_profiles.
Keep include_text=true and verbose_json when you want transcript text.
Recognition is not proof of identity. Registrations remain global and disappear on server restart.
See portable profile registration for encoder compatibility and validation rules.
Audio Transform
The audio-transform endpoints take audio in and emit audio out, optionally
conditioned on a second reference audio signal. The category is generic by
design - concrete operations include joint acoustic echo cancellation +
noise suppression + dereverberation (LocalVQE), voice conversion (reference
= target speaker), pitch shifting, audio super-resolution, and so on.
The first shipping backend is LocalVQE,
a 1.3 M-parameter GGML-based model that performs joint AEC + noise suppression
dereverberation on 16 kHz mono speech, ~9.6× realtime on a desktop CPU. It
is a derivative of the Microsoft DeepVQE paper.
Source separation and voice conversion are served by the
audio.cpp backend: its htdemucs and
mel_band_roformer families produce the named stems described below, and
seed_vc, vevo2 and miocodec do voice conversion against a reference
speaker.
The mental model
Every audio-transform request carries:
audio - the primary input file (required).
reference - an auxiliary signal whose meaning is backend-specific (optional).
For echo cancellation: the loopback / far-end signal played through the speakers.
For voice conversion: the target speaker’s reference clip.
For pitch / style transfer: a tonal or style reference.
When omitted, the backend treats it as silence and degrades gracefully (LocalVQE,
for example, does denoise + dereverb only when ref is empty).
params - a generic key=value map forwarded to the backend.
This shape mirrors WebRTC’s ProcessStream(near) / ProcessReverseStream(far)
APM API, NVIDIA Maxine’s NvAFX_Run paired-stream signature, and the ICASSP
AEC challenge 2-channel WAV convention.
Batch endpoint
POST /audio/transformations (alias POST /audio/transform) - multipart
form-data, returns audio bytes.
Field
Type
Required
Notes
model
string
yes
Audio-transform model id (e.g. localvqe-v1.3-4.8m)
audio
file
yes
Primary input audio
reference
file
no
Optional auxiliary signal
response_format
string
no
wav (default), mp3, ogg, flac
sample_rate
int
no
Desired output sample rate in Hz. Omit it for the backend’s own rate; otherwise it must be between 8000 and 192000, and a value outside that range is refused with a 400
params[<key>]
string
no
Repeated; forwarded to backend
params[stem]
string
no
Multi-output transforms only; picks which named output the body carries (see stems)
When reference is omitted, LocalVQE zero-fills the reference channel and
the operation reduces to noise suppression + dereverberation.
What LocalAI does to your upload before the backend sees it
By default, nothing: the file reaches the backend at its own sample rate and
its own channel count. A WAV already carrying plain 16-bit PCM is passed through
byte for byte; any other container or encoding is transcoded to 16-bit PCM WAV
with the rate and the channel layout kept.
The exception is a backend that declares it needs a fixed input shape.
LocalVQE does: its echo cancellation is trained on 16 kHz mono and needs the
primary input and the reference in the same shape, so uploads for it are folded
to 16 kHz mono s16 with ffmpeg. The declaration is
BackendCapability.AudioTransformInputMono16k in core/config, and localvqe
is currently the only backend that sets it.
This matters for anything that is not speech enhancement. Source separation
models refuse any sample rate but their checkpoint’s own (44.1 kHz for every
published htdemucs and mel_band_roformer checkpoint) and rely on the stereo
image to tell a centred vocal from a wide mix, so a 16 kHz mono downmix would
remove both the format they accept and the cue they work from.
Multi-output transforms (source separation stems)
Some transforms produce several named outputs from one run: htdemucs yields
drums, bass, other and vocals in a single pass. The response body can
carry only one file, so:
The backend runs once and writes every stem beside the main output.
params[stem]=<name> chooses which one the body carries. Without it the
default is vocals when the model has one, and the model’s first output
otherwise. An unknown stem name is refused with an error listing the real
ones, never silently substituted.
Every stem, including the one in the body, is named in the X-Audio-Stems
response header, a compact JSON array:
Fetch any of those URLs to get the other stems without paying for a second
separation. sample_rate and response_format are applied to the stems as well
as to the body, so the whole set stays in the shape you asked for. The header is
listed in Access-Control-Expose-Headers, so browser clients can read it.
Single-output transforms (echo cancellation, voice conversion) do not set the
header at all, and params[stem] against such a model is refused rather than
ignored.
# isolate the vocals (the default), then see where the other stems wentcurl -sS -D headers.txt -X POST http://localhost:8080/audio/transformations \
-F model=htdemucs -F audio=@song.wav -o vocals.wav
grep -i '^x-audio-stems' headers.txt
# or ask for a specific stem in the bodycurl -sS -X POST http://localhost:8080/audio/transformations \
-F model=htdemucs -F audio=@song.wav -F 'params[stem]=drums' -o drums.wav
The stems live in the generated-content directory beside the main output and are
served from /generated-audio/. Like every other generated artifact, they are
not swept automatically.
Text-conditioned transforms (speech to speech)
Most transforms are audio in, audio out. A few are not: a speech-to-speech
model resynthesises a line in another voice and needs to know what the line
says. /audio/transform has no text field, so the text travels as
params[text].
curl -sS -X POST http://localhost:8080/audio/transformations \
-F model=audio-cpp-vevo2-speech-to-speech \
-F audio=@source.wav \
-F reference=@target-speaker.wav \
-F 'params[text]=The quick brown fox jumps over the lazy dog.'\
-o converted.wav
For these models the text is required, not a hint: the run is refused without
it. params[target_text] is accepted as the same field, and
params[language] sets the language when the line is not English. A model that
does not take text ignores all three, so an ordinary separation or
noise-suppression request is unaffected.
Streaming endpoint
GET /audio/transformations/stream - bidirectional WebSocket. The first
client message is a JSON envelope; subsequent client messages are binary
PCM frames; server emits binary PCM frames at the same cadence.
This endpoint accepts models with the audio_transform use case. It does not
accept any-to-any models with the realtime_audio use case. For example,
a realtime any-to-any model uses the OpenAI Realtime API
instead.
sample_format is S16_LE (16-bit signed little-endian) or F32_LE (32-bit
float little-endian, [-1, 1]). frame_samples defaults to the backend’s
preferred hop length (256 = 16 ms for LocalVQE).
Client → server (binary frames, subsequent): interleaved stereo PCM,
channel 0 = audio (mic), channel 1 = reference. Frame size:
frame_samples × 2 channels × sample_size. For S16_LE at 256 samples that
is 1024 bytes per frame; for F32_LE it is 2048 bytes. If the reference is
silent (no auxiliary signal), send zeros on channel 1.
Server → client (binary frames): mono PCM in the same format,
frame_samples × sample_size bytes (512 bytes for S16_LE, 1024 for F32_LE).
Mid-stream control (text frame): another session.update resets the
streaming state when its reset field is true; a session.close text frame
ends the session cleanly.
Latency
LocalVQE has 16 ms algorithmic latency (one hop). At runtime the per-frame CPU
cost depends on the model: ~1.6 ms for the compact 1.3 M models (v1.1/v1.2,
~9.7× realtime) and ~3.3 ms for the wider v1.3 4.8 M model (~4.7× realtime) on
a 4-thread modern desktop, leaving the rest of the budget for network and
downstream playback.
Backend-specific tuning (LocalVQE)
params[<key>]
Type
Default
Effect
noise_gate
bool
false
Enable post-OLA RMS-based residual-echo gate
noise_gate_threshold_dbfs
float
-45.0
Gate threshold in dBFS; frames below are zeroed
The gate is most useful in far-end-only / silent-near-end stretches where the
model’s residual would otherwise sound like buffering or amplified noise floor.
A reasonable starting point is -50 dBFS.
Configuring a model
LocalVQE ships several weight releases in the gallery: localvqe-v1.3-4.8m
(current default - best quality), localvqe-v1.2-1.3m and localvqe-v1.1-1.3m
(compact, ~¼ the per-hop cost - good for low-core or power-constrained hosts).
All share the same backend and request API; only the model filename differs.
name:localvqebackend:localvqeparameters:model:localvqe-v1.3-4.8M-f32.gguf# Backend-specific defaults can be set in Options[]; per-request# params[*] form fields override.## `backend` and `device` route through the upstream localvqe options# builder so you can force a non-default GGML backend (e.g. `Vulkan`) or# pin to a specific GPU index. Leave both unset to keep the CPU default.options:- noise_gate=true- noise_gate_threshold_dbfs=-50# - backend=Vulkan# - device=0
Voice Activity Detection (VAD) identifies segments of speech in audio data. LocalAI provides a /v1/vad endpoint powered by the Silero VAD backend.
The audio.cpp backend also serves this endpoint, and ships the silero_vad and marblenet_vad assets inside its own package, so VAD works there with nothing to download (model: bundled:silero_vad plus the family:silero_vad option).
API
Method:POST
Endpoints:/v1/vad, /vad
Request
The request body is JSON with the following fields:
Parameter
Type
Required
Description
model
string
Yes
Model name (e.g. silero-vad)
audio
float32[]
Yes
Array of audio samples (16kHz PCM float)
Response
Returns a JSON object with detected speech segments:
Field
Type
Description
segments
array
List of detected speech segments
segments[].start
float
Start time in seconds
segments[].end
float
End time in seconds
Usage
Example request
The /v1/vad endpoint expects the audio field to be an array of raw
16kHz mono PCM samples as float32 values, so the request body is usually
built from a real audio file rather than typed by hand.
First convert any audio file to 16kHz mono with ffmpeg:
Then load the samples and POST them (this snippet needs
pip install soundfile numpy requests):
importsoundfileassfimportnumpyasnpimportrequestsaudio,sample_rate=sf.read("speech.wav")ifaudio.ndim>1:audio=audio.mean(axis=1)# downmix to monosamples=audio.astype(np.float32).tolist()response=requests.post("http://localhost:8080/v1/vad",json={"model":"silero-vad","audio":samples},)print(response.json())
Thresholds must be greater than 0 and less than 1. Durations must be nonnegative integers.
Malformed values, negative durations, and NaN thresholds are ignored; the default or last valid value remains in use.
Reload the model (or restart LocalAI) after changing these options.
parakeet-cpp backend
The parakeet-cpp backend serves the same endpoint. It runs one of two detectors:
Silero VAD from a GGUF file (gallery entry parakeet-cpp-silero-vad-f16, 1.3 MB). One probability per 32 ms.
The VAD head of a full Moondream Ultra or Redux model (gallery entries parakeet-cpp-vad-moondream-ultra-q8_0 and parakeet-cpp-vad-moondream-redux-packed). One probability per 80 ms. The packed Redux file runs on CPU only.
A VAD-only slice of that head (gallery entries parakeet-cpp-vad-moondream-redux, 9.9 MB, and parakeet-cpp-vad-moondream-ultra, 6.0 MB). The slice is cut out of the full model without retraining, so the segments are byte-identical to the full model’s head, and the speed is the same. Compared with loading the whole model (213 MB to 1.4 GB), the file is 6 to 10 MB, loads in a few milliseconds instead of 0.1 to 0.7 s, and needs about 245 MiB of peak memory for a 33 s clip instead of 0.6 to 1.6 GiB. A slice cannot transcribe, and it needs a parakeet.cpp build with VAD-only GGUF support (pin e53a253 or newer).
A bundle GGUF (gallery entries parakeet-cpp-bundle-small, parakeet-cpp-bundle-standard and parakeet-cpp-bundle-moondream-redux). The bundle holds a Silero component next to the ASR model, and the backend uses it for this endpoint with no option. See Bundle GGUF files.
The entry parakeet-cpp-vad installs Silero. The detectors differ and are not variants of one model, so install the entry of the VAD head by name if you want it (parakeet-cpp-vad-moondream-redux or parakeet-cpp-vad-moondream-ultra for the small files). The request is the same as above: audio is 16 kHz mono float32 PCM, and the response lists segments with start and end in seconds. An ASR model that has no VAD head fails the request with model has no VAD head.
All options are optional. An unset value keeps the default of the detector in use (the library defaults differ between Silero and the head):
Option
Unit
Silero default
Head default
Description
vad_threshold
0 to 1
0.5
0.5
Speech probability threshold
vad_min_pause
seconds
0.1
0.2
A silence this long separates two segments; shorter gaps merge
vad_min_speech
seconds
0.25
0.1
Shorter speech runs are dropped
vad_speech_pad
seconds
0.03
0
Padding added around each segment
vad_trim
seconds
0.3
0.3
Only for transcription with vad:true or vad_model: each piece shrinks to its speech plus this much. 0 keeps the whole cuts. The endpoint ignores it
Option names differ from the Silero backend above (min_silence_duration_ms and speech_pad_ms are in milliseconds there). The same options tune transcription with vad:true or vad_model; see audio to text. Requests on one loaded model run one at a time.
Detection Parameters
The Silero VAD backend uses the following internal defaults (overridable via options above):
Sample rate: 16kHz
Threshold: 0.5
Min silence duration: 100ms
Speech pad duration: 30ms
Error Responses
Status Code
Description
400
Missing or invalid model or audio field
500
Backend error during VAD processing
Voice Recognition
LocalAI supports voice (speaker) recognition: speaker verification
(1:1), speaker identification (1:N) against a built-in vector store,
speaker embedding, and demographic analysis (age / gender / emotion
from voice).
The audio analog to Face Recognition,
served over the same /v1/voice/* HTTP API by two backends:
voice-detect (recommended, default). A standalone C++/ggml
engine (voice-detect.cpp):
no Python, no onnxruntime, no torch runtime. Each gallery entry is a
single self-describing GGUF. This is the recommended option for new
deployments.
speaker-recognition (Python). The original SpeechBrain / ONNX
backend. Still supported; see the Python backend
below.
Both backends expose the identical wire format, so the API examples on
this page work with either - only the gallery entry name (the model
field) changes.
voice-detect (ggml) backend
The voice-detect backend reads the embedding (or analysis)
architecture (voicedetect.arch) directly from the GGUF metadata, so
installing a gallery entry is all that is needed to select an engine. It
drives the VoiceEmbed / VoiceVerify / VoiceAnalyze gRPC rpcs behind the
/v1/voice/{embed,verify,analyze,register,identify,forget} endpoints.
Gallery entries
Gallery entry
Model
Embedding dim
License
voice-detect-ecapa-tdnn
SpeechBrain ECAPA-TDNN (VoxCeleb)
192
Apache 2.0 - commercial-safe
voice-detect-wespeaker-resnet34
WeSpeaker ResNet34 (VoxCeleb)
256
CC-BY-4.0
voice-detect-eres2net
3D-Speaker ERes2Net (VoxCeleb)
192
Apache 2.0 - commercial-safe
voice-detect-campplus
3D-Speaker CAM++ (VoxCeleb)
192
Apache 2.0 - commercial-safe
voice-detect-emotion-wav2vec2
audEERING wav2vec2 (age / gender / emotion)
analyze head
CC-BY-NC-SA-4.0 - non-commercial
The four speaker-recognition entries drive verify / embed / identify.
voice-detect-emotion-wav2vec2 is the analysis head behind
/v1/voice/analyze (continuous age estimate plus gender and emotion
class scores) and is non-commercial / research use only.
Quickstart
Install the default entry (recommended for copy-paste):
local-ai models install voice-detect-ecapa-tdnn
Verify that two audio clips were spoken by the same person:
The 1:N register / identify / forget workflow and the rest of the API
are identical to the API reference below - just pass a
voice-detect-* model name. The default verify threshold is ~0.25 for
the ECAPA-TDNN / ERes2Net / CAM++ recognizers and ~0.30 for WeSpeaker
ResNet34.
speaker-recognition (Python) backend
The speaker-recognition backend follows the same two-engine pattern
under one image.
Engines
Gallery entry
Model
Size
License
speechbrain-ecapa-tdnn
ECAPA-TDNN on VoxCeleb (SpeechBrain)
~17 MB
Apache 2.0 - commercial-safe
wespeaker-resnet34
WeSpeaker ResNet34 ONNX
~26 MB
Apache 2.0 - commercial-safe
Both entries are commercial-safe Apache-2.0. SpeechBrain is the
default - it’s a lightweight pure-PyTorch checkpoint that auto-
downloads on first use. The wespeaker-resnet34 entry wires the
direct-ONNX path for CPU-only deployments that don’t want the torch
runtime.
Quickstart
Install the default backend and model:
local-ai models install speechbrain-ecapa-tdnn
Verify that two audio clips were spoken by the same person:
curl -sX POST http://localhost:8080/v1/voice/forget \
-d '{"id": "b2f..."}'# → 204 No Content
Warning
Storage caveat. The default vector store is in-memory. All
registered speakers are lost when LocalAI restarts. Persistent storage
(pgvector) is a tracked future enhancement shared with face
recognition - the voice-recognition HTTP API is designed to swap the
backing store without changing the wire format.
Voices from different encoders
Voices from encoders with different embedding sizes can be registered on the
same instance, for example 192-value ECAPA-TDNN voices next to 256-value
WeSpeaker ResNet34 voices. LocalAI keeps one in-memory vector store per
embedding size, so registering a voice of a new size no longer fails.
Identification compares the probe only with voices of the same size. Voices
from an encoder of another size are never candidates.
If no voice of the probe size is registered, /v1/voice/identify returns an
empty matches list and the realtime voice gate reports an unknown speaker.
Neither returns an error.
Two encoders can still give the same size (ECAPA and CAM++ both give 192
values). Those voices share a store and the encoder tag or identity checks
described below apply.
A name is not unique. One name can hold one voice per encoder, and each
registration has its own ID. /v1/voice/forget removes the voice with that
ID only, so forget each ID to remove a person from every encoder.
Naming in diarization and live transcription reads the registry as a whole
and uses the voices that match the loaded encoder.
A parakeet-cpp bundle as the embedding model
A parakeet-cpp model that has a speaker encoder can serve /v1/voice/embed,
/v1/voice/verify, /v1/voice/register and /v1/voice/identify, and the
voice_recognition stage of a realtime pipeline. That is every
bundle with a voice component
(parakeet-cpp-bundle-small and parakeet-cpp-bundle-standard), and any
parakeet-cpp config with a speaker_model: or speaker_component: option, such as
parakeet-cpp-realtime-scene-speakers. Declare speaker_recognition in the
known_usecases of the config; the gallery entries above already do. Then use the model
name as model:
The voice component holds the same weights as voice-detect-wespeaker-resnet34
(256 dimensions), so a voice registered with one model also matches embeddings from the
other. Use a distance threshold near 0.5 for this encoder, as for speaker_model:
naming below. The response model field is the sha256: identity of the encoder
weights.
/v1/voice/verify uses a distance threshold of 0.5 when the request has none. Set the
model option voice_verify_threshold:<distance> (a distance in (0, 2)) to change it.
Only embedding, identification and plain verification are available. There is no
anti-spoofing head, so a verify request with anti_spoofing: true is refused, and
/v1/voice/analyze is not served by parakeet-cpp. The backend needs a libparakeet.so
that exports parakeet_capi_speaker_embed_pcm. With an older library these calls fail
with an Unimplemented error that names the missing symbol, and a model without a
speaker encoder fails with a FailedPrecondition error.
Naming speakers in diarization and live transcription
The parakeet-cpp backend can put the names of registered voices on
diarization results and on live transcription speaker segments. Without
this, speakers only carry labels such as SPEAKER_00.
Register each voice with the WeSpeaker encoder. Install the model with
local-ai models install voice-detect-wespeaker-resnet34, then call
/v1/voice/register with "model": "voice-detect-wespeaker-resnet34"
(see the 1:N workflow).
Install one of the gallery models that loads the same encoder:
parakeet-cpp-nemotron-3-diarization-speakers (diarization),
parakeet-cpp-nemotron-3-diarization-asr-speakers (diarization with
include_text), parakeet-cpp-multilingual-diarization-speakers-sounds
(multilingual diarization with include_text, voice prints and sound events)
or parakeet-cpp-realtime-scene-speakers (live
transcription). Each one adds
speaker_model:voice-detect-wespeaker-resnet34.gguf to a
parakeet-cpp model config.
Call /v1/audio/diarization with that model. Matched segments gain a
name and a name_score, and the matching entry in speakers gains a
name. speaker stays SPEAKER_NN, and RTTM output is unchanged. See
Speaker Diarization for the
response.
Naming speakers from a bundle
A parakeet-cpp bundle file holds the speaker encoder as a component, so its
config has speaker_component:voice and no speaker_model: (the
parakeet-cpp-bundle-small and parakeet-cpp-bundle-standard gallery
entries are set up like this). LocalAI treats speaker_component: as the
speaker encoder of the model when speaker_model: is not set. A
speaker_model: entry always wins, including one that points at the bundle
file itself.
A bundle has no encoder file name, so LocalAI cannot compare file-name tags,
and it never guesses a tag from the bundle file name. For a bundle component
LocalAI sends the backend:
voices with an encoder fingerprint, whatever their
tag: the backend checks the fingerprint against the loaded component.
Voices enrolled from speaker_profiles are in this group. The WeSpeaker
component of the published bundles has the same weights as
voice-detect-wespeaker-resnet34, so a voice enrolled with one works with
the other;
voices with no tag (registered before tags existed);
voices whose tag equals the speaker_tag: option, if set.
Other voices are ignored. To use a voice that carries only a file-name tag,
set the same tag on the model config. For voices registered through the
voice-detect-wespeaker-resnet34 gallery model:
Use speaker_tag: only for voices made by the same weights as the bundle
component. The check by size alone cannot tell two encoders apart.
Which voices are used
LocalAI sends the backend only the registered voices made by the same
encoder as the model’s speaker_model: file. Each registered voice is
tagged with the name of the voice-detect model that made it, which by
default is the GGUF file name (voice-detect-wespeaker-resnet34.gguf for the
gallery entry). The tag must equal the base name of the speaker_model:
file. Voices made with another encoder are ignored, and LocalAI logs a
warning when that leaves no usable voice. Voices registered before the tag
existed have no tag: they are used when their embedding size matches the
tagged ones (or all of them, when no voice carries a matching tag). The
backend skips a voice whose embedding size does not match the speaker model’s,
with a warning in the LocalAI log. Naming then falls back to the remaining
voices, or to no names.
Encoder fingerprint
Two encoders can give embeddings of the same size (ECAPA and CAM++ both give
192 values), so a size match does not prove the voices and the speaker_model:
file share an embedding space. A voice enrolled from speaker_profiles (see
Speaker Diarization) is stored with the
encoder that made it: its weights (sha256: of the encoder file, kept in
the voice’s model field as before) and its family
(voicedetect:<arch>:<name>:<dim>, read from the encoder GGUF metadata and
stored as encoder_family). The parakeet-cpp backend builds the registry with
that fingerprint, and libparakeet checks it against the loaded speaker_model:
before it names anyone:
Registered voices
Result
Same family, same weights
names are assigned
Same family, other weights (for example another quantization)
names are assigned, the library logs a warning
Another family, and no other usable voice
the request fails, and the error names both families
Another family, with usable voices of the right family
the other voices are left out, with a warning
No fingerprint
used as before, with a warning that the encoder is unverified
A voice with only a weights identity takes the family of the loaded encoder
when the weights are the same file. A voice with a different weights hash and
no family is dropped, as before.
A voice registered from audio through the voice-detect backend (POST /v1/voice/register with audio) is fingerprinted too, when the libvoicedetect
in the backend can report its encoder (voice-detect.cpp from the pin that adds
voicedetect_capi_encoder_family). The backend reads the family from the
loaded GGUF, and hashes the model file once at load to get the weights. LocalAI
stores the family as encoder_family and the weights as encoder_weights; the
model field keeps the encoder name as before. If the voice-detect model is
not a plain file the backend cannot hash it and the weights stay empty, so the
family alone fingerprints the voice. When the family is known, LocalAI sends
the voice to the backend whatever its file name, so the family decides.
A voice-detect backend built against an older libvoicedetect cannot report
the family, but it still records the weights. Such a voice is treated as made
by the loaded speaker_model: when the weights are the same file, and stays
unfingerprinted when they differ.
Voices registered before this change have no fingerprint, and so do voices
from a backend that reports neither (the Python speaker-recognition backend).
They are used as described above, by file-name
tag. Such voices and fingerprinted voices cannot share one registry in the
library. When a request has any unfingerprinted voice, all of its voices are
used without the fingerprint check. Register those voices again to get
the check. With speaker_strict:true the backend ignores unfingerprinted
voices, and a request that has only those fails with the library’s message.
The family is also reported in the internal backend status next to the
identity. /v1/voice/identify compares the family of a stored voice with the
family of the probe when both have one, and falls back to the file-name tag
when either has none.
The family is built from the encoder GGUF metadata. For CAM++, WeSpeaker and
ERes2Net the GGUF general.name is the path the model was converted from, so
the same encoder converted again under another name has another family, and
voices registered with the first file are refused with the second. Two
fine-tunes that share an architecture, name and embedding size have the same
family; only the weights hash tells them apart, and a hash mismatch alone only
logs a warning.
Note
With a fingerprint, the model_name: option on the voice-detect model config
no longer breaks naming: the family decides, not the name. Voices registered
without a fingerprint still need the default name to match the
speaker_model: file.
Options
These go in the options: list of the parakeet-cpp model config (see
Audio to Text for the other parakeet-cpp
options).
Option
Default
Meaning
speaker_model:<path>
none
speaker encoder GGUF; needs a diarization model (the primary one, or diarization_model:)
speaker_component:<name>
none
speaker encoder component of a bundle file; used as the speaker encoder for naming when speaker_model: is not set (see Naming speakers from a bundle)
speaker_tag:<tag>
none
encoder tag that also counts as the loaded encoder, for voices that carry only a file-name tag; mainly for a bundle component
speaker_threshold:<float>
0.5
largest distance (1 minus cosine similarity, the unit /v1/voice/identify reports) at which a speaker is named; must be in (0, 2)
speaker_margin:<float>
0.05
the best match must beat the runner-up by this much, otherwise the speaker stays unnamed; must be in [0, 1)
speaker_strict:<bool>
false
ignore registered voices that carry no encoder fingerprint; needs a libparakeet that exports parakeet_capi_speaker_registry_set_strict
parakeet.cpp’s measured starting values for speaker_threshold are 0.5 for
WeSpeaker ResNet34 and CAM++, and 0.3 for ECAPA. A lower value names fewer
speakers and makes fewer mistakes.
Limits
The voice registry is in memory and global. Registered names disappear when
LocalAI restarts, and every user of the instance shares them.
Anyone who is allowed to call a model with speaker_model: or speaker_component: can learn which
registered names match their audio, and their audio is matched against voices
registered by any user, because the voice registry is global. Restrict such
models with the per-user model allowlist.
With include_text=true the names use the default threshold and margin:
speaker_threshold and speaker_margin only apply to diarization without
text.
In live transcription, a speaker segment that closes before its speaker
is identified has no name. Later segments of that speaker do.
Overlapping speech is not resolved.
Accuracy was measured on one fixture (two read-speech voices). Check the
threshold on your own audio.
The backend needs a libparakeet with C-API v10. With an older library a
model config that sets speaker_model: or speaker_component: fails to load.
A bundle does not serve /v1/voice/register, /v1/voice/identify or
/v1/voice/verify itself. Register voices with a voice-detect model (or
from speaker_profiles), then name them through the bundle.
API reference
POST /v1/voice/verify (1:1)
field
type
description
model
string
gallery entry name (e.g. speechbrain-ecapa-tdnn)
audio1, audio2
string
URL, base64, or data-URI of an audio file
threshold
float, optional
cosine-distance cutoff; default 0.25 for ECAPA-TDNN
anti_spoofing
bool, optional
reserved - unused in the current release
Returns verified, distance, threshold, confidence, model,
and processing_time_ms.
POST /v1/voice/analyze
Returns demographic attributes (age, gender, emotion) inferred from
speech:
field
type
description
model
string
gallery entry
audio
string
URL / base64 / data-URI
actions
string[]
subset of ["age","gender","emotion"]; empty = all supported
Emotion is inferred from the SUPERB emotion-recognition checkpoint
(superb/wav2vec2-base-superb-er, Apache 2.0) - 4-way categorical
neutral / happy / angry / sad. The model auto-downloads on the first
analyze call.
Age and gender are opt-in: no standard-transformers checkpoint
with a clean classifier head is shipped as the default. The
high-accuracy Audeering age/gender model uses a custom multi-task
head that AutoModelForAudioClassification doesn’t load safely
(the age weights are silently dropped and the classifier is
re-initialised with random values). To enable age/gender, set
age_gender_model:<repo> in the model YAML’s options: pointing at
a checkpoint with a vanilla Wav2Vec2ForSequenceClassification
head. Override the emotion default similarly via emotion_model:.
Set either to an empty string to disable that head.
If a head fails to load (offline, disk full, transformers
missing), the engine degrades gracefully: it still returns the
attributes it could compute. When nothing can be computed the backend
returns 501 Unimplemented.
Analyze is supported by both speechbrain-ecapa-tdnn and
wespeaker-resnet34 - the speaker recognizer and the analysis head
are independent.
POST /v1/voice/register (1:N enrollment)
field
type
description
model
string
voice recognition model
audio
string
speaker audio to enroll
name
string
human-readable label
labels
map[string]string, optional
arbitrary metadata
store
string, optional
vector store model; defaults to local-store
Returns {id, name, registered_at}. The id is an opaque UUID used
by /v1/voice/identify and /v1/voice/forget. The stored voice records the
encoder fingerprint when the backend reports it.
POST /v1/voice/identify (1:N recognition)
field
type
description
model
string
voice recognition model
audio
string
probe audio
top_k
int, optional
max matches to return; default 5
threshold
float, optional
cosine-distance cutoff; default 0.25
store
string, optional
vector store model
Returns a list of matches sorted by ascending distance, each with
id, name, labels, distance, confidence, and match
(distance ≤ threshold).
POST /v1/voice/forget
field
type
description
id
string
ID returned by /v1/voice/register
Returns 204 No Content on success, 404 Not Found if the ID is
unknown.
POST /v1/voice/embed
Returns the L2-normalized speaker embedding vector.
field
type
description
model
string
voice model
audio
string
URL / base64 / data-URI
Returns {embedding: float[], dim: int, model: string}. Dimension
depends on the recognizer: 192 for ECAPA-TDNN, 256 for WeSpeaker
ResNet34.
Note: the OpenAI-compatible /v1/embeddings endpoint is
intentionally text-only - it does nothing useful with audio input.
Use /v1/voice/embed for audio.
Audio input
Audio is materialised by the HTTP layer to a temporary WAV file
before the gRPC call. All audio fields accept:
The backend itself always receives a filesystem path - the same
convention the Whisper / Voxtral transcription backends use.
Threshold reference
Recognizer
Cosine-distance threshold
ECAPA-TDNN (SpeechBrain, VoxCeleb)
~0.25
WeSpeaker ResNet34
~0.30
3D-Speaker ERes2Net
~0.28
Pass threshold explicitly when switching recognizers - the per-model
default only applies when omitted.
The WebUI page
The page is the Recognition tab of the Voice add-on (Add-ons → Voice, /app/addons/voice/voice/recognition). Install the add-on from Browse add-ons and start it. Canonical links show the add-on shell when the installation is unavailable. The page calls the /v1/voice/* routes described on this page with your own session. The Voice page has four tabs. Recognition is this feature. Library is the Voice Library for text-to-speech, a different store with its own recordings and transcripts. Text to speech speaks text with a voice model. From a recording links to the diarization workspace, where a speaker can be named and remembered.
On the Recognition tab:
Who is this matches a clip against the people you enrolled (POST /v1/voice/identify). The answer is a sentence with the real distance and the cut-off, a word for how far inside the cut-off it sits (strong, likely, close call), and a scale with the cut-off drawn on it. The cut-off slider re-reads the answer in the browser; it does not call the server again. The page sends the cut-off in the request, 0.25 by default.
Same person? compares two clips (POST /v1/voice/verify) and uses the threshold the model returns. The word is not a probability, and the page says so.
Enrol a speaker opens a sheet: a recording, a name, optional labels, and a permission tick. An administrator can also keep the recording as a speech voice in the same step. Keeping a copy of the recording in the browser is off unless you tick it.
Known speakers is a list kept in the browser. The server has no list call, so the page cannot check it by itself. After a search it marks a saved person the server did not return as “not on the server” (only when the search asked for more people than it got back, so a short answer is never read as proof), and lists anyone the server returned that this browser has no record of. A server restart empties the server’s index; enrol again, or use Re-enrol from saved copy if you kept one.
Removing a person waits ten seconds behind an Undo toast. Nothing is sent to the server until the time ends; Undo cancels it.
If no speaker-recognition model is installed, the tool is replaced by a note that says so, with models from the gallery to install. Users without the Voice recognition permission see a page that says it is off for their account.
The clip you test with is sent to the model on the server and is not kept. Analyze (age, gender and emotion guesses, all off by default) and the raw embedding are under More tools.
Related features
Face Recognition - the image analog;
the two share a registry design.
Audio to Text - transcription (Whisper,
Voxtral, faster-whisper). Runs in addition to, not instead of,
voice recognition.
Stores - the generic vector store powering
both the face and voice 1:N recognition pipelines.
Embeddings - text-only OpenAI-compatible
embedding endpoint; for audio embeddings use /v1/voice/embed.
Portable profile registration
POST /v1/voice/register also accepts a JSON alternative to audio:
// result is the parsed diarization response; slot is a selected raw speaker slot.
constrequest={model:"parakeet-diarization",name:"Ada",labels:{team:"research"},speaker_slot:slot,speaker_profiles:result.speaker_profiles};// POST JSON.stringify(request) with Content-Type: application/json.
Copy the complete speaker_profiles object returned by diarization unchanged.
Select speaker_slot explicitly, including for slot zero. It is the raw numeric
slot whose decimal string matches the diarization label, not a normalized
SPEAKER_NN, array index, or display name. audio and speaker_profiles are
mutually exclusive. speaker_slot without profiles is also invalid. Audio-only
registration keeps its existing JSON shape and behavior.
The server loads the requested, authorized model and obtains encoder identity and
dimension from backend metadata. It validates the complete profile export and
selects the requested usable slot. Missing slots, unavailable speech, unsupported
versions, non-finite/zero/wrong-size vectors and encoder mismatch return 400.
A backend without trusted encoder metadata returns 501. Success returns the
existing {id, name, registered_at} response.
Portable registrations store the server-derived SHA-256 identity, not a
caller-provided filename tag. Offline/live recognition admits these registrations
only when the loaded encoder has the same identity and dimension. Legacy audio
registrations retain their filename-tag compatibility rules. /v1/voice/identify
filters incompatible matches; a backend unable to report trusted identity cannot
match portable registrations, even when vector dimensions agree. Filtering can
return fewer than top_k results. The parakeet diarization model need not support
the separate audio-only VoiceEmbed RPC used by /v1/voice/identify.
Each successful enrollment inserts a new registration with its own ID and vector.
Duplicate display names do not merge embeddings or update an earlier enrollment.
There is no automatic enrollment or sample aggregation.
The recognition registry is global, in-memory and per LocalAI instance;
registrations are lost on restart and are not synchronized across frontends.
This is not durable “remembering” and not a per-user private address book. The
persistent /api/voice-profiles TTS-cloning feature is unrelated. Export and
registration use the existing voice-recognition permission, with existing model
access restrictions; permission does not establish biometric consent.
API tracing excludes the entire exchange for /v1/audio/diarization, its
/audio/diarization alias, and /v1/voice/register before capturing bodies.
This also protects JSON base64 audio when profile export is off. These routes
produce no in-memory or persisted API trace; other routes keep their existing
tracing behavior. External proxies and client logs must apply the same privacy
policy. Existing trace files from older versions are not retroactively scrubbed.
For offline and live diarization replay, registry tags never determine the
encoder dimension. LocalAI orders candidates by registration ID (tagged first),
then uses loaded encoder metadata to filter dimensions. Portable registrations
require an exact SHA-256 identity match as well. Older backends without trusted
metadata reject portable candidates and retain their native legacy dimension
checks. Identification filters compatibility after the store’s top_k query;
incompatible results can crowd out compatible candidates within that window.
Images, video and 3D
Image understanding, detection, faces, image and video generation, 3D and motion. The Studio add-on makes and keeps images, video and 3D in one page, and the Face add-on is a page for face recognition.
LocalAI supports understanding images by using LLaVA, and implements the GPT Vision API from OpenAI.
Usage OpenAI docs: https://platform.openai.com/docs/guides/vision
First install a vision-capable model from the gallery (the examples below use moondream2-20250414, a small vision model):
local-ai run moondream2-20250414 To let LocalAI understand and reply with what sees in the image, use the /v1/chat/completions endpoint, for example with curl:
LocalAI supports object detection and image segmentation through various backends. This feature allows you to identify and locate objects within images with high accuracy and real-time performance. Available backends include RF-DETR (Python) and rf-detr.cpp (native C++/ggml) for object detection and segmentation, and sam3.cpp for image segmentation (SAM 3/2/EdgeTAM).
For detecting faces specifically, see the dedicated Face Recognition feature - its /v1/detection support is tuned for face bounding boxes and ships with commercially-safe model options.
LocalAI supports face recognition: face verification (1:1), face identification (1:N) against a built-in vector store, face embedding, face detection, demographic analysis (age / gender), and antispoofing / liveness detection.
The same /v1/face/* HTTP API is served by two backends:
LocalAI can generate videos from text prompts and optional image or audio conditioning via the /video endpoint. Supported backends include diffusers, stablediffusion (including MiniMax-H3, which generates video and audio together), vllm-omni, mlx-video on Apple Silicon, and the dedicated longcat-video backend.
MLX-Video on Apple Silicon Install the native Metal backend, then configure an LTX-2 repository:
LocalAI can generate textured 3D meshes from a single conditioning image via the /3d/generations endpoint, powered by the trellis2cpp backend, a C++/GGML port of Microsoft TRELLIS.2 (trellis2.cpp). The output is a binary glTF (.glb) asset with PBR materials.
Generation is image-conditioned only. There is no text-prompt path. Provide a photo or rendering of a single object (ideally on a plain background) and TRELLIS.2 reconstructs a full 3D mesh from it.
For text-conditioned animated skeletons, see 3D Animation. Both workflows appear under 3D in Studio; selecting a model changes the inputs and generation options.
LocalAI supports text-to-motion with kimodo.cpp on CPU and Vulkan. In Studio → 3D, selecting an animation model replaces the image input with a motion prompt and the selected model’s animation controls.
The Studio preview plays at real-time speed using the GLB’s timestamps. Slow or delayed display frames skip ahead rather than slowing the animation. Pause and the timeline let you inspect individual poses; playback resumes from that point.
Kimodo exports an animated skeleton GLB: joint rotations and root movement, without a mesh or skin. SOMA models produce the compact 30-joint skeleton; G1 models produce 34 joints. These outputs are animation assets, not textured characters, and cannot use TRELLIS print remeshing.
LocalAI’s gemxcpp backend converts timestamped RGB frames into human poses using gem-x.cpp. It runs resident GEM-X, ViTPose and YOLOX models on CPU or Vulkan. Live inference does not need SAM3D Body. This initial integration is API-only: no Motion UI, offline clip export, body mesh or SONIC controller is included.
Install and configure Import https://huggingface.co/LocalAI-io/GEM-X-GGUF through the model importer. It selects gemxcpp and downloads three checksummed, revision-pinned assets. These are custom F32 GGUF architectures, not language models. Weight licenses are described in the source model card. Allow memory for all three models and execution buffers, beyond their roughly 4 GB combined download size.
Subsections of Images, video and 3D
Image understanding
LocalAI supports understanding images by using LLaVA, and implements the GPT Vision API from OpenAI.
First install a vision-capable model from the gallery (the examples below use moondream2-20250414, a small vision model):
local-ai run moondream2-20250414
To let LocalAI understand and reply with what sees in the image, use the /v1/chat/completions endpoint, for example with curl:
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "moondream2-20250414",
"messages": [{"role": "user", "content": [{"type":"text", "text": "What is in the image?"}, {"type": "image_url", "image_url": {"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" }}], "temperature": 0.9}]}'
Grammars and function tools can be used as well in conjunction with vision APIs:
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "moondream2-20250414", "grammar": "root ::= (\"yes\" | \"no\")",
"messages": [{"role": "user", "content": [{"type":"text", "text": "Is there some grass in the image?"}, {"type": "image_url", "image_url": {"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" }}], "temperature": 0.9}]}'
Setup
Install a vision-capable model from the gallery, either from the Models page in the web UI or from the CLI:
local-ai run moondream2-20250414
Other vision models are available in the gallery (for example smolvlm-instruct and smolvlm2-2.2b-instruct). Browse them on the Models page or see the /docs/models/.
Object Detection
LocalAI supports object detection and image segmentation through various backends. This feature allows you to identify and locate objects within images with high accuracy and real-time performance. Available backends include RF-DETR (Python) and rf-detr.cpp (native C++/ggml) for object detection and segmentation, and sam3.cpp for image segmentation (SAM 3/2/EdgeTAM).
For detecting faces specifically, see the dedicated
Face Recognition feature - its
/v1/detection support is tuned for face bounding boxes and ships
with commercially-safe model options.
Overview
Object detection in LocalAI is implemented through dedicated backends that can identify and locate objects within images. Each backend provides different capabilities and model architectures.
Key Features:
Real-time object detection
High accuracy detection with bounding boxes
Image segmentation with binary masks (SAM backends)
Text-prompted, point-prompted, and box-prompted segmentation
Support for multiple hardware accelerators (CPU, NVIDIA GPU, Intel GPU, AMD GPU)
Structured detection results with confidence scores
Easy integration through the /v1/detection endpoint
Usage
Detection Endpoint
LocalAI provides a dedicated /v1/detection endpoint for object detection tasks. This endpoint is specifically designed for object detection and returns structured detection results with bounding boxes and confidence scores.
API Reference
To perform object detection, send a POST request to the /v1/detection endpoint:
The RF-DETR backend is implemented as a Python-based gRPC service that integrates seamlessly with LocalAI. It provides object detection capabilities using the RF-DETR model architecture and supports multiple hardware configurations:
CPU: Optimized for CPU inference
NVIDIA GPU: CUDA acceleration for NVIDIA GPUs
Intel GPU: Intel oneAPI optimization
AMD GPU: ROCm acceleration for AMD GPUs
NVIDIA Jetson: Optimized for ARM64 NVIDIA Jetson devices
Setup
Using the Model Gallery (Recommended)
The easiest way to get started is using the model gallery. The rfdetr-base model is available in the official LocalAI gallery:
# Install and run the rfdetr-base modellocal-ai run rfdetr-base
You can also install it through the web interface by navigating to the Models section and searching for “rfdetr-base”.
Manual Configuration
Create a model configuration file in your models directory:
Currently, the following model is available in the Model Gallery:
rfdetr-base: Base model with balanced performance and accuracy
You can browse and install this model through the LocalAI web interface or using the command line.
RF-DETR Native Backend (rfdetr-cpp)
The rfdetr-cpp backend is a native C++/ggml implementation of RF-DETR
inference based on rf-detr.cpp. It
runs as a Go gRPC service that dlopens a per-CPU-variant shared library, so
there is no Python runtime on the inference path - startup is fast and the
binary is self-contained.
Compared to the Python rfdetr backend, the native backend:
Has no Python or PyTorch dependency at inference time
Supports both detection and segmentation variants of RF-DETR
Returns segmentation masks as PNG bytes in Detection.mask
Setup
Install the backend
local-ai backends install rfdetr-cpp
Using the Model Gallery (Recommended)
The gallery ships ready-to-run entries for every published variant:
# Detection variantslocal-ai run rfdetr-cpp-nano
local-ai run rfdetr-cpp-small
local-ai run rfdetr-cpp-base
local-ai run rfdetr-cpp-medium
local-ai run rfdetr-cpp-large
# Segmentation variants (return per-instance PNG masks)local-ai run rfdetr-cpp-seg-nano
local-ai run rfdetr-cpp-seg-small
local-ai run rfdetr-cpp-seg-medium
local-ai run rfdetr-cpp-seg-large
local-ai run rfdetr-cpp-seg-xlarge
local-ai run rfdetr-cpp-seg-2xlarge
Pre-quantized GGUFs are published under
mudler/rfdetr-cpp-*
on Hugging Face. Each repo carries the F32/F16/Q8_0/Q4_K quants - F16 is
the recommended default (matches F32 accuracy, ~1.86x smaller).
Segmentation Output
When running a segmentation model (any rfdetr-cpp-seg-* variant), each
Detection in the response carries a mask field with a base64-encoded
PNG of the per-instance binary mask. The mask is sized to the original
image resolution and aligns with the corresponding bounding box.
SAM3 Backend (sam3-cpp)
The sam3-cpp backend provides image segmentation using sam3.cpp, a portable C++ implementation of Meta’s Segment Anything Model. It supports multiple model architectures:
SAM 3: Full model with text encoder for text-prompted detection and segmentation
SAM 2 / SAM 2.1: Hiera backbone models in multiple sizes
SAM 3 Visual-Only: Point/box segmentation without text encoder
EdgeTAM: Ultra-efficient mobile variant (~15MB quantized)
Setup
Manual Configuration
Create a model configuration file in your models directory:
Verify model compatibility with your backend version
Low Detection Accuracy
Ensure good image quality and lighting
Check if objects are clearly visible
Consider using a larger model for better accuracy
Slow Performance
Enable GPU acceleration if available
Use a smaller model for faster inference
Optimize image resolution
Debug Mode
Enable debug logging for troubleshooting:
local-ai run --debug rfdetr-base
Object Detection Category
LocalAI includes a dedicated object-detection category for models and backends that specialize in identifying and locating objects within images. This category currently includes:
LocalAI supports face recognition: face verification (1:1), face
identification (1:N) against a built-in vector store, face embedding,
face detection, demographic analysis (age / gender), and antispoofing /
liveness detection.
The same /v1/face/* HTTP API is served by two backends:
face-detect (recommended, default). A standalone C++/ggml
engine (face-detect.cpp):
no Python, no onnxruntime, no torch runtime. Each gallery entry is a
single self-describing GGUF. This is the recommended option for new
deployments.
insightface (Python). The original ONNX Runtime backend. Still
supported; see the Python backend below.
Both backends expose the identical wire format, so the API examples in
this page work with either - only the gallery entry name (the model
field) changes.
face-detect (ggml) backend
The face-detect backend reads the detector and recognizer architecture
(facedetect.arch) directly from the GGUF metadata, so installing a
gallery entry is all that is needed to select an engine. It drives the
Embeddings / Detect / FaceVerify / FaceAnalyze gRPC rpcs behind the
/v1/face/{embed,verify,analyze,detect,register,identify,forget}
endpoints.
Licensing - read this first
Gallery entry
Detector + recognizer
Embedding dim
License
face-detect-buffalo-l
SCRFD-10GF + ArcFace R50 + GenderAge
512
Non-commercial research only (upstream insightface weights)
face-detect-buffalo-m
SCRFD-2.5GF + ArcFace R50 + GenderAge
512
Non-commercial research only
face-detect-buffalo-s
SCRFD-500MF + MBF + GenderAge
512
Non-commercial research only
face-detect-yunet-sface
YuNet + SFace (OpenCV Zoo)
128
Apache 2.0 - commercial-safe
The insightface buffalo packs (buffalo_l / buffalo_m / buffalo_s) are
released by the upstream maintainers for non-commercial research use
only. Pick the face-detect-yunet-sface entry for production /
commercial deployments.
Quickstart
Install the commercial-safe entry (recommended for copy-paste):
The 1:N register / identify / forget workflow and the rest of the API
are identical to the API reference below - just pass a
face-detect-* model name. The per-engine verify thresholds are ~0.35
for the buffalo ArcFace/MBF recognizers and ~0.363 for SFace.
insightface (Python) backend
The insightface backend ships two interchangeable engines under
one image, each paired with a distinct gallery entry so users can pick
by license and accuracy needs.
Licensing - read this first
Gallery entry
Detector + recognizer
Size
License
insightface-buffalo-l
SCRFD-10GF + ArcFace R50 + GenderAge
~326 MB
Non-commercial research only (upstream insightface weights)
insightface-buffalo-s
SCRFD-500MF + MBF + GenderAge
~159 MB
Non-commercial research only
insightface-opencv
YuNet + SFace
~40 MB
Apache 2.0 - commercial-safe
The insightface Python library itself is MIT, but the pretrained model
packs (buffalo_l, buffalo_s, antelopev2) are released by the upstream
maintainers for non-commercial research use only. Pick the
insightface-opencv entry for production / commercial deployments.
Quickstart
Pull the commercial-safe backend (recommended for copy-paste):
The default identity store is in memory. Clients can keep an enrollment record
and replay it with POST /v1/face/register after a restart. Extract the embedding
once with /v1/face/embed, then save the exact returned vector, model, name,
labels, and enrollment timestamp. Submit embedding instead of img:
The vector above is abbreviated; send the complete embedding from the same
recognizer model. Provide exactly one of img or embedding. Vectors must be
finite and nonzero. registered_at is optional and defaults to the current time;
replay the original timestamp to preserve it.
The store upserts by exact vector. Registration now derives a stable ID from
that vector and the store namespace, so retries and replay after a restart
return the same ID without adding duplicate entries. Replaying updates the name
and labels. Images can produce slightly different embeddings across runs; keep
the original vector instead of embedding the photo again on each retry.
This does not make the server store persistent. Clients must retain and restore
the records themselves. With independent stores behind a load balancer, replay
into each store or use a shared store. Do not mix different recognizer models in
one store. IDs from older versions change on their first registration replay.
1:N identification workflow (register → identify → forget)
This is the primary “face recognition” flow. Under the hood it uses
LocalAI’s built-in in-memory vector store - no external database to
stand up.
curl -sX POST http://localhost:8080/v1/face/forget \
-d '{"id": "8b7..."}'# → 204 No Content
Warning
Storage caveat. The default vector store is in-memory. All
registered faces are lost when LocalAI restarts. Persistent storage
(pgvector) is a tracked future enhancement - the face-recognition HTTP
API is designed to swap the backing store without changing the wire
format.
API reference
POST /v1/face/verify (1:1)
field
type
description
model
string
gallery entry name (e.g. insightface-buffalo-l)
img1, img2
string
URL, base64, or data-URI
threshold
float, optional
cosine-distance cutoff; default depends on engine
anti_spoofing
bool, optional
also run MiniFASNet liveness on each image - see Antispoofing
Returns verified, distance, threshold, confidence, model,
img1_area, img2_area, and processing_time_ms. When
anti_spoofing is set, the response also carries per-image liveness
fields: img1_is_real, img1_antispoof_score, img2_is_real,
img2_antispoof_score. A failed liveness check on either image forces
verified=false regardless of similarity.
POST /v1/face/analyze
Returns demographic attributes for every detected face:
field
type
description
model
string
gallery entry
img
string
URL / base64 / data-URI
actions
string[]
subset of ["age","gender","emotion","race"]; empty = all supported
Only insightface-buffalo-l / insightface-buffalo-s populate age and
gender (genderage head). insightface-opencv returns face regions with
empty attributes - SFace has no demographic classifier. Emotion and
race are always empty in the current release.
POST /v1/face/register (1:N enrollment)
field
type
description
model
string
face recognition model
img
string
face to enroll
name
string
human-readable label
labels
map[string]string, optional
arbitrary metadata
store
string, optional
vector store model; defaults to local-store
Returns {id, name, registered_at}. The id is an opaque UUID used by
/v1/face/identify and /v1/face/forget.
POST /v1/face/identify (1:N recognition)
field
type
description
model
string
face recognition model
img
string
probe image
top_k
int, optional
max matches to return; default 5
threshold
float, optional
cosine-distance cutoff; default 0.35 (ArcFace)
store
string, optional
vector store model; defaults to local-store
Returns a list of matches sorted by ascending distance, each with id,
name, labels, distance, confidence, and match
(distance ≤ threshold).
POST /v1/face/forget
field
type
description
id
string
ID returned by /v1/face/register
Returns 204 No Content on success, 404 Not Found if the ID is
unknown.
POST /v1/face/embed
Returns the L2-normalized face embedding vector for the detected face.
field
type
description
model
string
face model
img
string
URL / base64 / data-URI
Returns {embedding: float[], dim: int, model: string}. Dimension is
512 for the insightface ArcFace/MBF recognizers and 128 for OpenCV’s
SFace.
Note: the OpenAI-compatible /v1/embeddings endpoint is
intentionally text-only by contract (input is a string or list of
strings of TEXT to embed) - passing an image data-URI there does
nothing useful. Use /v1/face/embed for image inputs.
Reused endpoint
POST /v1/detection - returns face bounding boxes with
class_name: "face"; works for both engines.
Antispoofing (liveness detection)
All gallery entries ship the Silent-Face-Anti-Spoofing
MiniFASNetV2 + MiniFASNetV1SE ensemble (Apache 2.0, ~4 MB total, CPU-only)
alongside the face recognition weights. Set anti_spoofing: true on
/v1/face/verify or /v1/face/analyze to run liveness on each detected
face. The two models look at different crop scales and their softmax
outputs are averaged before argmax - the upstream-recommended setup.
If either image fails liveness (is_real=false), verified is forced
to false - similarity alone is not enough.
/v1/face/analyze reports per-face is_real and antispoof_score
when the flag is set.
Fail-loud semantics. If anti_spoofing: true is sent against a
model installed without the MiniFASNet files (e.g. a custom entry that
only listed the face recognition weights), the request returns a gRPC
FAILED_PRECONDITION error - the endpoint will never silently return
is_real=false. Re-install the gallery entry or point the backend at a
model that bundles the MiniFASNet ONNX files.
Info
The MiniFASNet score is best at catching printed photos and screen
replays. Deepfake videos and high-quality prosthetics are out of
scope - liveness here is a low-cost first line of defence, not a
guarantee. For higher assurance, combine with challenge-response (e.g.
ask the user to turn their head).
Choosing an engine
Need
Entry
Commercial product
insightface-opencv
Highest accuracy (research / demos)
insightface-buffalo-l
Edge / low-memory / research
insightface-buffalo-s
The recommended default threshold for /v1/face/verify and
/v1/face/identify depends on the recognizer:
Recognizer
Cosine-distance threshold
ArcFace R50 (buffalo_l)
~0.35
MBF (buffalo_s)
~0.40
SFace (opencv)
~0.50
Pass threshold explicitly when switching engines - the per-engine
default only fires when the field is omitted.
The WebUI page
The page is the Recognition page of the Face add-on (Add-ons → Face, /app/addons/face/recognition). Install the add-on from Browse add-ons and start it. Canonical links show the add-on shell when the installation is unavailable. The page calls the /v1/face/* routes described on this page with your own session. It follows the same layout as the Voice add-on’s Recognition page. Who is this looks up a photo against the people you enrolled (POST /v1/face/identify, cut-off 0.35 by default, adjustable on the scale). Same person? compares two photos (POST /v1/face/verify), optionally with the liveness check, and draws the face the model found in each photo. Enrol a person takes a photo, a name, optional labels and a permission tick; a copy of the photo stays in the browser only if you tick it.
The people list is kept in the browser because the server has no list call. After a search, a saved person the server did not return is marked “not on the server”, and a server restart empties the server’s index. Removing a person waits ten seconds behind an Undo toast before POST /v1/face/forget is sent. The server matches one face per photo. Detecting faces, attribute guesses (off by default, often wrong) and the raw embedding are under More tools. With no face model installed the page says what is missing and offers gallery models to install.
Related features
Object Detection - generic bounding-box
detection; /v1/detection works with the insightface backend too.
Embeddings - raw vector extraction; face
embeddings live in the same endpoint under the hood.
Stores - the generic vector store powering the
1:N recognition pipeline.
Image Generation
LocalAI supports generating images with Stable diffusion, running on CPU using C++ and Python implementations.
Available additional parameters: mode, step, negative_prompt.
To set a negative prompt you can either pass a separate negative_prompt field or split the prompt with |, e.g. a cute baby sea otter|malformed. When both are present they are joined with a comma (negative_prompt first, then the |-suffixed tags), so a global negative prompt can live in negative_prompt while per-image negatives are appended after |.
curl http://localhost:8080/v1/images/generations -H "Content-Type: application/json" -d '{
"prompt": "floating hair, portrait, ((loli)), ((one girl)), cute face, hidden hands, asymmetrical bangs, beautiful detailed eyes, eye shadow, hair ornament, ribbons, bowties, buttons, pleated skirt, (((masterpiece))), ((best quality)), colorful|((part of the head)), ((((mutated hands and fingers)))), deformed, blurry, bad anatomy, disfigured, poorly drawn face, mutation, mutated, extra limb, ugly, poorly drawn hands, missing limb, blurry, floating limbs, disconnected limbs, malformed hands, blur, out of focus, long neck, long body, Octane renderer, lowres, bad anatomy, bad hands, text",
"size": "256x256"
}'
Backends
stablediffusion-ggml
This backend is based on stable-diffusion.cpp. Every model supported by that backend is supported indeed with LocalAI.
Setup
There are already several models in the gallery that are available to install and get up and running with this backend, you can for example run flux by searching it in the Model gallery (flux.1-dev-ggml) or start LocalAI with run:
local-ai run flux.1-dev-ggml
To use a custom model, you can follow these steps:
Create a model file stablediffusion.yaml in the models folder:
Download the required assets to the models repository
Start LocalAI
Memory and device placement options
When a model does not fit entirely in VRAM, the following options: control where weights and computation are placed. They map directly to the upstream stable-diffusion.cpp options.
Option
Example
Description
backend
backend:clip=cpu,vae=cuda0,diffusion=vulkan0
Runtime (compute) backend assignment per component. Use cpu to place a component’s compute on the CPU. Component keys include te (text encoder / CLIP), vae, diffusion, controlnet.
params_backend
params_backend:diffusion=disk,clip=cpu
Where parameters (weights) are stored. Supports cpu, disk (mmap weights from disk to save RAM/VRAM), or per-component specs.
max_vram
max_vram:8 or max_vram:-1
Optional per-device VRAM budget (in GiB) for managed weights and automatic graph-cut execution. 0 uses live free VRAM without an explicit cap; a negative value reserves that many GiB of free VRAM. Also accepts per-backend budgets.
stream_layers
stream_layers:true
Deprecated compatibility option. Segmented weight streaming is now selected automatically, so this value is ignored.
rpc_servers
rpc_servers:localhost:50052,192.168.1.3:50052
Comma-separated list of host:port RPC servers to offload compute to.
pulid_weights_path
pulid_weights_path:pulid.safetensors
Path to PuLID-Flux weights for identity injection.
The following convenience booleans are still accepted and are translated into the backend / params_backend specs above:
Option
Equivalent spec
offload_params_to_cpu:true
params_backend += *=cpu
keep_clip_on_cpu:true
backend += te=cpu
keep_vae_on_cpu:true
backend += vae=cpu
keep_control_net_on_cpu:true
backend += controlnet=cpu
For example, to mmap the diffusion weights from disk while keeping the text encoder on the CPU:
vae_decode_only is still accepted for backwards compatibility but is now a no-op: upstream removed the flag and the model decides automatically.
VAE tiling
Sampling runs in a small latent space, but the final VAE decode expands it to full resolution and needs one large compute buffer. At 1024x1024 that buffer can exceed 8 GB, which is enough to fail on a GPU that has plenty of memory overall:
ggml_vulkan: Requested buffer size exceeds device buffer size limit: ErrorOutOfDeviceMemory
[ERROR] vae: failed to allocate the compute buffer
[ERROR] stable-diffusion.cpp - decode_first_stage failed for latent 1
Tiling decodes the latent in overlapping tiles, so peak memory scales with the tile instead of the image. It costs a little time and can leave faint seams, so it is off unless you ask for it.
Option
Example
Description
vae_tiling
vae_tiling:true
Enable tiled VAE decoding. The bare form vae_tiling also works.
vae_tile_size
vae_tile_size:512 or vae_tile_size:512x384
Tile dimensions in pixels. One number means a square tile. Omit to use the upstream default.
vae_tile_overlap
vae_tile_overlap:0.25
Overlap between neighbouring tiles. More overlap hides seams better and costs more time. Omit to use the upstream default.
Reach for this when the decode fails but sampling completed, which the backend log shows as sampling completed followed by a VAE allocation error. Two cases hit it: cards without the VRAM for a full-frame decode, and drivers that cap a single allocation regardless of free memory (Mesa RADV reports a 4 GiB maxMemoryAllocationSize, so a large decode fails there even with tens of GB free). Lowering the output resolution avoids it too, at the cost of the resolution.
ESRGAN image upscaling
The stablediffusion-ggml backend supports standalone ESRGAN upscaling through
POST /v1/images/upscale. This is a separate, upscale-only model, not a diffusion
pipeline. Image generation does not automatically upscale its results.
For manual installation, download that checkpoint into your models directory and
save the following as realesrgan-x4plus-anime-6b.yaml alongside it (the gallery
installer configures these settings for you):
upscale_scale and upscale_tile_size are backend options, expressed as
key:value strings in options, not root-level configuration fields.
upscale_scale must be a positive integer. Keep known_usecases explicitly
set to [upscale]: do not add image or diffusion_model options to this
configuration. Options are forwarded unchanged; the backend rejects invalid
or duplicate recognized settings.
The multipart fields model, image, and scale are required. The HTTP
endpoint accepts only integer scales from 1 through 16, rejecting missing,
malformed, zero, negative, or larger values with HTTP 400. This range is not a
promise that each model supports every scale: for ESRGAN, the configured
upscale_scale, the loaded model’s detected native scale, and the request’s
scale must all match exactly. Mismatches fail rather than silently resizing or
running multiple passes. For this model, always request scale=4.
The response follows the image-generation response format, with the output URL
in data[0].url under /generated-images. A successful 4x upscale multiplies
both width and height by four.
upscale_tile_size controls ESRGAN tiling in pixels: omit it or set it to
0 for stable-diffusion.cpp full-frame processing; set a positive value (such
as the gallery entry’s 128) to enable tiling. Smaller tiles reduce working
memory at the cost of more tile work. Full-frame processing can use much more
memory. upscale_direct is a separate convolution-algorithm flag, not a tile
control. Tile settings apply to ESRGAN, not the diffusion model’s separate VAE
tiling settings.
In Studio, open an existing image, choose Upscale, select an installed
upscaler, and submit. The scale is read-only and comes from the selected model’s
configured scale. A successful result becomes an Upscale child node of the
source image, leaving the original intact. Open that child to continue the
workflow with the available image actions, including another upscale or image
editing; each upscale is an explicit operation, not a post-generation default.
Unlike the Diffusers upscaling described below, this path uses ESRGAN inference
and does not fall back to Lanczos resizing.
Distributed inference (RPC workers)
The stablediffusion-ggml backend can offload computation to remote ggml RPC workers, sharding a model that does not fit on a single machine. It reuses the same backend-agnostic rpc-server workers as the llama.cpp backend, so one worker pool can serve both.
Manual: point the model at running workers with the rpc_servers option:
Automatic (peer-to-peer):model-split workers that joined with an invite (local-ai worker llama-cpp-rpc --join <invite link>) are published in the LLAMACPP_GRPC_SERVERS environment variable. The image-generation backend reads that variable automatically (when rpc_servers is not set), so the same workers used for text generation also accelerate image generation - no per-model configuration needed.
By default the RPC devices join the pool and participate in placement; combine with the backend / params_backend options above to pin specific components to them (e.g. backend:diffusion=rpc0).
Diffusers
Diffusers is the go-to library for state-of-the-art pretrained diffusion models for generating images, audio, and even 3D structures of molecules. LocalAI has a diffusers backend which allows image generation using the diffusers library.
Image upscaling
The Diffusers backend can upscale an uploaded image through
POST /v1/images/upscale. The multipart scale field is required and must be an
integer from 1 through 16 at the HTTP boundary; actual scaling behavior depends
on the selected pipeline. Install the included Stable Diffusion x4 upscaler
gallery model first:
The response uses the same format as image generation and returns the generated
image under /generated-images. The diffusers backend uses a loaded
StableDiffusionUpscalePipeline or StableDiffusionLatentUpscalePipeline when
configured. Other diffusers pipelines fall back to Lanczos resizing. Upscale
routes select models with known_usecases: [upscale], not ordinary image
generation models. If you installed the x4 upscaler before it declared this
usecase, update its model YAML to known_usecases: [upscale] or reinstall the
gallery entry. Custom Diffusers configurations intended for upscaling should
also explicitly declare the upscale usecase.
Model setup
The models will be downloaded the first time you use the backend from huggingface automatically.
Create a model configuration file in the models directory, for instance to use Linaqruf/animagine-xl with CPU:
name:animagine-xlparameters:model:Linaqruf/animagine-xlbackend:diffusersf16:falsediffusers:cuda:false# Enable for GPU usage (CUDA)scheduler_type:euler_a
Dependencies
This is an extra backend - in the container is already available and there is nothing to do for the setup. Do not use core images (ending with -core). If you are building manually, see the build instructions.
Model setup
The models will be downloaded the first time you use the backend from huggingface automatically.
Create a model configuration file in the models directory, for instance to use Linaqruf/animagine-xl with CPU:
The following parameters are available in the configuration file:
Parameter
Description
Default
f16
Force the usage of float16 instead of float32
false
step
Number of steps to run the model for
30
cuda
Enable CUDA acceleration
false
enable_parameters
Parameters to enable for the model
negative_prompt,num_inference_steps,clip_skip
scheduler_type
Scheduler type
k_dpp_sde
cfg_scale
Configuration scale
8
clip_skip
Clip skip
None
pipeline_type
Pipeline type
AutoPipelineForText2Image
lora_adapters
A list of lora adapters (file names relative to model directory) to apply
None
lora_scales
A list of lora scales (floats) to apply
None
There are available several types of schedulers:
Scheduler
Description
ddim
DDIM
pndm
PNDM
heun
Heun
unipc
UniPC
euler
Euler
euler_a
Euler a
lms
LMS
k_lms
LMS Karras
dpm_2
DPM2
k_dpm_2
DPM2 Karras
dpm_2_a
DPM2 a
k_dpm_2_a
DPM2 a Karras
dpmpp_2m
DPM++ 2M
k_dpmpp_2m
DPM++ 2M Karras
dpmpp_sde
DPM++ SDE
k_dpmpp_sde
DPM++ SDE Karras
dpmpp_2m_sde
DPM++ 2M SDE
k_dpmpp_2m_sde
DPM++ 2M SDE Karras
Pipelines types available:
Pipeline type
Description
StableDiffusionPipeline
Stable diffusion pipeline
StableDiffusionImg2ImgPipeline
Stable diffusion image to image pipeline
StableDiffusionDepth2ImgPipeline
Stable diffusion depth to image pipeline
DiffusionPipeline
Diffusion pipeline
StableDiffusionXLPipeline
Stable diffusion XL pipeline
StableVideoDiffusionPipeline
Stable video diffusion pipeline
AutoPipelineForText2Image
Automatic detection pipeline for text to image
VideoDiffusionPipeline
Video diffusion pipeline
StableDiffusion3Pipeline
Stable diffusion 3 pipeline
FluxPipeline
Flux pipeline
FluxTransformer2DModel
Flux transformer 2D model
SanaPipeline
Sana pipeline
Advanced: Additional parameters
Additional arbitrary parameters can be specified in the option field in key/value separated by ::
name:animagine-xloptions:- "cfg_scale:6"
Note: There is no complete parameter list. Any parameter can be passed arbitrarily and is passed to the model directly as argument to the pipeline. Different pipelines/implementations support different parameters.
The example above, will result in the following python code when generating images:
pipe(prompt="A cute baby sea otter",# Options passed via APIsize="256x256",# Options passed via APIcfg_scale=6# Additional parameter passed via configuration file)
Usage
Text to Image
Use the image generation endpoint with the model name from the configuration file:
LocalAI can generate videos from text prompts and optional image or audio conditioning via the /video endpoint. Supported backends include diffusers, stablediffusion (including MiniMax-H3, which generates video and audio together), vllm-omni, mlx-video on Apple Silicon, and the dedicated longcat-video backend.
MLX-Video on Apple Silicon
Install the native Metal backend, then configure an LTX-2 repository:
The backend accepts text-to-video and start-image conditioning through /video.
LTX-2 also accepts an end_image. Converted Wan2.1/Wan2.2 checkpoints must be
configured as a local model directory and do not support end_image. Useful
backend-specific params include pipeline and tiling for LTX-2, and
scheduler, shift, and tiling for Wan.
API
Method:POST
Endpoint:/video
Request
The request body is JSON with the following fields:
Parameter
Type
Required
Default
Description
model
string
Yes
Model name to use
prompt
string
Yes
Text description of the video to generate
negative_prompt
string
No
What to exclude from the generated video
start_image
string
No
Starting image as base64 string or URL
end_image
string
No
Ending image for guided generation
audio
string
No
Audio conditioning as base64, a data URI, or URL
ref_images
string[]
No
Reference images as base64, data URIs or URLs. Cannot be combined with start_image or end_image
ref_videos
object[]
No
Reference videos: {"frames": [...], "fps": 24, "audio": "..."}. frames is an ordered list of images, fps and audio are optional
ref_audios
string[]
No
Reference audio clips. The stablediffusion backend reads WAV only
width
int
No
backend
Video width in pixels; omit it to get the model’s own default canvas
height
int
No
backend
Video height in pixels; omit it to get the model’s own default canvas
num_frames
int
No
Number of frames
fps
int
No
Frames per second
seconds
string
No
Duration in seconds
size
string
No
Size specification (alternative to width/height)
input_reference
string
No
Input reference for the generation
seed
int
No
Random seed for reproducibility
cfg_scale
float
No
Classifier-free guidance scale
step
int
No
Number of inference steps
response_format
string
No
url
url to return a file URL, b64_json for base64 output
params
object
No
Backend-specific string parameters
Response
Returns an OpenAI-compatible JSON response:
Field
Type
Description
created
int
Unix timestamp of generation
id
string
Unique identifier (UUID)
data
array
Array of generated video items
data[].url
string
URL path to video file (if response_format is url)
data[].b64_json
string
Base64-encoded video (if response_format is b64_json)
Usage
First install a video-generation model from the gallery (the examples below use longcat-video):
local-ai run longcat-video
Generate a video from a text prompt
curl http://localhost:8080/video \
-H "Content-Type: application/json"\
-d '{
"model": "longcat-video",
"prompt": "A cat playing in a garden on a sunny day",
"width": 512,
"height": 512,
"num_frames": 16,
"fps": 8
}'
curl http://localhost:8080/video \
-H "Content-Type: application/json"\
-d '{
"model": "longcat-video",
"prompt": "Ocean waves on a beach",
"response_format": "b64_json"
}'
LongCat-Video and Avatar 1.5
LocalAI’s longcat-video backend serves Meituan’s official LongCat video-generation models through the /video API and the Studio Video page.
Gallery model
Upstream checkpoint
Inputs
Output
longcat-video
meituan-longcat/LongCat-Video
text, optional start image
video
longcat-video-avatar-1.5
meituan-longcat/LongCat-Video-Avatar-1.5
text, audio, optional portrait
video with the source audio
The base checkpoint supports text-to-video and image-to-video. Avatar 1.5 adds audio-driven character animation, optional portrait conditioning, and continuation segments for longer speech.
Warning
LongCat is a large, CUDA-only model family. LocalAI publishes this backend for Linux with NVIDIA CUDA 12 or CUDA 13 on x86_64 and CUDA 13 on ARM64. CPU, ROCm, and macOS images are not available. Avatar 1.5 also loads components from the base checkpoint, so reserve substantial disk and GPU or unified memory.
Install from the Model Gallery
Install one or both recipes from Models in the web UI, or use the CLI:
You can also import either official Hugging Face URL. The importer recognizes the two repositories and writes a longcat-video model config with the appropriate use case and input/output modalities.
The required OCI backend is installed automatically when LocalAI first loads the model. The hardware detector selects the CUDA 12, CUDA 13, or CUDA 13 ARM64 variant.
DGX Spark and NVIDIA ARM64
Use a LocalAI CUDA 13 ARM64 image as described in GPU acceleration. The backend defaults to PyTorch SDPA, avoiding the FlashAttention dependency that is commonly unavailable on Blackwell ARM64 systems.
For unified-memory systems, start with BF16 (use_int8:false, the default). INT8 lowers steady-state DiT memory but can have a higher load-time peak because the full model is materialized before the quantized weights are applied.
Generate in Studio
Open Studio, then choose Video.
Select longcat-video or longcat-video-avatar-1.5.
Enter a prompt and choose 832x480 or 1280x720.
Expand Reference media to upload a start image. For Avatar 1.5, upload or record the speech under Avatar audio.
Select Generate.
The base model can run without a reference image for text-to-video. Avatar 1.5 requires audio; the portrait is optional.
LongCat API examples
Text-to-video
curl http://localhost:8080/video \
-H "Content-Type: application/json"\
-d '{
"model": "longcat-video",
"prompt": "A cinematic tracking shot through a misty redwood forest",
"width": 832,
"height": 480,
"num_frames": 93,
"fps": 15
}'
Image-to-video
start_image accepts raw base64, a browser-style data URI, or a public HTTP(S) URL:
curl http://localhost:8080/video \
-H "Content-Type: application/json"\
-d "{
\"model\": \"longcat-video\",
\"prompt\": \"The subject turns toward the camera as leaves move in the breeze\",
\"start_image\": \"$(base64 --wrap=0 portrait.png)\",
\"params\": {
\"resolution\": \"480p\"
}
}"
Avatar from speech and a portrait
audio accepts raw base64, a data URI, or a public HTTP(S) URL. Each staged image or audio input is limited to 128 MiB.
Avatar output is generated at 25 FPS and is muxed with the submitted audio. When neither num_frames nor params.num_segments is provided, LocalAI derives the continuation count from the audio duration, up to the model’s max_segments setting.
LongCat model configuration
The gallery and importer make each model self-describing. A manual Avatar 1.5 config looks like this:
The explicit modality declarations are used by GET /v1/models/capabilities and attachment-aware clients. They avoid inferring model behavior from backend or checkpoint names.
Load options
Model load options use key:value entries in options:
Option
Default
Description
attention_backend
sdpa
sdpa, auto, flash2, flash3, or xformers; packaged images guarantee sdpa
use_distill
Avatar: true; base: false
Use the checkpoint’s accelerated distillation path
use_int8
false
Use Avatar 1.5’s INT8 DiT; unsupported by the base model
base_model
meituan-longcat/LongCat-Video
Base tokenizer, text encoder, and VAE used by Avatar 1.5
max_segments
8
Maximum continuation segments accepted for one request
resolution
480p
Default image-conditioned resolution: 480p or 720p
The initial backend supports one GPU per process. Tensor or context parallel sizes above one are rejected.
Per-request parameters
The /video request’s params object accepts string values:
Parameter
Description
num_segments
Explicit number of Avatar continuation segments
audio_guidance_scale
Audio classifier-free guidance when distillation is disabled
offload_kv_cache
Offload continuation KV cache (true or false)
ref_img_index
Reference-frame index used during continuation
mask_frame_range
Number of frames blended around continuation boundaries
resolution
Per-request image-conditioned resolution (480p or 720p)
With distillation enabled, Avatar uses eight inference steps and fixed text/audio guidance of 1.0. Disable use_distill in the model config before tuning step, cfg_scale, or audio_guidance_scale.
LongCat troubleshooting
HTTP 400, audio is required: Avatar 1.5 was selected without audio.
HTTP 400, request needs too many segments: trim the audio or raise max_segments in the model options.
HTTP 412: the installed LocalAI runtime cannot select a compatible NVIDIA backend image.
Out of memory while loading: use BF16 on unified-memory hardware, close other GPU workloads, or reduce model concurrency. INT8 is not guaranteed to reduce peak load memory.
Slow first request: the backend and checkpoints are downloaded and loaded on demand; subsequent requests reuse the loaded pipeline.
MiniMax-H3
MiniMax-H3 generates video and audio jointly. The clip comes back as an MP4 with a real AAC track rather than a silent render. It runs on the stablediffusion-ggml backend (stable-diffusion.cpp), through the -ggml gallery entries:
The vllm-cpp backend has no MiniMax-H3 gallery entries. Its H3 path did not finish a clip in a practical time, so use the -ggml entries above.
This is a large model. The weight files total tens of gigabytes, so use a CUDA host and plan for a long-running HTTP call.
Ask for the sound
The model generates picture and sound from the same prompt, so a prompt that only describes what is seen produces room tone and ambience. To get speech, say that the character talks and put the words in the prompt:
It is TALKING to the camera: its mouth moves clearly in sync with its speech,
in a dry, deadpan tone.
It says, clearly and audibly: "Michael scheduled another all-hands.
It is about the printer. Again."
Audio: a single clear voice, close-miked, with quiet room tone underneath.
Geometry and clip length
MiniMax-H3 renders at 24 fps. The width and height are rounded up to a multiple of 32, and the frame count is rounded up to the 17n+5 grid (…, 90, 107, 124, 141, …). The trained clip range is roughly 124 to 362 frames (about 5 to 15 seconds).
Text-to-video with sound
curl http://localhost:8080/video \
-H "Content-Type: application/json"\
-d '{
"model": "minimax-h3-fl2va-pruned-q4-ggml",
"prompt": "A cyan llama mascot in a grey office chair, talking to the camera. It says, clearly and audibly: \"the printer is down again\". Audio: one clear close-miked voice.",
"num_frames": 124,
"seed": 42
}'
First-frame conditioning
start_image pins the supplied image as frame 0 (H3’s fl2va task); end_image pins the last frame.
curl http://localhost:8080/video \
-H "Content-Type: application/json"\
-d "{
\"model\": \"minimax-h3-fl2va-pruned-q4-ggml\",
\"prompt\": \"the subject turns toward the camera and starts speaking\",
\"start_image\": \"$(base64 --wrap=0 portrait.png)\"
}"
Partitions: what each checkpoint will and will not do
MiniMax-H3 ships as two DiT partitions. The FL2VA entries serve t2va (text only) and fl2va (first/last frame). Reference conditioning (a whole reference image, a reference clip, or reference audio) belongs to the Ref2VA entry. The FL2VA entries refuse reference inputs up front, naming the partition. The partition is declared in the model config (video_partition) rather than detected.
ffmpeg is required on the host
Muxing the finished frames and audio into an MP4 needs ffmpeg on the host.
negative_prompt, cfg_scale and fps have no MiniMax-H3 equivalent: H3 has no negative prompt or CFG scale, and it renders at a fixed frame rate that the audio track is synchronised to.
Reference inputs
A MiniMax-H3 Ref2VA checkpoint (minimax-h3-ref2va-pruned-q4-ggml) takes several reference images, reference videos (each with an fps and an optional paired audio clip) and reference audio clips through ref_images, ref_videos and ref_audios. The single audio field counts as one more reference audio. Reference inputs need the Ref2VA checkpoint and cannot be mixed with start_image or end_image. A request accepts at most 16 entries of each kind and at most 512 frames per reference video. Reference audio must be WAV.
MiniMax-H3 troubleshooting
ffmpeg not found: install ffmpeg on the host. The frames and audio are already rendered; only the mux failed.
A reference image, clip or audio is refused by an FL2VA entry: use start_image for first-frame conditioning, or install the Ref2VA entry.
Text inside the frame comes out malformed: this is the model’s weakest area. Composite logos and signage in afterwards.
Error Responses
Status Code
Description
400
Missing or invalid model or request parameters
412
The selected backend cannot run on the available hardware
500
Backend error during video generation
3D Generation
LocalAI can generate textured 3D meshes from a single conditioning image via the /3d/generations endpoint, powered by the trellis2cpp backend, a C++/GGML port of Microsoft TRELLIS.2 (trellis2.cpp). The output is a binary glTF (.glb) asset with PBR materials.
Generation is image-conditioned only. There is no text-prompt path. Provide a photo or rendering of a single object (ideally on a plain background) and TRELLIS.2 reconstructs a full 3D mesh from it.
For text-conditioned animated skeletons, see 3D Animation. Both workflows appear under 3D in Studio; selecting a model changes the inputs and generation options.
Setup
Install a model from the gallery:
local-ai run trellis2-4b # full pipeline: 1024³ cascade + PBR textures (~18 GB)# orlocal-ai run trellis2-4b-geometry # 512³ untextured geometry only (~7 GB)
The backend detects which component GGUFs are present and degrades gracefully: without the texture models it produces untextured geometry, and without the fine-flow models it falls back to a coarse marching-cubes preview.
API
Method:POST
Endpoint:/3d/generations
Request
The request body is JSON with the following fields:
Parameter
Type
Required
Default
Description
model
string
Yes
Model name to use
image
string
Yes
Conditioning image as base64, a data URI, or a public URL
quality
string
No
auto
Mesh pipeline: auto, coarse, 512, or 1024
background
string
No
auto
Background handling: auto, keep, black, or white
step
int
No
12
Flow sampling steps for the shape
texture_steps
int
No
12
Flow sampling steps for the PBR material
cfg_scale
float
No
7.5
Classifier-free guidance scale
seed
int
No
random
Random seed for reproducibility
response_format
string
No
url
url to return a file URL, b64_json for base64 output
quality selects the mesh resolution: coarse is a fast marching-cubes preview, 512 the fine dual-grid mesh, 1024 the high-resolution cascade (slow: several minutes, roughly 10 GB VRAM), and auto picks the best pipeline the installed model set supports.
background controls solid-background removal on the conditioning image before generation: auto detects border-connected near-black/near-white, keep preserves the image alpha exactly, and black/white force removal of that colour.
Backend-specific params: texture_size (UV-atlas resolution hint when atlas baking is enabled) and components (tiny removes small islands, largest keeps only the biggest connected component, all (the default) keeps everything).
Response
Returns a JSON response using LocalAI’s OpenAI-style generation envelope:
Field
Type
Description
created
int
Unix timestamp of generation
id
string
Unique identifier (UUID)
data
array
Array with the generated asset
data[].url
string
URL path to the .glb under /generated-3d (if url)
data[].b64_json
string
Base64-encoded GLB (if response_format is b64_json)
Watertight print remeshing
POST /3d/remesh applies the same post-generation CGAL Alpha Wrap workflow as the trellis2.cpp demo. It accepts multipart/form-data and returns the remeshed GLB directly as model/gltf-binary:
Field
Type
Required
Default
Description
model
string
Yes
Installed TRELLIS.2 model name
mesh
file
Yes
Source GLB produced by TRELLIS.2
detail
float
No
0.5
Smallest preserved detail as a percentage of the source bounding-box diagonal (0.35–2.5)
There is intentionally no independent offset control. The enclosing offset follows the trellis2.cpp demo and is derived as detail / 30; independent tuning tends to produce puffy or degenerate wraps. Lower detail percentages retain finer features but take longer and generally produce more triangles. The output is watertight, oriented, intersection-free, and 2-manifold. For textured sources, LocalAI unwraps the replacement mesh and reprojects its PBR material onto a new UV atlas.
Source GLBs may be up to 512 MiB. This route uses its own upload limit because fine TRELLIS.2 meshes commonly exceed LocalAI’s default --upload-limit.
The response contains a URL such as /generated-3d/b64123456789.glb; fetch it from the same server. The GLB is standard glTF 2.0 and opens in Blender, three.js, <model-viewer>, and most engines.
The React UI includes a 3D tab in the Studio (and a /3d page) with an interactive PBR viewer: upload or paste an image from the clipboard, pick the quality, and preview the generated mesh with orbit/pan/zoom and a wireframe toggle. Past generations are kept in the browser (IndexedDB). After generation, a single Detail slider and Apply remeshing button replace the preview with the exact watertight model that the GLB download exports; Show original switches back without regenerating.
Notes
The 512³ pipeline takes roughly two minutes on a modern GPU; the 1024³ cascade takes around five minutes and needs about 10 GB VRAM plus a temporary host-RAM spike.
TRELLIS2_DEVICE=cpu forces CPU inference (slow; mainly for debugging).
The generated mesh has unoriented winding (faithful to TRELLIS.2) and is exported Y-up with vertex-PBR materials; a UV-atlas texture bake can be enabled in the backend via the T2GLB_XATLAS environment variable.
3D Animation
LocalAI supports text-to-motion with kimodo.cpp on CPU and Vulkan. In
Studio → 3D, selecting an animation model replaces the image input with a
motion prompt and the selected model’s animation controls.
The Studio preview plays at real-time speed using the GLB’s timestamps. Slow or
delayed display frames skip ahead rather than slowing the animation. Pause and
the timeline let you inspect individual poses; playback resumes from that point.
Kimodo exports an animated skeleton GLB: joint rotations and root movement,
without a mesh or skin. SOMA models produce the compact 30-joint skeleton;
G1 models produce 34 joints. These outputs are animation assets, not textured
characters, and cannot use TRELLIS print remeshing.
Setup and runtime options
Install kimodo-soma-rp, kimodo-soma-seed, kimodo-g1-rp, or
kimodo-g1-seed from the model gallery. For example:
local-ai run kimodo-soma-rp
Importing the corresponding LocalAI-io/Kimodo-*-GGML Hugging Face repository
also installs the motion weights and the shared Llama-3-Kimodo text bundle.
Each installation needs three files: the motion GGUF, a monolithic text-encoder
GGUF, and tokenizer.gguf. Text weights and the tokenizer are shared under
kimodo/text; SOMA and G1 do not download separate copies of the same encoder.
SMPL-X weights are not included
in the gallery because their redistribution terms differ.
The default entries use Q8_0, matching upstream’s performance default.
Other text-encoder quantizations are available through the -q6_k, -q5_k,
-q4_k_m, -q4_k, and -bf16 gallery entries, for example
kimodo-g1-rp-q4_k_m. Quantization affects the text encoder, not the F32 motion
weights. Lower-bit encoders reduce memory use but can change the generated motion.
These are explicit choices, not automatically ranked alternatives to Q8_0.
The model importer also accepts a text_quantization preference with q8_0
(default), q6_k, q5_k, q4_k_m, q4_k, or bf16. To change an existing
installation manually, download the selected encoder beside tokenizer.gguf
and update text_bundle to its GGUF path.
Linux has CPU and Vulkan builds on amd64 and arm64. Apple Silicon uses the
CPU build; this upstream engine does not implement Metal. Linux x86 CPU
packages select AVX2/FMA/F16C/BMI2 where supported, with a portable fallback.
Containers must expose the host GPU’s Vulkan ICD and driver libraries, not just
CUDA compute devices. On NVIDIA, enable graphics driver capabilities alongside
compute; on NixOS CDI installations, check that the NVIDIA Vulkan manifest is
also mounted inside the container.
An installed model can override the defaults in its YAML configuration:
device accepts auto, cpu, or vulkan; explicitly requesting unavailable
Vulkan fails rather than silently using CPU. threads applies to both the text
encoder and motion model. text_layer_chunk accepts 1–32 and defaults to 32:
all text-encoder layers stay resident across requests for maximum throughput.
Set it to 8 (or another smaller value) to load fewer layers at a time when
memory is limited. Full residency still executes bounded eight-layer graphs;
resident weight count and execution graph size are separate concerns.
The backend keeps one native session loaded and serializes generation. It
reuses text and motion weights, packed attention/LoRA paths, and upstream’s
cached motion execution graphs instead of reloading and rebuilding per request.
The graph cache is bounded to the most recent batch/frame shape. Cold loading
therefore takes longer than subsequent generations.
Allow memory for motion weights and execution buffers as well as the encoder.
BF16 text weights alone are about 14.1 GiB and should use a smaller
text_layer_chunk on a 16 GiB GPU. Each loaded motion model has its own native
session and resident memory, even when model files are shared on disk.
Upstream’s optional KIMODO_TEXT_RESIDENT_LIMIT_MIB environment variable can
also impose a residency ceiling; above it, a request for 32 layers uses streaming.
Existing text_bundle directory paths remain supported for legacy layer-file
installations. They also adopt the new 32-layer default unless explicitly
configured otherwise. Switching to monolithic weights does not delete the old
files; remove them only after confirming no model configuration still uses them.
API
POST /3d/animate accepts named, typed conditioning inputs and model-specific
parameters. Query /v1/models/capabilities and inspect three_d_operations
for the selected model’s supported inputs, controls, and defaults. Animation
does not universally require text: other backends may declare video or a
combination of mesh and text inputs.
{"model":"kimodo-soma-rp","inputs":{"prompt":{"type":"text","data":"A person walks forward and waves."}},"params":{"frames":"150","steps":"100","text_guidance":"2","seed":"42"},"response_format":"url"}
The response contains data[0].url for the generated .glb, or
data[0].b64_json when response_format is b64_json. The endpoint uses the
existing 3D Generation permission and the selected model’s access controls.
/3d/generations and /3d/remesh retain their existing mesh workflows.
Kimodo accepts one prompt with 60–150 frames at 30 FPS. The reference defaults
are 150 frames, 100 sampling steps, and text guidance 2. Parameters are strings;
unsupported inputs and parameters are rejected. Multi-prompt transitions and
mesh retargeting are not currently exposed by this adapter.
Request traces
With tracing enabled, POST /3d/animate appears on the
Traces page in both API and backend history. API traces include the JSON
request, response, HTTP status, duration, and any returned error. Sensitive
headers are redacted and body capture follows the configured size limit.
The backend trace includes the model and backend, text prompt, requested
parameters, model-loading time (load_ms), slot-waiting time (queue_ms),
inference time (inference_ms), output file size (output_bytes), and returned
metadata, including the usage breakdown. Parameters describe request overrides;
metadata.usage.details reports the effective frames and sampling steps.
Non-text inputs record their type and presence, without copying asset contents.
Trace strings follow the existing backend trace size limit.
A running backend entry appears before model loading begins. Completed entries
contain the details above; failures include the error and the stage that failed.
Total backend duration includes loading, waiting, and inference. Requests rejected
by endpoint validation have an API trace but no animation backend trace.
Usage accounting
Kimodo reports one set of usage measurements through generic backend metadata.
The gRPC Result has a metadata bytes field containing a JSON object; there is
no separate gRPC usage field or model-specific usage message.
Backend metadata
The JSON stored in Result.metadata looks like this:
usage is an application convention inside the generic metadata object.
Other metadata keys and model-specific details can be added without changing
the gRPC definitions or database schema.
For kimodo, input units are the tokens produced by its text encoder’s tokenizer,
including the beginning-of-sequence (BOS) token. Output units are actual generated
frames multiplied by effective sampling steps, after applying model defaults and
request overrides. In the example, 150 frames × 100 steps = 15,000 output units.
HTTP response and recorded usage
For POST /3d/animate, LocalAI returns the backend object under metadata.
Usage appears only at metadata.usage; there is no top-level usage summary.
The following is an excerpt from either a url or b64_json response:
Internal accounting reads metadata.usage directly and records each successful
request once. The existing token-named database columns store the unit counts:
Response metadata
Usage record column
metadata.usage.input_units
PromptTokens
metadata.usage.output_units
CompletionTokens
Sum of input and output units
TotalTokens
The record’s single Metadata column retains the complete backend JSON,
including the rule and frame/step breakdown. With statistics disabled, response
metadata is still returned but no usage record is created.
Both unit counts must be present, nonnegative integers whose sum fits a Go int.
Explicit zero counts are valid. If metadata is absent, the response omits
metadata. Metadata without a usage member is returned, but creates no usage
record. Malformed metadata or invalid usage counts cause metadata to be omitted
and a warning to be logged; the generated asset is still returned. Failed
generations produce no usage record. Counts are never estimated for backends
that do not report them.
Pricing units
Kimodo’s output units are frame-steps, not text tokens. They approximate
computational work rather than runtime or hardware cost. A price per million
output tokens therefore means dollars per million frame-steps for this model:
This describes how to interpret the existing token-based pricing dimensions;
it does not set a price or charge money automatically.
Motion Capture
LocalAI’s gemxcpp backend converts timestamped RGB frames into human poses
using gem-x.cpp. It runs resident
GEM-X, ViTPose and YOLOX models on CPU or Vulkan. Live inference does not need
SAM3D Body. This initial integration is API-only: no Motion UI, offline clip
export, body mesh or SONIC controller is included.
Install and configure
Import https://huggingface.co/LocalAI-io/GEM-X-GGUF through the model importer.
It selects gemxcpp and downloads three checksummed, revision-pinned assets.
These are custom F32 GGUF architectures, not language models. Weight licenses
are described in the source model card. Allow memory for all three models and
execution buffers, beyond their roughly 4 GB combined download size.
Equivalent configuration with existing local files:
Additional options: device:cpu or device:vulkan, and device_index:0.
Without device, the package selects CPU or Vulkan according to its build.
Darwin uses CPU; Metal inference is not supported. Explicit unavailable devices
fail rather than silently falling back. Threads are capped at eight.
window accepts 2–120 observations; detector_interval accepts 1–30 processed
frames. Larger detector intervals reuse the previous crop and may miss movement
or person loss until the next detection. selection:continuity conservatively
associates one unique box; loss/ambiguity clears history. selection:parity
uses upstream’s largest detection/full-image fallback and makes no identity
continuity guarantee. Neither mode is person re-identification.
precision:strict is the default. The launcher fixes GGML Vulkan precision
flags before initialization. precision:backend_default opts out of strict
validation, without promising a faster path. The same F32 model files are used.
Sessions
All endpoints use standard LocalAI authentication, the Motion Capture feature
permission and model access controls. Sessions belong to their creating user.
When authentication is disabled, sessions share the unauthenticated principal.
Legacy admin keys have the existing shared legacy-admin identity.
The response is HTTP 201 with id, model, profile, time_origin and counters.
profile defaults to soma77; time_origin is required (1–128 characters).
A session owns its model’s native temporal state. Only one session per model
is admitted, with up to 16 sessions per frontend and one duplex connection per
session. Additional model configurations consume independent model memory.
Endpoint
Purpose
POST /api/motion/sessions
Create and load a session
GET /api/motion/sessions/{id}
Read frame/pose/drop counters
DELETE /api/motion/sessions/{id}
Cancel and release a session
GET /api/motion/sessions/{id}/poses
Exchange frames and poses over a duplex WebSocket
POST /api/motion/sessions/{id}/tickets
Issue a single-use browser WebSocket ticket
Sessions expire after two minutes without frame activity. Inference also
has a two-minute timeout; initial model loading has a five-minute stream wait
limit, subject to the loader’s own cancellation behavior. Native inference is
synchronous and cannot be interrupted mid-call. Closing stops new work and
discards late results; native cleanup completes after the current call returns.
Session state lives in one frontend process. Use sticky routing for all session
requests in multi-frontend deployments. Backend streaming uses the existing
model loader and keeps its selected gRPC connection for the session. There is
no session migration or recovery after frontend/backend restart.
Duplex frame transport (v2)
The browser negotiates localai.motion.v2 on the existing ticket-authenticated
/poses socket. It sends uncompressed binary protobuf Input.frame and receives
binary Output messages. HTTP remains for discovery, session creation, tickets
and deletion. There is no HTTP frame fallback. The protobuf package remains v1;
the v2 name versions the duplex transport and flow protocol.
Definition precedes a JSON flow hello. Each flow message has type: "flow",
version: 2, a consecutive integer id, release containing decimal sequence
strings, window_frames, max_pending_bytes, max_frame_bytes,
processing_ewma_ms, recommended_fps, queued_frames, queued_bytes,
oldest_age_ms, pressure and cumulative dropped_frames. A completed frame
also has completed_sequence and completed_kind (pose or event). Its binary
output is written before its release; discarded inputs have release only.
While connected, every completed or dropped capture is retired once, and pose identity retains source time.
The initial window is two frames, with zero recommended FPS meaning camera-paced
subject to credits. After a service sample the window is eight. Service EWMA uses
alpha 0.2 and a 1ms floor; normal offered rate is 1.05/service, pressure rate is
0.9/service. Clients should gate capture before canvas/RGB allocation on credits,
outstanding bytes, pacing and prospective WebSocket upload backlog. A recommended
upload backlog limit is two frame sizes or 2MiB, whichever is smaller. Prefer fresh
camera callbacks over a fixed capture timer or a local RGB FIFO. Camera/upload
speed can limit the achieved rate. These are recommendations for external clients;
LocalAI does not include a browser capture client or enforce client-side pacing.
LocalAI uses one reader, one inference worker and one writer. Pending input is
bounded to eight frames/8MiB with a 2MiB encoded frame limit. At six frames or
6MiB, thinning retains half the pending frames nearest evenly spaced source-time
targets across oldest/newest (earlier ties; one survivor means newest). Active
inference is never thinned. Inputs older than 250ms since server admission expire
before enqueue/dispatch. Pressure clears once pending depth is at most two.
The 8MiB pending limit is not a total process-memory claim: encoded/decoded
active and reader payloads add up to approximately another 6MiB, excluding runtime,
protobuf and transport overhead. The writer queue holds at most eight messages;
writes time out at five seconds. External clients should also detect stalled
feedback; a five-second timeout is recommended.
A connection exclusively owns ingress: a second connection receives HTTP 409.
Only localai.motion.v2 is accepted; missing or read-only subprotocols receive HTTP 400. The socket accepts
frames only; reset/camera/model changes require a new session. Disconnect cancels
transport, discards pending input and joins workers before releasing ownership;
this does not preempt an executing native GPU kernel. Only processed frames enter
existing motion_frames_v1 accounting; dropped frames are not billed. Session
summaries expose upload accepted/dropped counts; ingress metrics distinguish
accepted, thinned and expired outcomes. Upload drop counts exclude pending/active
inputs disposed by disconnect; disconnect clears all browser credits. No per-frame content or credentials are logged.
Frame schema and authentication
The authoritative schema is pkg/motion/proto/motion.proto in the LocalAI
repository, package localai.motion.v1. Generate client bindings from that file;
clients do not need LocalAI’s internal backend protocol. Numeric arrays are
packed float32, joint-major then component. JavaScript clients must retain
64-bit sequence/timestamp fields as BigInt or their Protobuf library’s integer
representation, not lossy JavaScript numbers for arbitrarily large values.
Create the session through HTTP JSON.
Connect to /api/motion/sessions/{id}/poses over ws:// or wss://,
requesting subprotocol localai.motion.v2. Native clients can use Bearer
authentication; browsers use their authenticated same-origin session cookie.
Successfully validated Authorization, x-api-key or xi-api-key header
credentials bypass the WebSocket origin check. Invalid or unvalidated headers
do not; cookie-only authentication still follows the origin policy. Standard
browser WebSocket APIs cannot set these headers, so browser clients using
cookies need an explicit CORS policy: set LOCALAI_CORS=true
and LOCALAI_CORS_ALLOW_ORIGINS=https://consumer.example,http://localhost:3000.
This explicit origin policy also permits cross-site session creation, tickets
and deletion through CSRF protection. Authentication and permissions
still apply. Allowed origins use the HTTP CORS matching rules, including explicitly
configured wildcards. Without an explicit policy or validated header credentials,
sockets remain same-origin even though HTTP uses a permissive default. Native clients without an Origin
header are supported. Origin approval does not bypass authentication or session
ownership; browser cookie availability still depends on cookie and browser
policies. Credentials are not URL parameters.
Read the first binary message as Output.definition. It declares joint order,
parents, rest transforms, coordinate conventions, profile and available channels.
The definition is sent once per session connection. A disconnect ends the session;
create a new session before reconnecting.
Send serialized Input.frame messages as binary WebSocket messages, following
the flow credits described above. A frame contains tightly packed RGB8
bytes, width/height, sequence, source microseconds and optional subject box/ID.
Subject boxes use inclusive source pixel XYXY coordinates, bounded by
[0, width-1] and [0, height-1]. Frames must be at least 8 pixels per side, at most 32766 per side and at most
16 million pixels. RGB byte length must equal width × height × 3. The stricter
2MiB encoded-message limit also applies to every upload.
Read Output.pose or Output.event, followed by the JSON completion release.
The first usable observation produces warmup; at least two are needed for a pose.
Invalid frames, replayed sequences and non-increasing timestamps close the
connection without submitting that input to the backend. Source timestamps are
nonnegative microseconds relative to the declared origin and must strictly
increase, as must sequence numbers. Gaps in sequence numbers are allowed.
Create a new session before seeking backward, explicitly resetting or changing
cameras. Long source gaps, changed dimensions or a changed caller-selected
subject reset native context; poses/events carry the new epoch and reset flag.
Intrinsics follow upstream’s image-centre/max-dimension approximation;
calibrated cameras are not supported by this ABI.
The model uses accepted-frame indices, not time-aware irregular sampling. Source
timestamps are preserved, not replaced by receive times or an invented FPS.
Consumers own resampling and clock alignment. Local processing durations do not
measure capture-to-consumer latency.
Pose and lifecycle outputs are delivered in order through the bounded writer
queue. A stalled reader eventually causes a write timeout and session closure;
outputs are not replaced by newer poses. WebSocket uses TCP, so already-buffered
bytes cannot be retracted. Reconnecting requires a new session; there is no
history replay.
Browser WebSocket tickets
Browsers cannot set Authorization on a native WebSocket constructor. After
creating a motion session, exchange your normal credentials for a ticket:
Cookie-authenticated clients can use credentials: "include" instead of the
Authorization header, subject to browser cookie policy. The ticket endpoint uses
normal authentication, Motion feature permission, model access and session
ownership checks. Its JSON response is HTTP 201 with ticket and expires_at,
and Cache-Control: no-store. When auth is disabled, tickets retain the existing
anonymous access policy; they do not create a user or grant additional access.
Tickets expire after 30 seconds, are single use, and are bound to the
exact browser origin and session’s pose WebSocket path. If the HTTP request has
an Origin header, it must match the requested origin. A reconnect requires a new
session and ticket. Redemption consumes the ticket before authentication/upgrade; even a
failed matching upgrade requires a fresh ticket. The original credentials are
revalidated, so revoked keys or sessions cannot redeem outstanding tickets.
Feature, model and ownership permissions are checked again. Successfully redeemed
tickets authorize the bound origin without requiring browser cookie delivery.
The server selects only localai.motion.v2; it never echoes the ticket protocol.
Tickets belong in the protocol list, not in the URL or query string. LocalAI
strips them before upgrade and redacts the protocol header from API traces.
Configure external proxies and request loggers to redact Sec-WebSocket-Protocol
as well. Ticket responses must not be cached or logged.
There are at most 32 outstanding tickets per user (shared for anonymous/legacy
identities) and 4096 per frontend; issuance returns 429 at capacity. Closing a
session revokes its outstanding tickets. The in-memory store is shared by ticket
issuance and upgrade on one frontend; both requests need sticky routing. Restart
invalidates all outstanding tickets. Ticket expiry limits the handshake window,
not the lifetime of an established connection. Ticket requests do not add frame
usage. This first integration supports motion; other WebSocket endpoints do not
yet issue tickets.
Output profiles
soma77: 77 joints, metres, right-handed native SOMA Y-up. Positions have pelvis
translation removed only; root rotation is retained. Local rotations are XYZW;
local translations vary with the emitted frame’s identity/scale. Root axis-angle
is in radians. Root translation is zero: this is not a continuous world trajectory.
smpl24: upstream-validated SOMA-to-SMPL mapping; 24 joint positions with pelvis
translation and anchor rotation removed. The separate anchor is a unit WXYZ
quaternion in the upstream Z-up/base-rotation convention. It reconstructs the
mapped, gravity-aligned points from root-local positions. No SMPL joint rotations,
mesh parameters, physical-base alignment or robot wrist commands are fabricated.
Definitions distinguish neutral reference transforms from per-frame shape.
Quaternions use upstream’s canonical nonnegative-w policy, not temporal sign
smoothing; consumers interpolating rotations should handle equivalent signs.
Events include warmup, lost, ambiguous and reset. Frame flags identify
reset (1), reused crop (2), full-image fallback (4), detector execution (8) and
caller box (16). Track epochs mark acquisitions; automatic parity mode uses
track epoch zero without asserting identity continuity. No 3D confidence is
advertised. Consumers must detect stale streams and choose their own hold,
interpolation or stop behavior.
An external SONIC consumer can request SMPL-24, buffer timed poses and construct
its policy-specific reference windows. LocalAI does not execute that policy,
align references to physical robot state, or run physics.
Observability
With metrics enabled, the existing /metrics exporter includes:
localai_motion_sessions: active sessions.
localai_motion_frames: processed frame outcomes.
localai_motion_uploads: accepted, thinned and expired input frames.
localai_motion_resets: explicit or native context resets.
localai_motion_stage_duration_seconds: detector, ViTPose, GEM and skeleton
construction stage durations from the native pipeline.
Prometheus may append standard counter/unit suffixes. Labels use model/backend,
finite outcome names and fixed stage names, never session IDs or person IDs.
Frame/pose/drop totals are also available through session status.
Frame submissions also use the shared usage accounting pipeline, like animation
requests. Each successfully processed frame records input_units: 1; a pose
records output_units: 1, while warmup, lost and ambiguous outcomes record zero
output units. Records retain accounting_rule: "motion_frames_v1" in their usage
metadata. The existing usage dashboard, storage and billing metrics expose these
units through their legacy prompt/completion/total token fields; they represent
frames, not text tokens. Configure any model pricing in those units.
Accounting happens once per successfully processed WebSocket frame, before
socket delivery. Rejected or dropped inputs and failed inference do not record
usage. Session creation/status/deletion, tickets and WebSocket upgrades do not
record usage either. Shared statistics can be disabled through the existing
statistics configuration.
With backend tracing enabled, a motion trace spans the session and records its
profile, duration, termination reason and counts. Model-load failures use the
existing model-load traces. Logs record lifecycle changes. Images, pose arrays,
credentials and private model paths are not included in motion session traces.
Webcam pose overlays
GEM-X pose messages optionally include image_positions (Protobuf field 13):
packed source-image pixel XY pairs in Definition.joint_names order (48 values for
SMPL24, 154 for SOMA77). The definition advertises the channel and convention
source-pixel xy, joint_names order, top-left origin, unmirrored. Coordinates
reference the exact submitted RGB Frame identified by the pose sequence/timestamp;
use that frame’s width/height, then scale/letterbox with the displayed image. They
are neither normalized crop coordinates nor confidence scores. No image mirroring
is applied. Pixels can fall outside the source image; clients should clip drawing.
The backend projects GEM-X’s emitted camera-space skeleton plus its camera
translation using the native live API’s actual intrinsics: focal length
max(width,height) and image-centre principal point. SMPL uses the mapping from
that native definition, not a hard-coded substitute skeleton. If a joint has
nonpositive depth or projection is nonfinite the optional channel is empty; root
local control data remains separate. Older servers may omit the channel. Do not
invent an image-aligned overlay from root-local positions, anchor or bounding box.
Optional live root displacement
The GEM-X SMPL stream advertises root_displacement only when its native library
supports channel 14. It contains three metres-per-interval components in the
end pose’s anchor-local basis, not velocity or absolute world position. Rotate
by the end pose’s WXYZ anchor for gravity-aligned Z-up displacement. The closed
interval is [displacement_start_time_us, source_time_us], between consecutive
frames actually processed by GEM-X (including its warmup observation).
This uses the last two decoded world translations inside one rolling window;
it does not subtract absolute translations from separate windows. The current
frame’s unobserved next-interval prediction is not emitted. root_translation
remains zero for compatibility. Older native libraries omit the new channel.
Consumers must establish a baseline after an epoch/track change, reset, missing
interval or reconnect; they must not add a delta across those boundaries. A
dropped input changes the model’s accepted-frame spacing: these estimates are
not time-normalized or contact-refined, and integration can drift. Robot/world
placement is a separate consumer-owned transform and need not reset on tracking
loss. Model-backed checks cover interval boundaries and coordinate-basis
consistency; they do not establish trajectory accuracy against ground truth.
Setting Up Models
This section covers everything you need to know about installing and configuring models in LocalAI. You’ll learn multiple methods to get models running.
Prerequisites
LocalAI installed and running (see Quickstart if you haven’t set it up yet)
Basic understanding of command line usage
Method 1: Using the Model Gallery (Easiest)
The Model Gallery is the simplest way to install models. It provides pre-configured models ready to use.
GPU recommendations require a memory estimate within 95% of the detected model memory budget at a 4096-token context. If none of the sampled candidates fit, the recommendation section is hidden. You can still browse the gallery and check individual models at your intended context size. On the Models page the recommendations appear as a “Best for this machine” list in the pane beside the table while no model is selected. Once you have installed a model, the list shows only the best fit and offers the others behind “more that fit”. The Home page also omits static GPU suggestions when no fitting recommendation is available.
Via WebUI
Open the LocalAI WebUI at http://localhost:8080
Navigate to Models → Explore
Browse or search the available models
Click “Install” on any model you want
Wait for installation to complete. Progress appears in the strip at the top
of the app, and Admin → Activity shows every install in flight, plus
what failed and what finished (see Activity)
The same Models page owns the complete lifecycle. Switch to Installed to
search local configurations, filter them by running, idle, disabled, pinned,
or distributed state, and open a model’s runtime controls. Load and stop are on
each row; edit, pin, disable, backend logs, and remove are in the row menu and in
the details of the selected model. The current view, search, filter, and
selection are stored in the URL so links and browser history preserve your place.
The disk strip in the page header shows the free space on the models disk and
opens a review of what can be removed to free more (see
Model gallery).
Via CLI
# List available modelslocal-ai models list
# Install a specific modellocal-ai models install llama-3.2-1b-instruct:q4_k_m
# Start LocalAI with a model from the gallerylocal-ai run llama-3.2-1b-instruct:q4_k_m
To run models available in the LocalAI gallery, you can use the model name as the URI. For example, to run LocalAI with the Gemma 4 E2B model, execute:
local-ai run gemma-4-e2b-it-qat-q4_0
To install only the model, use:
local-ai models install gemma-4-e2b-it-qat-q4_0
Note: The galleries available in LocalAI can be customized to point to a different URL or a local directory. For more information on how to setup your own gallery, see the Gallery Documentation.
Browse Online
Open the Models page of the web interface (for example http://localhost:8080) to browse all available models in your browser. You can also run local-ai models list, or read the gallery index on GitHub.
On a phone, the model page wraps build descriptions in the Variants table
to keep the fit status and install buttons visible.
Method 1.5: Import Models via WebUI
The WebUI import page (Models → Import Model, or Import Model when you add a model) takes either a source to resolve or a
configuration to write. Both live on the same page, behind the two tabs in its
header. From a source, it is a short guided flow: source, review, import, done.
From a source
Open the LocalAI WebUI at http://localhost:8080
Open Models, then Import Model (the page that adds a model, Add Model, has the same button)
Paste the source into the Source field (e.g. https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct-GGUF), or start from one of the examples
Review what the page says, then press Enter or click Import
While you type, the page reads the spelling of the source (Hugging Face
repository, direct URL, configuration file, OCI image, Ollama model, or a path
on the host) and shows the request the form will send. It also runs the checks
that can be made before the import starts: whether the name is already in use,
whether the chosen backend is installed, and how much disk and memory are free.
The server returns no preview of the model configuration, the size or the memory
a model needs before the import starts, so the page does not show them. They
appear once the import starts, next to the free memory and disk.
The What you can paste panel beside the field lists every accepted scheme:
huggingface://, hf://, a full Hugging Face URL, any direct https:// URL,
file:// and absolute paths on the host, oci://, ocifile://, and
ollama://.
Expand Advanced options directly below the request preview to override settings before importing.
The controls include backend, name, description, quantizations, MMProj quantizations,
model type, embeddings support, the diffusers-specific fields, and arbitrary
custom key-value preferences. The backend list can be narrowed by modality
first. Fields that the selected backend cannot use are hidden, and anything you
typed into them is kept in case you switch back.
What a GGUF repository import picks
When the source is a Hugging Face repository with GGUF files, the llama.cpp
importer chooses the files from the listing. The same choices apply to
POST /models/import-uri, where the preferences go in the preferences object.
Preference
Default
Effect
quantizations
q4_k_m
Comma-separated quantizations of the main model, best first. A token must match whole: f16 does not select bf16. When none matches, the last model in the listing is used.
mmproj_quantizations
f16, then bf16
Comma-separated quantizations of the vision or audio projector, tried before the default order f16, bf16, q8_0, f32. f32 is chosen only when no smaller build exists.
drafter_quantizations
q8_0, then bf16, f16
Comma-separated quantizations of the speculative-decoding drafter, tried before the default order. Set none (or off, no, false) to import no drafter.
Files that llama.cpp ships next to a model are never imported as the model
itself: drafters (a file name with dspark-, dflash-, eagle3- or mtp-, the
sidecar keywords of llama.cpp) and imatrix files.
When the repository ships a drafter, the import downloads one next to the
model and writes draft_model and the matching spec_type into the model
configuration: draft-dspark with spec_n_max:3 for a dspark- file,
draft-dflash for dflash-, draft-eagle3 for eagle3- and draft-mtp for
mtp-. If a repository has several kinds, the order of preference is DSpark,
DFlash, EAGLE3, then MTP. A drafter is paired only with a model from the same
repository, and only on the llama-cpp backend. The import form has no field
for drafter_quantizations; add it with a custom preference.
The source format check does not contact the source or validate it as a model.
An HTTPS URL can point to a web page rather than model weights.
Leaving the backend on auto-detect lets LocalAI choose from the source.
Selecting a backend sends an explicit backend preference in the previewed request. If more
than one installed backend can serve the detected modality, the page says so
and offers the candidates inline. Picking one resubmits the import.
Repositories under mlx-community are imported with the native MLX backend.
LocalAI uses Hugging Face’s pipeline metadata to select mlx-vlm for
vision-language models and mlx-audio for text-to-speech models; other MLX
repositories use mlx. An explicit backend selection in the import form always
overrides this automatic routing.
Once the import starts, the page reports the download size and the memory the
model needs against what is free, then the current phase, the bytes transferred
and a progress bar. When the model is ready, the page names it and links to a
chat with it and to Models.
Writing YAML
For full control over model configuration, switch to the Write YAML tab and
edit the configuration directly, then click Create. The editor provides
syntax highlighting and a copy button, and accepts the same configuration keys
documented under Advanced.
This is especially useful for:
Custom model configurations
Fine-tuning model parameters
Setting up complex model setups
Editing existing model configurations
When the configuration references remote assets, Create does not
download them inside the request: the import is queued like a gallery
installation, and the page reports the job’s progress until the model is
ready. These configurations are queued:
a URL in parameters.model or mmproj, or download_files entries;
an hf:// reference or a bare owner/repo in parameters.model, on a
backend that consumes a model directory;
an explicit artifacts: block. The configuration file is written once every download
has finished, so a failed download never leaves a config pointing at
files that do not exist. A configuration that only references files
already on disk is written immediately, as before.
A queued import runs through the same installer as a gallery
installation, so it differs from an immediate write in two ways:
Recommended sampling parameters for the model family (for example
temperature and top_p) are added under parameters: when the
configuration does not set them. The immediate write stores your
configuration exactly as posted.
When automatic backend installation is enabled, the backend named in the
configuration is installed as part of the job.
Set the parameters you care about explicitly if you need the same stored
file in both cases.
The same split applies to the API behind the page: POST /models/import
answers a queued import with a job id and a status URL to poll
(/models/jobs/{id}; the same shape gallery installs use), and a
download-free import with a plain success response.
If you cancel a queued import, the import page and model editor report the
cancellation and stay on the current page. They report success only after the
job succeeds.
Method 2: Installing from Hugging Face
LocalAI can directly install models from Hugging Face:
# Install and run a model from Hugging Facelocal-ai run huggingface://TheBloke/phi-2-GGUF
The format is: huggingface://<repository>/<model-file> ( is optional)
Examples
local-ai run huggingface://TheBloke/phi-2-GGUF/phi-2.Q8_0.gguf
Method 3: Installing from OCI Registries
Ollama Registry
local-ai run ollama://gemma:2b
An ollama:// import works like this:
The model must be a GGUF file. LocalAI reads the first bytes of the weights before the download and again after it, and refuses anything else with “this model is not a GGUF file”.
The model name is <name>-<tag>, so ollama://qwen3:8b becomes qwen3-8b. A library/ prefix is dropped, a user/model:tag model becomes user-model-tag, and the tag latest adds nothing to the name. The weights are saved as <name>.gguf.
The sampling defaults the model’s author published (temperature, top_k, top_p, min_p, repeat_penalty, seed, num_predict as max_tokens, and stop as stopwords) become the defaults of the model. Other keys, including num_ctx, are ignored. The import preferences temperature, top_k, top_p, min_p, repeat_penalty, seed, max_tokens and stopwords take priority over them.
A vision model’s projector is downloaded as a second file, <name>-mmproj.gguf, and set as mmproj.
The chat template stays the one inside the GGUF file. LocalAI does not import the Ollama template, system prompt or license.
A model or tag that does not exist, or a manifest without model weights, fails the import with an error that names the model.
Standard OCI Registry
local-ai run oci://localai/phi-2:latest
Note
On every model download (Ollama and OCI registries, the model gallery, and plain HTTP(S) file URLs alike) LocalAI identifies itself with a LocalAI/<version> (<os>; <arch>)User-Agent header (for example LocalAI/v3.2.1 (linux; amd64)) so registry and gallery operators can attribute usage to LocalAI. Builds from source that carry no stamped version send LocalAI (<os>; <arch>) instead.
Run Models via URI
To run models via URI, specify a URI to a model file or a configuration file when starting LocalAI. Valid syntax includes:
file://path/to/model (absolute path to a file within your models directory)
From OCIs: oci://container_image:tag, ollama://model_id:tag
Over BitTorrent: pirateface://owner/repo[/file], a magnet: link, or a .torrent file (see Download over BitTorrent)
From configuration files: https://gist.githubusercontent.com/.../phi-2.yaml
Note
When using file:// URLs, the path must point to a file within your models directory (specified by MODELS_PATH). Files outside this directory are rejected for security reasons.
Every blob that LocalAI downloads from an OCI or Ollama registry is checked against its sha256 digest and size. A download that fails the check, or fails for any other reason, leaves no partial file behind.
Configuration files can be used to customize the model defaults and settings. For advanced configurations, refer to the Customize Models section.
Examples
local-ai run huggingface://TheBloke/phi-2-GGUF/phi-2.Q8_0.gguf
local-ai run ollama://gemma:2b
local-ai run https://gist.githubusercontent.com/.../phi-2.yaml
local-ai run oci://localai/phi-2:latest
local-ai run pirateface://TheBloke/phi-2-GGUF/phi-2.Q8_0.gguf
Download over BitTorrent
LocalAI can download a model file with BitTorrent. The same URIs work wherever huggingface:// works: on the command line, in the uri of a files: entry, in a gallery entry, and in the import form.
URI
Meaning
pirateface://<owner>/<repo>/<file>
One file of a model that Pirate Face lists. LocalAI asks the Pirate Face index for the magnet link, the .torrent file and the file’s SHA-256.
pirateface://<owner>/<repo>
A whole model. Only the import form and local-ai run accept it, because they choose the files to install.
https://pirateface.co/<owner>/<repo>
The model page. Paste it in the import form, or give it to local-ai run: LocalAI lists the files and imports the model like a Hugging Face repository.
magnet:?xt=urn:btih:...
Any magnet link. It does not need a tracker or a web seed.
Pirate Face is an index. It does not host files: the files come from BitTorrent peers and from a web seed that Pirate Face runs in front of Hugging Face. A model with a licence gate shows no magnet link until you accept its terms on the Pirate Face site, and LocalAI does not go around that.
Choose a file in a torrent with several files. One URI downloads one file. Add #<path in the torrent> to a magnet link or .torrent URI, or write one files: entry per file:
If you give no selector, LocalAI uses the only file of a single-file torrent. Otherwise it looks for the filename of the entry in the torrent, by path and then by base name, and stops with an error that lists the files when it cannot decide. A BEP 53 so= parameter that names one file also works. LocalAI downloads only the chosen file and refuses a torrent whose file names would leave the target directory.
Integrity. The BitTorrent piece hashes always protect the transfer. For a pirateface:// URI, LocalAI also checks the SHA-256 from the index. For any other magnet or .torrent, add sha256: to the files: entry. Without it, only the piece hashes vouch for the file, and a warning goes to the log.
Network behaviour. Downloads use BitTorrent web seeds and peers at the same time. The web seed starts at once; peers join when found. By default LocalAI opens no port for the network: it accepts no incoming peer connection, uses no DHT, and asks no router to forward a port. It stops sharing when the file is complete.
Flag
Environment variable
Default
Effect
--torrent-mode
LOCALAI_TORRENT_MODE
swarm
swarm: web seeds and peers. webseed: web seeds only. Opens no socket and contacts no tracker or peer, so it behaves like an HTTP download that checks the torrent’s piece hashes.
--torrent-listen-port
LOCALAI_TORRENT_LISTEN_PORT
0
A port above 0 listens on all interfaces and lets LocalAI ask the router (UPnP, NAT-PMP) to forward it.
--torrent-dht
LOCALAI_TORRENT_DHT
off
Find peers with the DHT. This opens a UDP socket. Use it for magnet links that name no tracker.
--torrent-metadata-timeout
LOCALAI_TORRENT_METADATA_TIMEOUT
90s
How long to wait for peers to send the file list of a magnet link that has no .torrent file. The error says that no peers were found.
--torrent-fallback
LOCALAI_TORRENT_FALLBACK
on
If a Pirate Face download fails over BitTorrent, download the same file from Hugging Face, at the revision Pirate Face lists.
--pirateface-url
LOCALAI_PIRATEFACE_URL
https://pirateface.co
The index to ask.
A magnet link or .torrent file that does not come from Pirate Face has no Hugging Face file behind it, so there is no fallback: if no peer answers, the download fails. A magnet link with no .torrent file needs swarm mode, because only peers can send the file list. Downloads resume: LocalAI keeps the .partial file and checks again which pieces it already has.
Method 4: Manual Installation
For full control, you can manually download and configure models.
Customize model defaults and settings with a configuration file. For advanced configurations, refer to the Advanced Documentation.
Step 3: Run LocalAI
Choose one of the following methods to run LocalAI:
Create the models and data folders as your own user before you start the container. When you own both folders, LocalAI runs as your user, and the files stay yours on the host. See Container user and permissions.
mkdir -p models data
cp your-model.gguf models/
docker run -p 8080:8080 -v "$PWD/models:/models" -v "$PWD/data:/data" -ti --rm localai/localai:latest --models-path /models --context-size 700 --threads 4curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d '{
"model": "your-model.gguf",
"prompt": "A long time ago in a galaxy far, far away",
"temperature": 0.7
}'
If running on Apple Silicon (ARM), it is not recommended to run on Docker due to emulation. Follow the build instructions to use Metal acceleration for full GPU support.
If you are running on Apple x86_64, you can use Docker without additional gain from building it from source.
Download the compose file and create the folders for the bind mounts:
In docker-compose.yaml, replace the four named volumes with the four bind-mount lines from the comments (./models:/models and the others). Then copy the model and start LocalAI:
cp your-model.gguf models/
docker compose up -d
curl http://localhost:8080/v1/models
curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d '{
"model": "your-model.gguf",
"prompt": "A long time ago in a galaxy far, far away",
"temperature": 0.7
}'
Ollama clients can list configured models with GET /api/tags and loaded models with GET /api/ps. Each entry includes size in bytes when LocalAI can resolve a non-empty primary weights file on disk. This is the size of that file, not the total size of a multi-file model or its memory use. Unknown sizes are omitted; /api/ps also omits size_vram because per-model VRAM use is not available.
# Via APIcurl http://localhost:8080/v1/models
# Via CLIlocal-ai models list
Disk Usage
In the WebUI, the Installed tab of Models shows how much disk each
installed configuration uses. The Size column holds the size on disk, and
for a model that shares files with others it adds the shared part (“1.2 GB
shared”). A file referenced by more than one configuration is counted once in
the total under the table, which also gives the shared total. The inspector
beside the table names the models a model shares files with, and a model page
lists its files under Usage and history, with each file’s size, the other
models that use it, and whether it is missing. Removing a model frees only its
exclusive files; the files it shares stay while another configuration uses
them. A reference whose file is not on disk (a download that never finished, or
a file removed by hand) is marked on the model and in the cleanup review.
Only an admin can read the report. For anyone else, or if the read fails, the
Size column shows the size of the files the gallery lists, and “size unknown”
for a model the gallery does not list.
The report behind these views is available directly (admin only):
curl http://localhost:8080/api/models/storage
It returns per-model sizes with the shared portion split out, the
file-to-models relation, and missing references. Files in the models directory
that no configuration references are not included.
Update a Model
LocalAI checks every six hours whether the gallery entry of an installed model
changed, and tells you on the Updates page and in the notification center.
It never upgrades a model by itself. See Model Updates
for the states, the upgrade steps and the rollback.
Remove Models
Simply delete the model file and configuration from your models directory:
rm models/model-name.gguf
rm models/model-name.yaml # if exists
Troubleshooting
Model Not Loading
Check backend: Ensure the required backend is installed
local-ai backends list
local-ai backends install llama-cpp # if needed
Check logs: Enable debug mode
DEBUG=true local-ai
Verify file: Ensure the model file is not corrupted
Out of Memory
Use a smaller quantization (Q4_K_S or Q2_K)
Reduce context_size in configuration
Close other applications to free RAM
Wrong Backend
Check the Compatibility Table to ensure you’re using the correct backend for your model.
Best Practices
Start small: Begin with smaller models to test your setup
Use quantized models: Q4_K_M is a good balance for most use cases
Organize models: Keep your models directory organized
Backup configurations: Save your YAML configurations
Monitor resources: Watch RAM and disk usage
Advanced usage
Model Configuration with YAML Files
LocalAI uses YAML configuration files to define model parameters, templates, and behavior. You can create individual YAML files in the models directory or use a single configuration file with multiple models.
You can use a default template for every model present in your model path, by creating a corresponding file with the `.tmpl` suffix next to your model. For instance, if the model is called `foo.bin`, you can create a sibling file, `foo.bin.tmpl` which will be used as a default prompt and can be used with alpaca:
The below instruction describes a task. Write a response that appropriately completes the request.
### Instruction:
{{.Input}}
### Response:
See the prompt-templates directory in this repository for templates for some of the most popular models.
For the edit endpoint, an example template for alpaca-based models can be:
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.### Instruction:{{.Instruction}}### Input:{{.Input}}### Response:
Install models using the API
Instead of installing models manually, you can use the LocalAI API endpoints and a model definition to install programmatically via API models in runtime.
A curated collection of model files is in the model-gallery. The files of the model gallery are different from the model files used to configure LocalAI models. The model gallery files contains information about the model setup, and the files necessary to run the model locally.
To install for example lunademo, you can send a POST call to the /models/apply endpoint with the model definition url (url) and the name of the model should have in LocalAI (name, optional):
PRELOAD_MODELS (or --preload-models) takes a list in JSON with the same parameter of the API calls of the /models/apply endpoint.
Similarly it can be specified a path to a YAML configuration file containing a list of models with PRELOAD_MODELS_CONFIG ( or --preload-models-config ):
LocalAI can automatically cache prompts for faster loading of the prompt. This can be useful if your model need a prompt template with prefixed text in the prompt before the input.
To enable prompt caching, you can control the settings in the model config YAML file:
prompt_cache_path:"cache"prompt_cache_all:true
prompt_cache_path is relative to the models folder. you can enter here a name for the file that will be automatically create during the first load if prompt_cache_all is set to true.
Configuring a specific backend for the model
By default LocalAI will try to autoload the model by trying all the backends. This might work for most of models, but some of the backends are NOT configured to autoload.
In order to specify a backend for your models, create a model config file in your models directory specifying the backend:
name:gpt-3.5-turboparameters:# Relative to the models pathmodel:...backend:llama-cpp
Connect external backends
LocalAI backends are internally implemented using gRPC services. This also allows LocalAI to connect to external gRPC services on start and extend LocalAI functionalities via third-party binaries.
The --external-grpc-backends parameter in the CLI can be used either to specify a local backend (a file) or a remote URL. The syntax is <BACKEND_NAME>:<BACKEND_URI>. Once LocalAI is started with it, the new backend name will be available for all the API endpoints.
So for instance, to register a new backend which is a local file:
Note that first is is necessary to create the environment with:
make -C backend/python/vllm
Environment variables
When LocalAI runs in a container,
there are additional environment variables available that modify the behavior of LocalAI on startup:
Environment variable
Default
Description
EXTRA_BACKENDS
Only for an image that you build from a source checkout, which has the backend sources and the build tools. A space separated list of backend folders to build on start, for example EXTRA_BACKENDS="backend/python/diffusers". The released images cannot use it: install backends from the gallery instead (see Extra backends)
LLAMACPP_GRPC_SERVERS
A list of llama.cpp workers to distribute the workload. For example LLAMACPP_GRPC_SERVERS="address1:port,address2:port"
Here is how to configure these variables:
docker run --env-file .env localai/localai:latest
CLI Parameters
For a complete reference of all CLI parameters, environment variables, and command-line options, see the CLI Reference page.
You can control LocalAI with command line arguments to specify a binding address, number of threads, model paths, and many other options. Any command line parameter can be specified via an environment variable.
.env files
Any settings being provided by an Environment Variable can also be provided from within .env files. There are several locations that will be checked for relevant .env files. In order of precedence they are:
.env within the current directory
localai.env within the current directory
localai.env within the home directory
.config/localai.env within the home directory
/etc/localai.env (Linux and macOS)
%LOCALAPPDATA%\LocalAI\localai.env, then %ProgramData%\LocalAI\localai.env (Windows, in place of /etc/localai.env)
Environment variables within files earlier in the list will take precedence over environment variables defined in files later in the list.
You can use ‘Extra-Usage’ request header key presence (‘Extra-Usage: true’) to receive inference timings in milliseconds extending default OpenAI response model in the usage field:
LocalAI can be extended with extra backends. The backends are implemented as gRPC services and can be written in any language. See the backend section for more details on how to install and build new backends for LocalAI.
In runtime
LocalAI installs a backend from the backend gallery the first time a model needs it. To install a backend before that, use the Backends page of the web interface, or POST /backends/apply. To install backends from the gallery when the container starts, list them in LOCALAI_EXTERNAL_BACKENDS, separated by commas:
Mount /backends as a volume, so that the installed backends stay when you recreate the container.
Concurrent requests
LocalAI supports parallel requests for the backends that supports it. For instance, vLLM and llama.cpp supports parallel requests, and thus LocalAI allows to run multiple requests in parallel.
In order to enable parallel requests, you have to pass --parallel-requests or set the PARALLEL_REQUEST to true as environment variable.
A list of the environment variable that tweaks parallelism is the following:
### Python backends GRPC max workers
### Default number of workers for GRPC Python backends.
### This actually controls whether a backend can process multiple requests or not.
### Define the number of parallel LLAMA.cpp workers (Defaults to 1)
### Enable to run parallel requests
Note that, for llama.cpp you need to set accordingly LLAMACPP_PARALLEL to the number of parallel processes your GPU/CPU can handle. For python-based backends (like vLLM) you can set PYTHON_GRPC_MAX_WORKERS to the number of parallel requests.
VRAM and Memory Management
For detailed information on managing VRAM when running multiple models, see the dedicated VRAM and Memory Management page.
Disable CPU flagset auto detection in llama.cpp
LocalAI will automatically discover the CPU flagset available in your host and will use the most optimized version of the backends.
If you want to disable this behavior, you can set DISABLE_AUTODETECT to true in the environment variables.
Model Configuration
LocalAI uses YAML configuration files to define model parameters, templates, and behavior. This page provides a complete reference for all available configuration options.
Configuration scopes and precedence
CLI flags and environment variables
configure the LocalAI server process. Model YAML files configure one model,
while supported fields in an API request can override that model’s defaults
for that request. For example, a request containing temperature overrides
the model YAML parameters.temperature only for that request.
Precedence is setting-specific rather than one universal ordering. For the
overlapping threads setting, an explicit nonzero server --threads value is
applied after model YAML and therefore wins over the YAML threads value.
Most server flags have no model YAML equivalent, so consult the relevant
reference for the scope of each setting.
LocalAI changes only config files that are inside the models directory. If the file from --models-config-file is outside the models directory, you cannot view, edit, pin, enable or disable its models from the web UI or the model admin API. Edit the file directly, then restart LocalAI.
Core Configuration Fields
Basic Model Settings
Field
Type
Description
Example
name
string
Model name, used to identify the model in API calls
gpt-3.5-turbo
backend
string
Backend to use (e.g. llama-cpp, vllm, diffusers, whisper)
llama-cpp
description
string
Human-readable description of the model
A conversational AI model
usage
string
Usage instructions or notes
Best for general conversation
Model File and Downloads
Field
Type
Description
parameters.model
string
Path to the model file (relative to models directory) or URL
download_files
array
List of files to download. Each entry has filename, uri, and optional sha256
The artifacts section makes installation of a Hugging Face model eager and
repeatable. LocalAI resolves the requested revision to an immutable commit,
downloads the selected repository files, and commits the complete snapshot
before the model installation succeeds.
Declare source when authoring a configuration. LocalAI owns the resolved
block and writes it after installation; do not choose its values manually.
For a public repository, omit token_env. For a private or gated repository,
set it to HF_TOKEN and provide that environment variable to the LocalAI
controller.
Field
Meaning
name
Logical artifact name; model for the initial primary artifact
target
Binding target; only model is supported initially
source.type
huggingface
source.repo
owner/repository or hf://owner/repository
source.revision
Branch, tag, or commit; defaults to main and resolves to a commit
source.token_env
Empty or HF_TOKEN; the secret value is never persisted
source.allow_patterns
Optional slash-separated glob allow-list
source.ignore_patterns
Optional slash-separated glob deny-list
resolved
Installer-owned immutable endpoint, revision, and cache key
Managed installation finishes only after every selected file is committed
locally. parameters.model remains the logical repository ID. Once
resolved.cache_key is present, LocalAI derives
.artifacts/huggingface/<cache-key>/snapshot as the runtime ModelFile.
Configurations without artifacts keep the existing lazy repository-ID
behavior.
The initially migrated backend families are transformers and its aliases,
diffusers, qwen-asr, fish-speech, nemo, voxcpm, qwen-tts,
vllm, vllm-omni, and sglang. Automatic imports add
artifact declarations only for this set. Compatible external backends may opt
in by declaring the artifact explicitly.
GGUF header cache
When a model config does not set a value itself, LocalAI reads the header of its GGUF file to choose defaults. The header gives the layer count, the trained context length, the chat template, the token IDs, and whether the file has an embedded multi-token-prediction head. Reading a large header takes seconds, so LocalAI keeps the result in a cache.
Mode: shared by file. Every frontend that uses the same data path reads and writes one cache file, header-cache.json. A frontend can therefore use the headers another frontend has already read. This mode is valid only while all frontends mount the same data volume.
Set an instance ID (--instance-id or LOCALAI_INSTANCE_ID) to give a frontend its own file, header-cache-<id>.json, instead of the shared one. It then keeps its own entries across restarts and does not share them with other frontends. An instance ID that is not a plain token (letters, digits, - and _, up to 64 characters) is hashed into the file name. In distributed mode, an ID that LocalAI generates at startup does not select a file of its own, because it changes on every start; such a frontend uses the shared file.
Warning
All frontends that share this cache must mount the same data volume. With a ReadWriteOnce volume, the volume attaches to one node at a time, so all frontends that share the cache must run on that one node. A frontend on another node cannot mount the volume and will not start. Sharing this cache across nodes needs a ReadWriteMany volume or a shared store, and this mode does not support it.
What is stored
Each entry is keyed by the absolute path of the file, its size and its modification time. If any of the three changes, the entry is not used and the header is read again.
The file keeps the values that come from the file: the architecture and name, the trained context length, the chat template, the token IDs, the multi-token-prediction head, and the estimates that depend only on the file and on LocalAI’s fixed defaults. The file also records the gguf-parser version and those defaults, so a LocalAI upgrade that changes them ignores the old file.
The file does not store anything about the machine: GPU and memory sizes, and your settings. Those are read again when a model loads, so the same file gives the same defaults on a different host.
The cache holds at most 256 entries. The least recently used entry is dropped first. Changes are written in the background after a short pause, never while a request waits.
How frontends share the file
Merge on save. Before writing, a frontend reads the file and merges its entries into its own. When both hold an entry for the same model file, the one that matches the model file on disk is kept. Entries that match no current file are dropped. The 256-entry bound applies to the merged set.
Atomic write. The new file is written to a temporary file in the same directory and renamed into place. A reader sees either the old file or the new one, never a partial file.
Reload on miss. A frontend reads the file when it starts. Later, it checks the file only when a header lookup misses, and only when the file’s modification time differs from the one it last read. It reads the file at most once per miss. A lookup that hits the cache never reads the file.
Concurrent saves. Two frontends can save at the same moment. The later rename wins, so an entry that the other frontend saved in that moment can be lost. A lost entry costs one header parse the next time that model file is used. It never gives a wrong value, because every entry is checked against its model file before it is used.
Where the file lives
The file is in the data path (--data-path, default data/ under the LocalAI base path):
header-cache.json, in standalone mode and for every frontend that does not set an instance ID. Frontends that mount the same data path share it.
header-cache-<id>.json, for a frontend that sets an instance ID (--instance-id or LOCALAI_INSTANCE_ID).
No data path: the cache is kept in memory only. Each start parses the headers again.
Files named gguf-header-cache*.json come from earlier versions. LocalAI does not read them, so you can delete them.
Clearing the cache
Stop the frontends that share the file and delete header-cache.json. It is rebuilt as models are used, one parse per model file. Deleting the file while a frontend runs is not reliable: that frontend writes its in-memory entries back after the next change.
Parameters Section
The parameters section contains all OpenAI-compatible request parameters and model-specific options.
OpenAI-Compatible Parameters
These settings will be used as defaults for all the API calls to the model.
Field
Type
Default
Description
temperature
float
0.9
Sampling temperature (0.0-2.0). Higher values make output more random
top_p
float
0.95
Nucleus sampling: consider tokens with top_p probability mass
top_k
int
40
Consider only the top K most likely tokens
max_tokens
int
0
Maximum number of tokens to generate (0 = unlimited)
frequency_penalty
float
0.0
Penalty for token frequency (-2.0 to 2.0)
presence_penalty
float
0.0
Penalty for token presence (-2.0 to 2.0)
repeat_penalty
float
1.1
Penalty for repeating tokens
repeat_last_n
int
64
Number of previous tokens to consider for repeat penalty
seed
int
-1
Random seed (omit for random)
echo
bool
false
Echo back the prompt in the response
n
int
1
Number of completions to generate
logprobs
bool/int
false
Return log probabilities of tokens
top_logprobs
int
0
Number of top logprobs to return per token (0-20)
logit_bias
map
{}
Map of token IDs to bias values (-100 to 100)
typical_p
float
1.0
Typical sampling parameter
tfz
float
1.0
Tail free z parameter
keep
int
0
Number of tokens to keep from the prompt
Note
The DS4 backend preserves its legacy behavior for omitted or non-positive
max_tokens values by generating at most 256 tokens. Set max_tokens to a
positive value when you need a specific DS4 output limit. After processing the
prompt, DS4 clamps that limit to the available context space and reserves one
context slot for safe generation.
Language and Translation
Field
Type
Description
language
string
Language code for transcription/translation
translate
bool
Whether to translate audio transcription
Custom Parameters
Field
Type
Description
batch
int
Batch size for processing (llama.cpp n_batch). A value you set is used as is, also in distributed mode, where only LocalAI’s own default is tuned to the node’s GPU
ignore_eos
bool
Ignore end-of-sequence tokens
negative_prompt
string
Negative prompt for image generation
rope_freq_base
float32
RoPE frequency base
rope_freq_scale
float32
RoPE frequency scale
negative_prompt_scale
float32
Scale for negative prompt
tokenizer
string
Tokenizer to use (RWKV)
LLM Configuration
These settings apply to most LLM backends (llama.cpp, vLLM, etc.):
Performance Settings
Field
Type
Default
Description
threads
int
processor count
Number of threads for parallel computation. A per-model value overrides the server-wide --threads/LOCALAI_THREADS setting
context_size
int
automatic
Maximum context size in tokens. A value that you set is always kept, whatever its size. When it is unset (or 0), the server-wide --context-size applies if one is set; otherwise, for a GGUF model that can serve chats, LocalAI aims at 32768 tokens, capped by the model’s trained window and stepped down (24576, 16384, then 8192, 6144, 4096) to what fits the detected memory (the memory of the smallest GPU, or on a host with no GPU memory detected, system memory: the model plus its context cache may take about 60% of it, and the window stays at 16384 or more while the model fits in memory at all). Embedding, rerank and other models that cannot serve a chat use at most 8192. Without readable GGUF metadata the window is 4096. The chat agent needs at least 16384 tokens (24576 for an administrator’s chat): see the context window a chat needs. Set to -1 to auto-use the model’s full trained context from GGUF metadata (raw max, no VRAM capping; a warning is logged if it may not fit detected VRAM).
f16
bool
false
Use 16-bit floating point for memory and the KV cache. Does not enable the GPU. The --f16 flag only sets this default for models that do not set f16
gpu_layers
int
99999999
Number of layers to offload to GPU. The default requests all layers; 0 keeps model layers on CPU. See mixed CPU/GPU inference.
Memory Management
Field
Type
Default
Description
mmap
bool
unset
Use memory mapping for model loading (faster, less RAM). When unset, llama-cpp lets llama.cpp choose: it maps the file unless a device has no mmap support, as on integrated GPUs (APUs), where mmap loads can hang (ggml-org/llama.cpp#19482). Other backends treat unset as true. Set true or false to force a choice. Intel SYCL backends always load without mmap
mmlock
bool
false
Lock model in memory (prevents swapping). With llama-cpp, mmlock together with mmap (true or unset) maps the file and locks it (mmap+mlock); with mmap: false the model is read into locked memory instead.
low_vram
bool
false
Use minimal VRAM mode
no_kv_offloading
bool
false
Disable KV cache offloading
GPU Configuration
Field
Type
Description
tensor_split
string
Comma-separated GPU memory allocation (e.g., "0.8,0.2" for 80%/20%). With the llama.cpp option split_mode:tensor it sets the share of each tensor that goes to each GPU; see tensor split
main_gpu
string
Main GPU identifier for multi-GPU setups
cuda
bool
Explicitly enable/disable CUDA
Placement
The model page’s Configuration tab and the model editor have a Placement
section for the keys above. It edits gpu_layers, tensor_split, main_gpu
and context_size and nothing else.
CPU only writes gpu_layers: 0.
Auto leaves gpu_layers unset. LocalAI then asks the backend for every
layer (99999999), and the llama-cpp backend lowers that to what fits in the
free device memory unless the model turns off fit_params (see GPU auto-fit settings). Other backends read
an unset value as their own default.
Custom writes the number you enter. All layers writes 99999999, the
value LocalAI uses when the key is unset. A slider appears when the memory
estimate reports the model’s layer count (block_count); today it does not, so
you enter a number.
With two or more GPUs, Split across GPUs writes tensor_split as
percentages (for example 65,35; llama.cpp reads them as proportions) and
Main GPU writes main_gpu. Split by free memory sets the shares from
the memory each card has free now.
The bars show, for each GPU and for system memory, what other programs use, what
this model needs (weights and working memory, and the KV cache that grows with
context_size) and what is left. They come from the device list in
/api/resources and from POST /api/models/vram-estimate, which returns one
total for the chosen context size and layer count. The per-device split of that
total follows tensor_split, so it is an approximation. The page says what the
choice means in words (“Fits in GPU”, “Spills to CPU”, “Too many layers for the
GPU”) and does not state a speed. A usable limit is 95 percent of the free
memory.
Fit it for me searches for the largest gpu_layers whose estimate fits the
free GPU memory, by asking the estimate endpoint, and Undo puts the previous
value back. It is hidden when the estimate is unavailable (the model file is
missing, still downloading or in a format the estimate does not cover) and when
the host has no GPU. A server that schedules models onto other machines shows no
per-device bars, because the devices listed belong to the controller.
Saving from the model page sends only the keys that changed. A key set back to
Auto is sent as null. The patch endpoint merges values into the file and cannot
delete a key, so the file then reads gpu_layers: null, which LocalAI treats as
unset. To remove the line itself, edit the YAML.
Mixed CPU/GPU inference
The llama-cpp backend can run one GGUF model across CPU and GPU, using both system RAM and GPU VRAM.
Use a GPU-capable build of the backend for your hardware.
A CPU-only build cannot offload layers to the GPU.
Offload some model layers
Set gpu_layers to a positive number smaller than the model’s layer count.
The remaining layers run on CPU.
Merge these settings into your existing model YAML, keeping its model path, template, and other options:
backend:llama-cppgpu_layers:12context_size:4096
The value 12 is an example, not a memory estimate.
Reload the model after changing its configuration.
Check the backend startup log for the number of layers offloaded and the CPU/GPU buffer sizes.
Increase gpu_layers if VRAM has room; reduce it if loading runs out of GPU memory.
Set gpu_layers: 0 to keep all model layers on CPU.
Keep MoE experts on CPU
For a mixture-of-experts (MoE) model, you can keep expert weights in system RAM while offloading other tensors to the GPU:
Append cpu_moe:true to any existing options list instead of replacing that list.
This option applies to the main model’s expert weights.
To keep experts from only the first 12 layers on CPU, replace cpu_moe:true with n_cpu_moe:12.
Use one of these options at a time.
In the web UI, the Placement section of the model editor and of the model page has an “Experts (MoE)” block that writes these entries for you.
It appears for models whose file reports an expert count, on a machine with a GPU.
It changes only cpu_moe, n_cpu_moe and moe_cache_mib in the options list and keeps every other entry.
The memory bars in that section do not include expert placement.
To speed up decoding when experts stay in host memory, you can add a GPU cache for them with moe_cache_mib:
The value is a size in MiB.
It is off by default (0).
It helps only when expert weights are in host memory, that is with cpu_moe, n_cpu_moe or a spill from GPU auto-fit.
The cache uses GPU memory, so lower gpu_layers or the auto-fit result may change when you turn it on.
The feature is experimental upstream.
A cache that is too small can thrash, because every token evicts its own experts.
A rough starting point is about 10% of the total expert size.
LocalAI sets no value on its own.
Once the cache is full, every miss is uploaded to the GPU by default.
You can let the CPU compute a share of the misses from the host experts instead, with moe_cache_cpu_share:
The value is a number from 0 to 1.
It is 0 by default, which uploads every miss.
It applies only when the cache is on (moe_cache_mib greater than 0).
Other values are ignored with a warning.
The best value depends on your hardware.
In the upstream tests, a small cache did best with a high share and a large cache with a low one.
To find the cache size and the share for your machine, use scripts/moe-cache-tune.py from the llama.cpp repository.
It wraps a plain llama-server command and prints the recommended --moe-cache-mib and --moe-cache-cpu-share.
CPU execution and data transfers can reduce generation speed compared with a model that fits entirely on GPU.
RAM and VRAM do not form one interchangeable allocation pool.
Leave memory for the KV cache, compute buffers, the operating system, and other processes.
Reduce context_size if the KV cache consumes too much memory.
The GPU auto-fit settings provide a separate way to let llama.cpp choose the allocation.
Lazy tensor loading
Some models have very large tensors that are used sparsely, such as per-layer embeddings.
The lazy_mode option (also lazy-mode) sets upstream --lazy-mode: it controls whether llama.cpp reads those tensors on demand instead of loading them all at startup.
backend:llama-cppoptions:- lazy_mode:on
Value
Behavior
auto
Default. Read on demand only the marked tensors larger than 4 GiB.
on
Read on demand every marked tensor. Requires mmap (enabled by default).
off
Load everything at startup.
An invalid value logs a warning and keeps the default.
The option needs a llama.cpp build that has --lazy-mode.
Maximum number of draft tokens per speculative step (default: 16)
quantization
string
Quantization format
load_format
string
Model load format
numa
bool
Enable NUMA (Non-Uniform Memory Access) support. On the llama.cpp-family backends (llama-cpp, ik-llama-cpp, turboquant) true sets the distribute strategy, which spreads threads evenly over the NUMA nodes, as llama.cpp’s --numa flag does. For best results drop the page cache before the first load.
rms_norm_eps
float32
RMS normalization epsilon
ngqa
int32
Natural question generation parameter
rope_scaling
string
RoPE scaling configuration
type
string
Model type/architecture
grammar
string
Grammar file path for constrained generation
YARN Configuration
YARN (Yet Another RoPE extensioN) settings for context extension:
Field
Type
Description
yarn_ext_factor
float32
YARN extension factor
yarn_attn_factor
float32
YARN attention factor
yarn_beta_fast
float32
YARN beta fast parameter
yarn_beta_slow
float32
YARN beta slow parameter
The original context size that YaRN scales from is an options: entry, yarn_orig_ctx:N (upstream --yarn-orig-ctx; 0, the default, uses the model’s training context size).
Speculative Decoding
Speculative decoding speeds up text generation by predicting multiple tokens ahead and verifying them in a single forward pass. The output is identical to normal decoding - only faster. This feature is only available with the llama-cpp backend.
There are two approaches:
The model editor sets up drafting without these flags: see
Drafting.
Draft Model Speculative Decoding
Uses a smaller, faster model from the same model family to draft candidate tokens, which the main model then verifies. Requires a separate GGUF file for the draft model.
When draft_model is set and no spec_type is configured, the llama.cpp backend reads the draft GGUF
(general.architecture and the tensors, as llama.cpp does without --spec-type) and picks the type
itself: a DFlash-family draft (including DSpark) or an MTP draft gets its own type, any other draft
model gets draft-simple. Backends built on a llama.cpp that cannot read the draft GGUF keep
draft-simple. An explicit spec_type always wins.
A DSpark drafter (a GGUF whose general.architecture is dflash with a Markov head) is configured like this:
Uses patterns from the token history to predict future tokens - no extra model required. Works well for repetitive or structured output (code, JSON, lists).
KV cache V data type for the draft model (upstream --spec-draft-type-v)
spec_draft_n_ubatch
int
0 (same as n_ubatch)
Physical batch size of the draft context. Use a smaller value to spare VRAM (upstream --spec-draft-n-ubatch).
spec_draft_sampling
string
greedy
How the draft is sampled: greedy takes the argmax, probabilistic samples it and the target verifies by rejection sampling (upstream --spec-draft-sampling).
spec_draft_device / draft_device
string
follows device
Comma-separated devices for the draft model; none keeps it off the GPU (upstream --spec-draft-device).
draft_cpu_moe / spec_draft_cpu_moe
bool
false
Keep all MoE expert weights of the draft model on CPU
draft_n_cpu_moe / spec_draft_n_cpu_moe
int
0
Keep MoE expert weights of the first N draft-model layers on CPU
Comma-separated <tensor regex>=<buffer type> overrides for the draft model
draft_ctx_size
int
(ignored)
Deprecated upstream: the draft now shares the target context size. Accepted for backward compatibility but has no effect; the backend logs a warning.
The names spec_n_max, spec_n_min and spec_p_min map to upstream’s --spec-draft-n-max, --spec-draft-n-min and --spec-draft-p-min. The older --draft-max style flags were removed upstream: passed as raw flags they are rejected.
ngram_simple options (used when spec_type includes ngram_simple)
Option
Type
Default
Description
spec_ngram_size_n / ngram_size_n
int
12
N-gram lookup size
spec_ngram_size_m / ngram_size_m
int
48
M-gram proposal size
spec_ngram_min_hits / ngram_min_hits
int
1
Minimum hits for accepting n-gram proposals
ngram_mod options (used when spec_type includes ngram_mod)
Option
Type
Default
Description
spec_ngram_mod_n_min
int
48
Minimum number of ngram tokens to use
spec_ngram_mod_n_max
int
64
Maximum number of ngram tokens to use
spec_ngram_mod_n_match
int
24
Ngram lookup length
ngram_map_k options (used when spec_type includes ngram_map_k)
Option
Type
Default
Description
spec_ngram_map_k_size_n
int
12
N-gram lookup size
spec_ngram_map_k_size_m
int
48
M-gram proposal size
spec_ngram_map_k_min_hits
int
1
Minimum hits for accepting proposals
ngram_map_k4v options (used when spec_type includes ngram_map_k4v)
Option
Type
Default
Description
spec_ngram_map_k4v_size_n
int
12
N-gram lookup size
spec_ngram_map_k4v_size_m
int
48
M-gram proposal size
spec_ngram_map_k4v_min_hits
int
1
Minimum hits for accepting proposals
ngram_cache lookup files
Option
Type
Default
Description
spec_lookup_cache_static / lookup_cache_static
string
""
Path to a static ngram lookup cache file
spec_lookup_cache_dynamic / lookup_cache_dynamic
string
""
Path to a dynamic ngram lookup cache file (updated by generation)
Speculative Type Values
The canonical names match upstream llama.cpp (dash-separated). For backward compatibility LocalAI also accepts the underscore-separated forms and the bare draft / eagle3 aliases.
Type
Aliases accepted
Description
none
No speculative decoding (default)
draft-simple
draft, draft_simple
Draft model-based speculation (auto-set when draft_model is configured)
draft-eagle3
eagle3, draft_eagle3
EAGLE3 draft model architecture
draft-mtp
draft_mtp
Multi-Token Prediction. Reuses the target model’s embedded MTP head; no separate draft GGUF required (draft_model can be omitted).
draft-dflash
draft_dflash
DFlash speculation with a draft model set in draft_model.
draft-dspark
draft_dspark
DSpark speculation (the draft model carries a Markov head), draft set in draft_model.
ngram-simple
ngram_simple
Simple self-speculative using token history
ngram-map-k
ngram_map_k
N-gram with key-only map
ngram-map-k4v
ngram_map_k4v
N-gram with keys and 4 m-gram values
ngram-mod
ngram_mod
Modified n-gram speculation
ngram-cache
ngram_cache
3-level n-gram cache
Multiple types can be chained by passing a comma-separated list to spec_type (e.g. spec_type:ngram-simple,ngram-mod). The runtime tries them in order and accepts the first proposal that meets the acceptance criteria.
Note
The current LocalAI llama.cpp backend supports speculative decoding with multimodal models that load an mmproj, including MTP. LocalAI passes both configurations to llama.cpp and does not disable speculation merely because an mmproj is present. Upstream llama.cpp removed the former general multimodal/speculative restriction in ggml-org/llama.cpp#19493; ggml-org/llama.cpp#22673 later added MTP support and explicitly documented its compatibility with vision input.
Compatibility still depends on the installed backend version and the target/draft model architecture. Check the backend logs for successful projector loading and speculative-context initialization, then look for the draft acceptance statistics line and its accepted / generated counts. A representative run with zero accepted draft tokens receives no speculative speedup and can indicate that the model or settings need tuning.
Multi-Token Prediction (MTP)
draft-mtp enables Multi-Token Prediction (ggml-org/llama.cpp#22673). MTP uses a small prediction head trained into the target model: the head runs alongside the main forward pass and proposes the next few tokens, which the target then verifies in a single batched step. Upstream reports ~1.85x-2.1x token throughput at ~72-82% draft acceptance on Qwen3.6 27B / 35B A3B.
Auto-detection (default). When a GGUF declares an MTP head (the upstream <arch>.nextn_predict_layers metadata key, set by convert_hf_to_gguf.py for Qwen3.5/3.6 family models and similar), LocalAI auto-enables MTP with the following defaults:
Detection runs both at import time (the import page (/app/import-model) / POST /models/import-uri flow range-fetches the GGUF header and writes the options into the generated YAML before you save it) and at load time (every llama-cpp model start re-checks the local header and appends the options if spec_type isn’t already set). To opt out, set an explicit spec_type: / speculative_type: in your YAML - auto-detection always preserves the user value, including spec_type:none.
Two ways to load the MTP head:
Embedded in the target GGUF (the recommended path for LocalAI, and what auto-detection assumes). When spec_type includes draft-mtp and draft_model is empty, the backend builds the MTP draft context directly from the target model’s weights. The GGUF must have been converted with the MTP tensors included.
Separate mtp-*.gguf sibling file. If you point draft_model at the separate MTP-head GGUF that ships next to the main weights on HuggingFace, the backend will load it as a draft model. Note: upstream’s -hf auto-discovery of mtp-*.gguf siblings is not wired into LocalAI’s gRPC layer - you need to download the sibling file and configure draft_model explicitly.
Manual override knobs (overlap with the auto-detect defaults above):
Option
Recommended
Notes
spec_type
draft-mtp
Activates MTP. Can be chained with other types (see below).
spec_n_max / draft_max
2-6
Number of draft tokens per step. Upstream’s PR suggests 2-3 for the tightest acceptance window; LocalAI’s auto-default is 6 to favour throughput on models with high acceptance.
spec_p_min
0.75
Pinned because upstream marks the current default with a “change to 0.0f” TODO; locking it here keeps acceptance thresholds stable across future llama.cpp bumps.
mmproj_use_gpu
true for vision
MTP does not require disabling the projector. Keep mmproj configured for image input; set this option to false to keep the projector on CPU when VRAM is tight. Remove mmproj only for text-only use when vision is not needed.
Minimal config (override-only, since auto-detection already covers this for MTP-capable GGUFs):
Pre-converted GGUFs with MTP heads are published on the ggml-org HuggingFace org (initially Qwen3.6 27B and Qwen3.6 35B A3B).
Reasoning Models (DeepSeek-R1, Qwen3, etc.)
These load-time options control how the backend parses <think> reasoning blocks and how much budget the model is allowed for thinking. They are set per model via the options: array. For how reasoning is returned alongside tool calls and survives the tool-result round trip, see Interleaved Thinking with Tool Calls.
Option
Type
Default
Description
reasoning_format
string
deepseek
Parser for reasoning/thinking blocks. One of none, auto, deepseek, deepseek-legacy (alias deepseek_legacy).
enable_reasoning
-1, 0, 1, auto, off, on
-1 (auto)
On/off switch of thinking for the chat template (upstream --reasoning). auto follows the template, 0 or off turns thinking off, 1 or on turns it on. A number above 1 is still read as on, as in older versions, and logs a warning: it is not a token cap, use reasoning_budget for that.
reasoning_budget
int
-1
Token cap for the thinking section (upstream --reasoning-budget): -1 unlimited, 0 end thinking at once, N > 0 allows at most N thinking tokens, then the end-of-thinking tag is forced. Values below -1 are ignored with a warning. For compatibility, reasoning_budget:0 also turns thinking off (enable_reasoning:0) unless enable_reasoning is set too.
prefill_assistant
bool
true
When false, the trailing assistant message is not pre-filled by the chat template.
Note
Before this change both names wrote the on/off switch, so reasoning_budget:N with N > 1 only turned thinking on and never capped it. It now sets the real token cap. reasoning_budget:0 and enable_reasoning:0 keep switching thinking off; reasoning_budget:1 is now a one-token cap, not “on”.
This is the load-time reasoning configuration. The orthogonal per-request enable_thinking chat-template kwarg toggles thinking on/off per call without restarting the model. It can be driven either by the YAML reasoning.disable field (model default) or per request via the OpenAI reasoning_effort field on /v1/chat/completions:
reasoning_effort: "none" disables thinking for that request (enable_thinking=false) - useful to run a single reasoning model like Qwen3 for low-latency tasks while still enabling reasoning on other requests.
reasoning_effort: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" enables thinking, unless the model config explicitly set reasoning.disable: true (an operator’s explicit disable wins and is never re-enabled by a request).
The /v1/responses endpoint accepts the same effort levels through reasoning.effort.
It also forwards request metadata to the backend, including enable_thinking overrides.
reasoning_effort is also forwarded to the backend as a chat_template_kwarg, so models whose jinja chat template keys on it - e.g. gpt-oss (Harmony) or LFM2.5 - honor the level, not just the on/off enable_thinking flag. This matters for models that ignore enable_thinking entirely (LFM2.5 keeps emitting <think> for enable_thinking=false, but respects reasoning_effort).
Set a per-model default in the config so every request inherits it (a per-request reasoning_effort still overrides):
name:my-modelreasoning_effort:none # none | minimal | low | medium | high | xhigh | max
For realtime pipelines, set it on the pipeline so it applies to the pipeline’s LLM without editing that model’s own config:
name:gpt-realtimepipeline:llm:lfm2.5reasoning_effort:none # overrides the LLM model's own reasoning_effort
Custom chat_template_kwargs
Some jinja chat templates expose extra variables beyond enable_thinking /
reasoning_effort (for example Qwen3’s preserve_thinking). Set arbitrary key/values in
the model config and they are forwarded to the backend’s chat_template_kwargs as-is, so
you don’t need a dedicated server option per template variable:
You can also override (or add) any of these per request through the OpenAI metadata
field on /v1/chat/completions. Values are strings; "true" / "false" are coerced to
booleans, anything else is passed through as a string:
Per-request metadata overrides the model config defaults and the reasoning-config levers,
and (for enable_thinking / reasoning_effort) takes effect across every backend that
reads them, not just llama.cpp. Typed (non-boolean) values are only supported through the
model YAML chat_template_kwargs, where YAML preserves the type.
Clients written for llama.cpp’s llama-server, vLLM or SGLang send the same switches as a
top-level chat_template_kwargs object. LocalAI accepts that too and folds its scalar values
into metadata (booleans become "true" / "false", numbers become strings; nested objects
and arrays are ignored). If a key appears in both, metadata wins:
These llama.cpp options are passed through the options: array.
Option
Type
Default
Description
n_ubatch / ubatch
int
same as batch
Physical batch size. Decouple from n_batch when an embedding/rerank workload needs a different value.
threads_batch / n_threads_batch
int
same as threads
Threads used during prompt processing. <= 0 means hardware_concurrency().
direct_io / use_direct_io
bool
false
Open the model with O_DIRECT (faster cold loads on NVMe; ignored if not supported).
verbosity
int
3
llama.cpp internal log verbosity threshold. Higher = more verbose.
device / devices
string
all devices
Select the llama.cpp backend devices to use. Repeat the option or pass a comma-separated list; unlisted devices are excluded. Use the names reported by llama-server --list-devices / --list-devices.
override_tensor / tensor_buft_overrides
string
""
Per-tensor buffer-type overrides for the main model. Format: <tensor regex>=<buffer type>,<tensor regex>=<buffer type>,.... Mirrors the existing draft_override_tensor syntax for the draft model.
cpu_moe
bool
false
Keep all MoE expert weights of the main model on CPU (upstream --cpu-moe). Frees VRAM on large MoE models (DeepSeek, Qwen3 *-A3B).
n_cpu_moe
int
0
Keep MoE expert weights of the first N main-model layers on CPU (upstream --n-cpu-moe).
n_cpu_ffn
int
0
Keep the dense FFN weights of the first N main-model layers on CPU (upstream --n-cpu-ffn). The counterpart of n_cpu_moe for dense models. A negative or non-numeric value is ignored with a warning.
kv_unified_per_slot
int
0 (unset)
Context limit per parallel slot (upstream --kv-unified-per-slot). Without context_size, the shared KV cache is sized to parallel times this value.
paged_kv / paged_serving
bool
true
Paged serving: admission control and preemption over the shared KV pool, see Paged serving. Sets parallel to 8 when it is not set. Turns itself off for kv_unified:false, context_shift or cont_batching:false; an explicit paged_kv:true with one of those fails the load.
kv_pool_tokens
int
context_size
Total KV pool in tokens for paged serving. Sets the context size.
prefill_budget / max_prefill_tokens
int or auto
256
Prompt tokens read per step while other requests generate. auto adapts it to the number of decoding streams; 0 turns it off. Works without paged serving.
prefill_long
int
1024
The prefill budget applies only to prompts longer than this; 0 applies it to every prompt.
kv_output_reserve
int
256
With paged serving: free cells a request needs beyond its prompt to start, capped at its max tokens.
paged_preempt
bool
true
With paged serving: preempt and later resume a request when the pool runs out. Keep it on: with false, an overflow fails every in-flight stream with HTTP 500.
yarn_orig_ctx
int
0 (model value)
Original context size of the model for YaRN scaling (upstream --yarn-orig-ctx).
Generic option passthrough
Any options: entry whose name starts with - is forwarded verbatim to
upstream llama.cpp’s own llama-server argument parser. This means any flag the
bundled llama.cpp supports works without LocalAI needing a dedicated option,
even ones added after your LocalAI version was built. See the upstream
server flags reference.
Format mirrors the rest of the array - --flag for a boolean, or --flag:value
for a flag that takes a value. Everything after the first : is the value, so
embedded colons (e.g. host:port) are preserved:
options:- "--cpu-moe"# boolean flag- "--n-cpu-moe:4"# flag with a value- "--override-tensor:exps=CPU"- "devices:CUDA1,CUDA2,CUDA3"# skip CUDA0, e.g. a display GPU
Notes:
Precedence: passthrough flags are applied last, so an explicit flag
overrides the LocalAI option it maps to (e.g. --ctx-size:8192 overrides
context_size).
Power-user territory: an invalid flag or value is rejected by the upstream
parser exactly as it would be by llama-server. When the list is refused, the
flags that are valid are still applied and each rejected one is named in the
log; only a failure of the valid set drops all of them. Prefer the named
options above when one exists.
Environment and config files are ignored: while the flags are parsed, the
LLAMA_ARG_* environment variables and the user-level llama.cpp config file
are hidden, so they cannot change values LocalAI has resolved. Put settings in
options:. A system-wide /etc/llama.cpp/config.ini is still read.
Per-request values win: LocalAI sends cache_prompt and the sampling
parameters (temperature, top_k, top_p, min_p, typical_p, seed,
repeat/frequency/presence penalties, mirostat*, n_keep) with every request.
Raw flags such as --cache-prompt, --temp, --top-k or --seed only change
the server defaults, so they have no effect. Use prompt_cache_all and the
parameters: section of the model file instead.
Flags that would terminate the process (such as --help, --usage,
--version, --license, --list-devices, --cache-list, and
--completion*) are ignored.
Prompt Caching
The recommended way to enable prompt caching for the llama-cpp backend is the server-side prompt cache controlled by cache_ram / kv_unified / cache_idle_slots in the options: array (see llama.cpp backend options). It’s on by default since LocalAI v4.3 and is what gives repeated system prompts a near-zero prefill on the second call.
Of the fields below, only prompt_cache_all is used by the llama-cpp gRPC server. The others come from upstream llama.cpp’s CLI completion tool and are passed through for compatibility, but the server does not consume them: keep them empty unless you’re targeting a non-llama-cpp backend that reads them.
Field
Type
Description
prompt_cache_path
string
(legacy / unused by llama-cpp gRPC server) Path to a file-backed prompt cache for upstream’s CLI completion tool.
prompt_cache_all
bool
Used by llama-cpp: sent with every request as llama.cpp’s cache_prompt, which lets a slot reuse the KV cache of a matching prompt prefix. Default true; set prompt_cache_all: false in the model file to turn it off. A raw --cache-prompt flag in options: does not change it.
prompt_cache_ro
bool
(legacy / unused by llama-cpp gRPC server)
Text Processing
Field
Type
Description
stopwords
array
Words or phrases that stop generation
cutstrings
array
Strings to cut from responses
trimspace
array
Strings to trim whitespace from
trimsuffix
array
Suffixes to trim from responses
extract_regex
array
Regular expressions to extract content
System Prompt
Field
Type
Description
system_prompt
string
Default system prompt for the model
vLLM-Specific Configuration
These options apply when using the vllm backend:
The vllm backend validates sampling parameters before generation. Stop strings
work with streaming and non-streaming requests; an empty stop string is invalid.
Presence and frequency penalties must be between -2 and 2. A temperature of 0
selects greedy decoding, which ignores top_p and top_k. A seed of -1 uses
vLLM’s default random seed behavior.
Field
Type
Description
gpu_memory_utilization
float32
GPU memory utilization (0.0-1.0, default 0.9)
trust_remote_code
bool
Trust and execute remote code
enforce_eager
bool
Force eager execution mode
swap_space
int
Swap space in GB
max_model_len
int
Maximum model length
tensor_parallel_size
int
Tensor parallelism size
disable_log_stats
bool
Disable logging statistics
dtype
string
Data type (e.g., float16, bfloat16)
flash_attention
string
Flash attention configuration
cache_type_k
string
Key cache quantization type. Maps to llama.cpp’s -ctk. Accepted values for llama.cpp-family backends (llama-cpp, ik-llama-cpp, turboquant): f16, f32, q8_0, q4_0, q4_1, q5_0, q5_1. The turboquant backend additionally accepts turbo2, turbo3, turbo4 - the fork’s TurboQuant KV-cache schemes. turbo3/turbo4 auto-enable flash_attention.
cache_type_v
string
Value cache quantization type. Maps to llama.cpp’s -ctv. Same accepted values as cache_type_k. Note: any quantized V cache requires flash_attention to be enabled.
Use tokenizer’s built-in template (vLLM/transformers)
template.system_messages_after_first
string
What to do with system-role messages that appear after the leading system block: merge folds them into the first system message, user forwards them as user-role turns at their position. Unset keeps them as-is. Needed for tokenizer templates that reject late system turns (e.g. Qwen3.8) while agent frameworks append instructions mid-conversation.
Configure how the model handles function/tool calls:
Field
Type
Default
Description
function.disable_no_action
bool
false
Disable the no-action behavior
function.no_action_function_name
string
answer
Name of the no-action function
function.no_action_description_name
string
Description for no-action function
function.function_name_key
string
name
JSON key for function name
function.function_arguments_key
string
arguments
JSON key for function arguments
function.response_regex
array
Named regex patterns to extract function calls
function.argument_regex
array
Named regex to extract function arguments
function.argument_regex_key_name
string
key
Named regex capture for argument key
function.argument_regex_value_name
string
value
Named regex capture for argument value
function.json_regex_match
array
Regex patterns to match JSON in tool mode
function.replace_function_results
array
Replace function call results with patterns
function.replace_llm_results
array
Replace LLM results with patterns
function.capture_llm_results
array
Capture LLM results as text (e.g., for “thinking” blocks)
function.xml_format_preset
string
Force an XML tool-call format: qwen3-coder, qwen3.5, lfm3, glm-4.5, minimax-m2, kimi-k2 and others. Empty tries all of them
Grammar Configuration
Field
Type
Default
Description
function.grammar.disable
bool
false
Completely disable grammar enforcement
function.grammar.parallel_calls
bool
false
Allow parallel function calls
function.grammar.mixed_mode
bool
false
Allow mixed-mode grammar enforcing
function.grammar.no_mixed_free_string
bool
false
Disallow free strings in mixed mode
function.grammar.disable_parallel_new_lines
bool
false
Disable parallel processing for new lines
function.grammar.prefix
string
Prefix to add before grammar rules
function.grammar.expect_strings_after_json
bool
false
Expect strings after JSON data
Diffusers Configuration
For image generation models using the diffusers backend:
Field
Type
Description
diffusers.cuda
bool
Force CUDA. By default the backend auto-detects and uses CUDA when a compatible GPU is present (ROCm builds included). Pin the CPU with options: ["device:cpu"]
diffusers.pipeline_type
string
Pipeline type (e.g., stable-diffusion, stable-diffusion-xl)
diffusers.scheduler_type
string
Scheduler type (e.g., euler, ddpm)
diffusers.original_config_file
string
Local path or URL to the original configuration for loading a single-file checkpoint
diffusers.enable_parameters
string
Comma-separated parameters to enable
diffusers.cfg_scale
float32
Classifier-free guidance scale
diffusers.img2img
bool
Enable image-to-image transformation
diffusers.clip_skip
int
Number of CLIP layers to skip
diffusers.clip_model
string
CLIP model to use
diffusers.clip_subfolder
string
CLIP model subfolder
diffusers.control_net
string
ControlNet model to use
step
int
Number of diffusion steps
TTS Configuration
For text-to-speech models:
Field
Type
Description
tts.voice
string
Default backend voice ID, speaker name, or reference path. A request voice takes precedence.
tts.audio_path
string
Default reference-audio path for cloning backends. A request voice or saved Voice Library profile takes precedence.
tts.voice_cloning
bool
Optional Voice Library capability override. Omit for automatic backend/variant detection; true opts in a verified custom-named variant and false rejects saved profile references.
For example, a custom-named model on a known cloning backend can declare support explicitly while retaining a model-wide reference fallback:
tts.voice_cloning: true only overrides model-variant detection. It cannot enable cloning on a backend that does not implement LocalAI’s reference-audio contract.
Roles Configuration
Map conversation roles to specific strings:
roles:user:"### Instruction:"assistant:"### Response:"system:"### System Instruction:"
Options of the tool loop. They apply to the chats (including saved agents, triggers and connector turns) and, for max_iterations, to /v1/chat/completions, /v1/messages and /v1/responses:
Field
Type
Description
agent.max_iterations
int
Maximum number of tool rounds in one turn. In the chats it replaces the runtime setting chats_max_iterations (default 40) for this model
agent.max_attempts
int
How often a failed tool call is retried
agent.force_reasoning_tool
bool
Make the model reason before it picks a tool
agent.max_generation_tokens
int
Accepted and ignored. It capped the completions of the agent jobs, which were removed
The old agent loop also had enable_reasoning, enable_planning, enable_mcp_prompts, enable_plan_re_evaluator, disable_sink_state, loop_detection and max_adjustment_attempts. The chats loop has no counterpart for them. A model file that still sets one keeps loading; the option is ignored and a warning names it when the file is read.
Reasoning Configuration
Configure how reasoning tags are extracted and processed from model output. Reasoning tags are used by models like DeepSeek, Command-R, and others to include internal reasoning steps in their responses.
Field
Type
Default
Description
reasoning.disable
bool
false
When true, disables reasoning extraction entirely. The original content is returned without any processing.
reasoning.disable_reasoning_tag_prefill
bool
false
When true, disables automatic prepending of thinking start tokens. Use this when your model already includes reasoning tags in its output format.
reasoning.strip_reasoning_only
bool
false
When true, extracts and removes reasoning tags from content but discards the reasoning text. Useful when you want to clean reasoning tags from output without storing the reasoning content.
reasoning.thinking_start_tokens
array
[]
List of custom thinking start tokens to detect in prompts. Custom tokens are checked before default tokens.
reasoning.tag_pairs
array
[]
List of custom tag pairs for reasoning extraction. Each entry has start and end fields. Custom pairs are checked before default pairs.
Reasoning Tag Formats
The reasoning extraction supports multiple tag formats used by different models:
Note: Custom tokens and tag pairs are checked before the default ones, giving them priority. This allows you to override default behavior or add support for new reasoning tag formats.
Per-Request Override via Metadata
The reasoning.disable setting from model configuration can be overridden on a per-request basis using the metadata field in the OpenAI chat completion request. This allows you to enable or disable thinking for individual requests without changing the model configuration.
The metadata field accepts a map[string]string that is forwarded to the backend. The enable_thinking key controls thinking behavior:
# Enable thinking for a single request (overrides model config)curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json"\
-d '{
"model": "qwen3",
"messages": [{"role": "user", "content": "Explain quantum computing"}],
"metadata": {"enable_thinking": "true"}
}'# Disable thinking for a single request (overrides model config)curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json"\
-d '{
"model": "qwen3",
"messages": [{"role": "user", "content": "Hello"}],
"metadata": {"enable_thinking": "false"}
}'
Request-level chat_template_kwargs.enable_thinking (the llama-server / vLLM form)
Model config reasoning.disable (fallback)
Auto-detected from model template (default)
Pipeline Configuration
Define pipelines for audio-to-audio processing and the Realtime API:
Field
Type
Description
pipeline.tts
string
TTS model name
pipeline.llm
string
LLM model name
pipeline.transcription
string
Transcription model name
pipeline.vad
string
Voice activity detection model name
pipeline.any_to_any
bool
When true, a realtime_audio model runs as one speech-to-speech model (audio in, audio or text out) instead of the chained VAD, transcription, LLM and TTS path. Experimental. See Speech-to-speech models
pipeline.turn_detection
object
Realtime turn-detection defaults. Keys: type (server_vad/semantic_vad), eagerness (low/medium/high/auto), retranscribe, vad_window_sec (widen the per-tick VAD scan window; values below the automatic floor are ignored). See Realtime turn detection
pipeline.classifier
object
Realtime classifier mode: prefill-scored option selection instead of generation. Keys: enabled, threshold, normalization (raw/mean), history_items, fallback (mode: none/reply/generate, reply), options (list of id, description, reply, tool{name, arguments}), address (wake-word gate: names, mode: ignore/reply, reply), model (optional separate scoring config). See Realtime classifier mode
gRPC Configuration
Backend gRPC communication settings. These control the readiness handshake
between LocalAI and a freshly spawned backend process - LocalAI polls the
backend’s Health gRPC method up to grpc.attempts times, sleeping
grpc.attempts_sleep_time seconds between polls, before giving up and
terminating the backend as unresponsive.
Field
Type
Default
Description
grpc.attempts
int
20
Number of health-check attempts before the backend is killed as unresponsive
grpc.attempts_sleep_time
int
2
Sleep time between health-check attempts (seconds)
Total load window ≈ grpc.attempts × (grpc.attempts_sleep_time + per-call gRPC dial timeout).
The default of 20 × 2 s ≈ 40 s is fine for typical backends but is too
short for large models that need substantial time to become gRPC-ready
after the process starts - for example NVFP4 / FP8 models whose shard
loading and CUDA-graph capture can take several minutes, or slow storage
backends. If the backend keeps getting killed while still legitimately
loading (visible as exitCode=120 + rpc error: code = Canceled desc = context canceled in the LocalAI log, while the backend’s own stderr
shows continued forward progress), raise these values.
Example configuration for a model that needs up to ~10 minutes to become
gRPC-ready (large NVFP4 model, cold shard load + CUDA-graph capture):
grpc:attempts:140attempts_sleep_time:5
This gives a ~700 s window while keeping health-check polling frequent
enough to detect real backend crashes quickly. The values only affect
the initial readiness handshake - inference-request timeouts and the
watchdog are unchanged.
Overrides
Override model configuration values at runtime (llama.cpp):
decisions marks a model as a decision model for the Decisions API (POST /v1/systemone). It is never guessed, and a model that declares it is not listed as a chat, completion or embeddings model.
token_classify marks a model as a token-classification (NER) provider for the PII filter (e.g. an openai-privacy-filter GGUF). Declare it explicitly together with embeddings: true (the classifier loads via TOKEN_CLS pooling). It runs on the dedicated privacy-filter backend (backend/cpp/privacy-filter), a standalone GGML engine for the openai-privacy-filter family - separate from llama-cpp, which no longer carries the token-classification path.
Known input and output modalities
Use known_input_modalities and known_output_modalities when a use case does not fully describe a model’s I/O. For example, both text-to-video and audio-driven avatar models use the video use case, but only the avatar model accepts audio:
known_usecases:- videoknown_input_modalities:- text- image- audioknown_output_modalities:- video
Valid modality values are text, image, audio, and video. Explicit values are combined with modalities LocalAI can infer from the model use cases and configuration. The resulting canonical, de-duplicated lists are exposed by GET /v1/models/capabilities.
PII filtering
PII redaction is NER-based and runs on the request (input) side. It has two halves:
Detector models are token_classify models that carry the detection policy in a top-level pii_detection: block. The policy is defined once, on the model itself:
name:privacy-filter-multilingualbackend:llama-cppembeddings:trueknown_usecases:- token_classifypii_detection:min_score:0.5# drop detections below this confidencedefault_action:mask # mask | block | allow - applied to any detected# group with no explicit entry (empty = mask)entity_actions:# which PII to block vs mask vs allow-logPASSWORD:blockCREDITCARD:blockEMAIL:maskextend_to_next_word:# optional: also mask the word right after these- ZIPCODE # groups on the same line (e.g. the town after a postal code)extend_to_previous_word:# optional: also mask the letters-only word right before these- LASTNAME # groups on the same line (e.g. the first name before a surname)protected_terms:# optional: values that must pass unchanged even if tagged- Hotel Seeblick # (plus protected_terms_files: one term per line, in the models path)
Consuming models opt in and reference one or more detectors by name - no per-consumer policy:
name:my-assistantpii:enabled:true# default: off for local backends, on for cloud-proxydetectors:- privacy-filter-multilingual
Multiple detectors union their detections; overlapping spans resolve to the strongest action (block > mask > allow). A configured detector that can’t be loaded fails the request closed (HTTP 503) rather than silently skipping the check. Detections are audited at /api/pii/events (hash-prefix only, never the raw value).
The earlier regex pattern tier (pii.patterns, the global pattern catalogue, --pii-config, and the /api/pii/patterns admin endpoints) has been removed, along with response/streaming-side redaction. Those keys now no-op with a startup warning; migrate to pii.detectors + a detector’s pii_detection block.
Remote proxy models
A model with backend: cloud-proxy or backend: localai-proxy is served by a
remote upstream. The proxy: block holds its settings (upstream_url,
upstream_model, mode, provider, api_key, api_key_env,
api_key_file, request_timeout_seconds). See
Cloud passthrough proxy.
proxy.remote is the id of a
remote. LocalAI sets it when a
remote creates the model. Do not write it by hand. LocalAI reads the key from
the remote when it sends a load of the model, and only when upstream_url is
below the address of the remote. The field is exclusive with api_key,
api_key_env and api_key_file.
Environment Variables Configuration
Model configurations can specify environment variables passed to the backend process:
Note: By default, LocalAI sets gpu_layers to a very large value (99999999), which effectively disables llama-cpp’s auto-fit functionality. This is intentional to work with LocalAI’s VRAM-based model unloading mechanism.
To enable llama-cpp’s auto-fit mode, set gpu_layers: -1 in your model configuration. However, be aware of the following:
Trade-off: Enabling auto-fit conflicts with LocalAI’s built-in VRAM threshold-based unloading. Auto-fit attempts to fit all tensors into GPU memory automatically, while LocalAI’s unloading mechanism removes models when VRAM usage exceeds thresholds.
Known Issues: Setting gpu_layers: -1 may trigger tensor_buft_override buffer errors in some configurations, particularly when the model exceeds available GPU memory.
Recommendation:
Use the default settings for most use cases (LocalAI manages VRAM automatically)
Only enable gpu_layers: -1 if you understand the implications and have tested on your specific hardware
Monitor VRAM usage carefully when using auto-fit mode
This is a known limitation being tracked in issue #8562. A future implementation may provide a runtime toggle or custom logic to reconcile auto-fit with threshold-based unloading.
Model Aliases
A model alias is a model name that redirects all traffic to another
configured model. Declare gpt-4 as an alias of my-llama-3 and every client
calling gpt-4 is served by my-llama-3 with no client reconfiguration: the
clients keep their existing model name while you control what answers them on
the server side.
Declaring an alias
Create a minimal config file in your models directory:
name:gpt-4alias:my-llama-3
That is the whole config: a name (the alias clients call) and an alias key
(the target that actually serves the request). An alias may add an
optional profile block.
Rules and behavior
The target (my-llama-3) must be an existing, non-alias, enabled model. You
cannot point an alias at a missing model, a disabled model, or another alias
(no chains).
Aliases are 1:1. One alias maps to exactly one target.
Swap the target with no restart: edit the file, call the API, use the UI or ask the LocalAI Assistant.
Both gpt-4 and my-llama-3 appear in GET /v1/models.
Responses echo the requested alias: a call to gpt-4 returns gpt-4 in the
response model field, not the target name.
Usage accounting records both sides: requested gpt-4, served my-llama-3.
Aliases work for every modality (chat, embeddings, audio, images, and so on).
To serve a name from several models with automatic fallback, use a failover
chain.
Profile aliases
An alias can also act as a profile of its target: a different assistant on
the same loaded model. Add an optional profile block; its fields are applied on
top of the target’s config for requests to the alias:
Field
Effect
profile.system_prompt
Replaces the target’s system prompt. A system message sent by the client still takes precedence, as for any model.
profile.mcp (remote, stdio)
Replaces the target’s MCP servers.
profile.mcp.auto
Enables the MCP servers on /v1/chat/completions without metadata.mcp_servers, when MCP is enabled and the caller has the mcp permission. See MCP.
profile.client_tools: drop
Discards tools and tool_choice sent by the client.
profile.evidence_check.numbers
Marks answers that contain numbers without evidence in the request. See Evidence check.
profile.evidence_check.note
Text appended by the evidence check. Defaults to an English note.
profile.evidence_check.sources
Appends the URLs the request’s MCP tools returned to an answer that names no URL. See Source line.
profile.evidence_check.sources_label
Label of the source line. Defaults to Sources.
profile.evidence_check.urls
Marks answers that name links neither the request nor a tool returned. See Links not retrieved.
profile.evidence_check.urls_note
Text appended by the link check; {urls} is replaced by the links. Defaults to an English note.
profile.require_tool
Makes the first model call of a request call one of the profile’s MCP tools. See Requiring a tool call.
name:researcheralias:my-llama-3profile:system_prompt:You are a careful research assistant. Cite your sources.client_tools:dropmcp:auto:trueremote:| {"mcpServers": {"search": {"url": "http://search.internal/mcp"}}}
Requests to researcher run on the same backend process as my-llama-3:
the model is not loaded a second time, however many profiles point at it. A
separate model config with its own backend and model file would load the
weights again. Fields the profile does not set are taken from the target.
The block is opt-in. Only fields inside profile are applied: top-level fields
on an alias (system_prompt, mcp, sampling parameters, templates, …) are
still ignored, so an alias without a profile block behaves exactly as before.
A profile block on a model that is not an alias is rejected.
MCP sessions of a profile with its own servers are kept apart from the target’s,
so profiles with different tool sets do not interfere with each other.
GET /v1/mcp/servers/<alias> (and the prompts and resources endpoints) report
the servers a chat request for the alias would use, so a profile’s tool set can
be checked without calling the model.
Evidence check
With server-side MCP tools, the client sees only the final answer, not the tool
calls. On the next turn the tool results are missing, so the model may invent a
number instead of calling the tool again. The evidence check marks such answers
at the output, independently of the prompt:
name:bookkeeperalias:my-llama-3profile:mcp:auto:trueremote:| {"mcpServers": {"ledger": {"url": "http://ledger.internal/mcp"}}}evidence_check:numbers:true# optional, defaults to the note belownote:"_Note: this answer contains numbers that no tool returned in this turn — not verified._"
The rule is deterministic and applies to each request on its own:
If an MCP tool call succeeded on the server during this request, the answer
is left unchanged. A call that failed (the tool could not be called or
returned an error to LocalAI) delivers no evidence and does not count.
Otherwise every number in the final answer (a digit sequence, optionally with
one . or , decimal part) is looked up among the numbers of the request as
received: the profile’s system prompt and the content of every system, user,
assistant and tool message. 3,5 and 3.5 count as the same number.
If at least one number of the answer is not found, the note is appended after
a blank line. In a streamed response it arrives as one additional content
chunk before the final chunk.
Answers that hand tool calls to the client are not checked. The check is off
unless numbers: true is set, and note without numbers: true is rejected.
It marks a suspect answer. It cannot tell whether the answer is right: a number the client happened to mention is
accepted even if the answer uses it wrongly.
Source line
A research profile usually asks the model in its system prompt to cite its
sources. A model can still answer from a search result without naming a single
link, and the client never sees the tool results that held them. With
sources: true LocalAI adds the links at the output:
name:researcheralias:my-llama-3profile:mcp:auto:trueremote:| {"mcpServers": {"search": {"url": "http://search.internal/mcp"}}}evidence_check:sources:true# optional, defaults to "Sources"sources_label:Quellen
Like the number check it acts on /v1/chat/completions. The rule is
deterministic and applies to each request on its own:
Only the results of MCP tool calls that succeeded on the server during this
request are read. The client’s messages and failed calls are not a source.
If the final answer already contains an http:// or https:// URL, it is
left unchanged.
Otherwise the distinct URLs of those tool results are collected in the order
they first appear, at most five, and appended after a blank line as one line:
Quellen: https://a.example/test, https://b.example/oil. Punctuation that
ends a sentence is not taken as part of a URL. Parentheses inside URL paths
and query parameters in JSON-encoded MCP text results are preserved.
If no tool result contains a URL, nothing is appended. No URL is ever made
up: every link on the line was returned by a tool.
An empty final answer gets nothing appended, so a source line never stands in
for an answer the model did not give.
In a streamed response the line arrives as one additional content chunk before
the final chunk, like the number note. Both checks can be enabled together; the
number note follows the source line. sources_label without sources: true is
rejected.
Links not retrieved
A model can also name a link it never opened: a plausible deep link on a known
site, written from memory. The client cannot tell such a link from one a search
tool returned, because it never sees the tool results. With urls: true LocalAI
marks it at the output:
name:researcheralias:my-llama-3profile:mcp:auto:trueremote:| {"mcpServers": {"search": {"url": "http://search.internal/mcp"}}}evidence_check:urls:true# optional; {urls} is replaced by the links, defaults to the note belowurls_note:"_Note: this answer names links that no tool returned in this turn — not retrieved: {urls}_"
Like the other checks it acts on /v1/chat/completions, streamed or not. The
rule is deterministic and applies to each request on its own:
Every http:// or https:// URL in the final answer is collected, bare or
inside a Markdown link. Punctuation that ends a sentence is not part of it.
Evidence is every URL in the request as received (the profile’s system
prompt and the content of every system, user and tool message) and in the
results of the MCP tool calls that succeeded on the server during this
request. Assistant messages are not evidence, so a link the model invented on
an earlier turn is marked again when the client sends it back. Failed tool
calls deliver no evidence.
Links are compared without scheme, fragment, a leading www. and a trailing
slash; the host is compared case-insensitively, path and query exactly. A
link counts as retrieved when it equals an evidence URL or is a shorter form
of one at a / or ? boundary: https://a.example is backed by a retrieved
https://a.example/report.pdf, but https://a.example/other.pdf is not.
If at least one link is not backed, the note is appended after a blank line
with up to five such links. In a streamed response it arrives as one
additional content chunk before the final chunk. If urls_note contains no
{urls}, the links follow the note after a space.
The source line, this note and the number note can be enabled together and are
appended in that order. urls_note without urls: true is rejected. The check
marks a suspect answer and cannot tell whether it is right: a link that was retrieved can still be cited for a
claim the page does not make.
Requiring a tool call
A system prompt that says “always search first” does not stop a model from
answering a question from its own knowledge, for example when the question comes
with a picture. require_tool: true enforces the first step in the request
instead:
When the switch is set and a /v1/chat/completions request offers the
profile’s server-side MCP tools, the first model call of the request is made with
tool_choice: "required". Every follow-up call of the server-side tool loop is
made with the tool_choice the client sent (or none), so after the tool results
the model is free to answer. A required that stayed in place would make the
model call a tool again after every result and never answer until the loop’s
iteration limit.
How required is enforced depends on the model:
With template.use_tokenizer_template (llama.cpp with the model’s own chat
template), LocalAI passes tool_choice: "required" to the backend, which
constrains the output to a tool call with a grammar built from the chat
template’s tool-call format.
When LocalAI builds the tool-call grammar itself, the first call’s grammar
leaves out the no-action function (answer) the model would otherwise reply
with directly.
The first call is not forced when:
no server-side MCP tool was offered (MCP disabled, the caller lacks the mcp
permission, or the profile has no servers),
the client set tool_choice (other than auto) or function_call itself,
which keeps precedence,
the request does not end with a user message. A request that ends with a
tool message returns the result of a tool the client ran itself; forcing
another call there could bounce tool calls between client and server.
The switch applies per request, so every new user turn starts with a tool call.
It enforces that a tool is called, not which one or with which arguments.
Image requests on a text-only target
A text-only model behind an alias rejects image input. vision_alias names a
model that serves the alias’s requests that carry an image, while text requests
stay on the target:
name:assistantalias:my-text-llmvision_alias:my-vision-llmprofile:system_prompt:You are the everyday assistant.
A chat request to assistant is served by my-vision-llm when a message
contains an image part (image_url, input_image or image) and the target
my-text-llm cannot accept images. The alias’s profile block is applied to
my-vision-llm in the same way, so the assistant keeps its system prompt and
tools. If the target accepts images itself, vision_alias is not used.
The vision model must exist and must not be an alias; a disabled vision model
is refused like any disabled model. vision_alias on a config that is not an
alias is rejected. At load time LocalAI warns when the vision model is missing,
is an alias, or declares no image input.
Managing aliases
You can create, swap, and remove aliases from any of the management surfaces.
Web UI
Open Add Model and pick the Alias / Routing template, then set a name
and a target. To re-point an existing alias, edit it and change the target.
REST API
Create: POST /models/import
Swap the target: PATCH /api/models/config-json/:name
List all aliases: GET /api/aliases
Delete: POST /models/delete/:name
Assistant and MCP
The LocalAI Assistant (and the MCP server) expose the same operations as tools:
set_alias, list_aliases, and delete_model.
Note
You cannot turn an existing real model into an alias. If you run set_alias
(or PATCH /api/models/config-json/:name) against a name that is already a real,
non-alias model, the request is rejected. An alias is a pure redirect, so it
must not carry a backend or parameters.model; a real model does, and merging
an alias onto it produces an invalid config that validation refuses with
alias config ... must not set backend or parameters.model. This is intentional:
it stops a stray set_alias call from clobbering a model that is serving.
To add an alias, point a new name at the target instead of reusing an
existing model’s name. Re-pointing an existing alias at a different target
is fully supported and is the live-swap path: the alias config has no backend of
its own, so swapping its target stays a valid pure redirect.
Aliases as deployment slots (distributed mode)
In distributed mode an alias can
carry a scheduling rule. POST /api/nodes/scheduling accepts an alias for
model_name, and the rule then governs whatever model the alias points at:
Re-point production and the placement policy follows it, so the alias behaves
as a stable slot whose contents you can swap. Because a replica is shared by
every name that resolves to it, only one rule may govern a given model at a
time. See Scheduling a model alias.
Limits
Aliases are a static 1:1 redirect; a profile block changes only the fields listed
above, not the model or its loading options. For classifier-based or load-balanced
selection across several downstream models, use the intelligent router in the
Middleware feature instead.
Model Failover
A failover chain is a model name that is served by an ordered list of
other models. LocalAI sends each request to the first healthy target. When a
target fails, the request moves to the next target, and later requests stay
there until the first target has recovered.
Use it to serve a model from a remote LocalAI or another OpenAI-compatible
provider, and to fall back to a local model when the remote one is down.
Declaring a chain
name:assistant-llmfailover:targets:- model:argus-llm # for example a localai-proxy or cloud-proxy model- model:gemma-localwarm:true# keep it loaded
Clients call assistant-llm. Each target is a normal model config. A chain
has no backend and no parameters.model.
Optional settings, with their defaults:
failover:probe:interval:15s # how often an idle target is checkedtimeout:5strip:errors:1# failures within the window that mark a target downwindow:30srecovery:probes:3# test requests a target must pass before it is used againmin_dwell:60s # minimum time on a lower target before moving back
Rules:
A chain needs at least 2 targets. A target can be an alias, but not another
chain.
A chain cannot also set alias or backend.
Responses name the chain as the model. The X-LocalAI-Served-Model header
names the target that served the request.
The entries that a remote
creates are remote models. They can be targets of a chain like any other
localai-proxy or cloud-proxy model. The health check sends the key of
the remote, with the same address check as a model load.
A remote (localai-proxy or cloud-proxy) target receives its own model
name, never the chain name: proxy.upstream_model, or the target name when
upstream_model is empty. The health check looks for the same name.
How the target is chosen
The active target is the first healthy target in the list.
When a target fails, LocalAI marks it down and moves to the next target at
once.
LocalAI moves back to a higher target only when that target has passed
recovery.probes test requests and the current target has been active
for at least recovery.min_dwell. This stops an unstable upstream from
moving traffic back and forth.
When all targets are down, the chain is degraded. Each request still tries
every target in order.
Spread requests over the targets
By default a chain uses its targets in priority order. Set policy to spread
the requests over every healthy target instead:
name:shared-qwenfailover:policy:least_busy # or round_robin; the default is prioritytargets:- model:qwen-local- model:qwen-branch # an entry of a remote LocalAI- model:qwen-labdrain:true# takes no new request
policy
Which target a request starts on
priority (default)
The active target: the first healthy target in the list.
least_busy
The healthy target with the fewest requests in flight from this server. Ties go to each target in turn.
round_robin
Each healthy target in turn.
With every policy, a target that fails is marked down and the request moves
to the next target, as described above. A target with drain: true takes no
new request: requests in flight finish and the health checks go on, so the
target is ready when you set drain back to false. A pin still chooses a
drained target. At least one target of a chain must not be drained.
A target that is a remote over P2P and that LocalAI reached through a relay
that limits the connection is tried last by least_busy and round_robin:
it takes a request only when no other target can.
A chain with least_busy or round_robin is what a
federation group is. The
Federation page and its API make and change these chains for you.
Retry inside a request
When a target fails before the response starts, LocalAI sends the same
request to the next target. The client does not see the failure.
LocalAI does not retry after the first byte of a response is sent (for
example after the first streamed token). The request fails, the target is
marked down, and the next request uses the next target.
A target that is at its concurrency limit (an admission rejection) or that
is disabled is skipped for that request without being marked down.
LocalAI does not retry client errors (4xx), such as a prompt that is too
long, because the next target would reject it too. A 4xx counts neither as
a success nor as a failure for the target.
Request bodies larger than 32 MiB are not retried.
When the primary did not serve the request, the response has the header
X-LocalAI-Failover: fallback, or X-LocalAI-Failover: degraded when all
targets were down.
Health checks
Target
Regular check
Check before moving back
Remote (localai-proxy, cloud-proxy)
GET /v1/models on the upstream lists the model
one small real request, for example a 1-token completion
Local, warm: true
the backend answers a health check. A check never loads the model: while it is not loaded, the check passes and real requests judge it
one small real request. While the model is not loaded, the target is used again after min_dwell
Local, not warm
none: judged only by real requests; it is never loaded only to check it
none: the target is used again after min_dwell
A request that succeeds counts as a check, so a busy target is almost never
probed.
When a target is in more than one chain, its check settings come from the
first of those chains in name order.
Warm targets
warm: true loads a local target at startup and protects it from idle and
LRU eviction, so a switch does not wait for the model to load. Warm targets
count toward the active backend limit (--max-active-backends) like any
pinned model: LocalAI never evicts them to make room, and if they fill the
limit, a new model still loads rather than being blocked.
warm applies only to local targets. On a remote (localai-proxy or
cloud-proxy) target it has no effect, and LocalAI logs a warning when it
loads the chain.
LocalAI resolves the chain for every call of the stage, in full pipelines and
in transcription-only and sound-detection-only sessions. When a chain switches,
the session stays open and keeps its conversation. The next turn uses the new
target.
The session receives a localai.model.failover event for each chain stage when
it starts (reason: initial) and each time a chain switches:
This pipeline runs its transcription, LLM and TTS stages on a remote LocalAI
(argus) through localai-proxy
models, and uses local models when the remote instance is down. Each stage has
its own chain, so one stage can fail over while the others stay remote.
# Remote targets: each one names the model on the upstream LocalAI.name:argus-sttbackend:localai-proxyknown_usecases:[transcript]options:- realtime_pipeline:asr-pipeline # upstream pipeline for live transcriptionproxy:upstream_url:http://argus.lan:8080upstream_model:parakeet---name:argus-llmbackend:localai-proxyknown_usecases:[chat]proxy:upstream_url:http://argus.lan:8080upstream_model:gemma-3-12b---name:argus-ttsbackend:localai-proxyknown_usecases:[tts]proxy:upstream_url:http://argus.lan:8080upstream_model:kokoro---# One chain per stage, remote first, local second.name:stt-chainfailover:targets:[{model:argus-stt}, {model: whisper-local, warm: true}]---name:llm-chainfailover:targets:[{model:argus-llm}, {model: gemma-local, warm: true}]---name:tts-chainfailover:targets:[{model:argus-tts}, {model: piper-local}]---name:assistantpipeline:vad:silero-vadtranscription:stt-chainllm:llm-chaintts:tts-chain
The example shows the configs as one YAML stream; put each config in its own
file in the models directory. When argus stops
answering, the next call of each stage fails over to the local model and the
session receives a localai.model.failover event for that stage. A remote
target that does not support a call (it returns Unimplemented) is skipped for
that call and is not marked down.
Limits:
After a session.update that changes the pipeline, localai.model.failover
events keep describing the chains from session start.
A chain used as a router candidate, or as the classifier-mode scoring model,
is not resolved per call.
Watching failover
GET /api/failover lists every chain, its active target and the state of
each target.
GET /api/failover/{chain} returns one chain.
GET /api/failover/events is a server-sent event stream. The first event is
snapshot with the full state. Then chain.switched and target.state
events follow.
Metrics: localai_failover_switches_total{chain,from,to,reason} and
localai_failover_target_up{target}.
With tracing on, each skipped target appears in the Traces view with the
error that made LocalAI skip it.
Pinning a target
An admin can force a chain to one target, for example during maintenance:
While a chain is pinned, only the pinned target serves it. Health checks
continue. On a single LocalAI instance, a restart removes the pin. In
distributed mode, pins persist.
In the UI
The model editor’s template picker has a Failover Chain template that
starts a new model with two empty targets. Any model can also add a
failover.targets field directly: each row picks a target model and a
warm toggle, with move up/down and remove controls. The toggle is
available on every row; warm has no effect on a remote (localai-proxy or
cloud-proxy) target, and LocalAI logs a warning when it loads a chain with
one set. The field flags fewer than two targets, a duplicate target, and the
chain naming itself as one of its own targets.
Opening an existing chain in the model editor shows a health strip: the
chain’s status pill, its active target and how long it has been active,
and a table of every target with its kind, warm flag, status, last probe
time and last error. An admin sees a Pin button on each target and an
Unpin action for the chain, both behind a confirmation dialog.
The Failover page (/app/failover, admin only) lists every chain with
its status pill, active target, a small pill per target, and time since the
last switch. It links each chain name to its model editor page and shows an
empty state linking to the failover template when no chains exist yet. It
sits under Admin → Models and runtime on a single install and is the
Failover view of Admin → Cluster → Placement when distributed mode is
on. On a cluster it also describes what the
router and the health monitor do when a worker stops answering, and shows a
preview of what would stop if a chosen node went away, worked out in the
browser from the loaded replicas and the placement rules. The server does not
compute that preview.
The Installed Models list badges a model that belongs to a chain with
chain → <active target>, next to the alias badge.
All of the above update live from the same event stream as
GET /api/failover/events; the strip, the overview page and the badge do
not need a page refresh to reflect a chain.switched or target.state
event.
Assistant and MCP
The LocalAI Assistant and local-ai mcp-server offer list_failover_chains,
pin_failover_target and unpin_failover_target. Create and edit chains with
the model config tools, like any other model.
Pins apply to the whole cluster. LocalAI stores them in the database, so
they persist across restarts. A pin set on one frontend applies on all.
Target health and the active target of each chain are shared over NATS, so
all frontends converge on the same target for a chain.
One frontend, the probe leader, runs the health checks, decides fail-over
and fail-back, and loads warm targets. The leader holds a PostgreSQL
advisory lock and keeps it until it stops or its database connection fails.
Then another frontend takes the lock and becomes the leader: immediately
when the leader shuts down or its process exits, and within about 30 seconds
when the leader’s host or network fails.
Warm targets stay loaded on the workers. The router and the replica
reconciler treat them like pinned models and do not evict them.
A frontend that starts late gets the current state within 10 seconds,
because the leader sends its full state again every 10 seconds.
If PostgreSQL is not available, no frontend holds the lock. Health checks
and fail-back stop until the database is back. Requests still fail over to
the next target when a target fails during the request.
If a frontend cannot start the shared state, it logs an error and manages
failover alone, as a single LocalAI instance does.
Leadership follows the database lock, not NATS. A leader that loses its NATS
connection but keeps its database connection stays the leader. Until NATS
recovers, the other frontends keep the last decisions they received from it,
and its new decisions do not reach them.
Each frontend reads the pins from the database again every 30 seconds and
after a NATS reconnect, and applies any change within 10 seconds. A frontend
that missed a pin or an unpin catches up in this way. If a pin cannot be written to the database, LocalAI returns an
error and restores the previous pin.
The requests in flight that least_busy counts, and the turn of
round_robin, are kept by each frontend for itself. They are not shared:
each frontend spreads its own requests.
LocalAI can pull backends, models and gallery indexes from locations that need authentication: private OCI registries (GHCR, Quay, Harbor, Artifactory, ECR), internal HTTP servers, and private GitHub repositories.
You give LocalAI a credentials file. Each entry matches a URL prefix and says how to authenticate. Gallery files never contain secrets, so you can share a gallery and keep the credentials separate.
Credentials file
Pass the file with --credentials-file or LOCALAI_CREDENTIALS_FILE. If neither is set, local-ai run reads credentials.yaml from the data path (LOCALAI_DATA_PATH) when that file exists.
If you use the desktop app, you can set registry credentials in its settings instead. The app writes the file for you. See Registry credentials.
# Basic auth for a private registry. The password comes from an env var.- match:ghcr.io/acmeusername:botpassword_env:GHCR_TOKEN# Bearer token for an internal model server, read from a mounted secret.- match:https://models.acme.internal/bearer_file:/var/run/secrets/acme/token# Private GitHub repository used by a gallery (github: URIs).- match:github.com/acmebearer_env:GITHUB_TOKEN# Artifactory-style API key header.- match:artifactory.acme.internalheader:name:X-JFrog-Art-Apivalue_env:ART_KEY# Registry on a private network address. Image pulls from it are matched# as http://, so the entry needs allow_insecure and no https:// scheme.- match:192.168.1.5:5000username:cipassword_file:/run/secrets/registry-passwordallow_insecure:true
Each entry has:
Key
Description
match
URL prefix: a host, optionally followed by a path, optionally with http:// or https://. Required. It must not contain credentials (user:token@host), a query string (?) or a fragment (#).
username + password, password_env or password_file
Basic authentication.
bearer, bearer_env or bearer_file
Bearer token. For registries it is sent as a registry token. GHCR, Docker Hub and Quay do not accept a bearer entry: use basic auth with any username and the token as the password.
header.name + header.value, header.value_env or header.value_file
A custom header. HTTP downloads only; registries ignore it.
allow_insecure
Allow sending this credential over plain http://. Default false. Registries on local or private addresses need it, see Registries on the local network.
Use exactly one authentication type per entry, and exactly one of the plain, _env or _file forms per secret.
LocalAI checks the file when it starts and stops with an error if the file is not valid. Unknown keys are errors, so a misspelled key such as pasword_env does not load silently. For a value of the wrong type, the error gives the line number but does not show the value.
LocalAI reads _env and _file values each time it needs them. A rotated Kubernetes secret mount is used without a restart. Trailing newlines in secret files are removed.
How matching works
Only https:// URLs get credentials. http:// URLs get credentials only from an entry with allow_insecure: true (see Registries on the local network). Other schemes never get credentials.
The host must be equal. ghcr.io does not match ghcr.io.evil.net.
The path matches whole segments. ghcr.io/acme matches ghcr.io/acme/backend but not ghcr.io/acme-tools/backend.
A URL whose path has . or .. segments never gets credentials.
If more than one entry matches, the entry with the longest path wins. If two entries are equal, the first one in the file wins.
If match has a scheme, the request must use that scheme. Without a scheme, the entry matches HTTPS, and also plain HTTP when allow_insecure: true is set.
github.com/<org> also matches the raw.githubusercontent.com/<org>/... URLs that github: URIs download from.
docker.io also matches index.docker.io and registry-1.docker.io.
LocalAI checks every redirect separately. If a server redirects a download to a CDN that no entry matches, LocalAI sends no credentials to the CDN.
Registries on the local network
The registry client treats some registry names as local and uses http as their scheme:
a name that starts with localhost: (a port is given, for example localhost:5000)
a name that ends in .localhost, with or without a port (for example registry.localhost:5000)
a name that contains 127.0.0.1 or ::1
an IPv4 address in 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16, with or without a port
For these registries, LocalAI always matches image pulls as http://<registry>/<repository>, whatever scheme the connection uses in the end. An entry written as https://192.168.1.5:5000 never applies to image pulls from that registry.
The entry for such a registry needs allow_insecure: true, and its match must have no scheme or use http://. No scheme is recommended, for example match: 192.168.1.5:5000 with allow_insecure: true, because the same entry then also covers downloads that use HTTPS.
What uses the credentials
Gallery indexes and mirrors (galleries, backend_galleries), including github: URLs and galleries published as oci:// artifacts.
Model files and model configs downloaded over HTTP(S) or github:.
Backend images and oci:// / ollama:// models, including resumed layer downloads and cosign signature checks.
For registries, LocalAI checks the credentials file first. If no entry matches, it uses your docker login (~/.docker/config.json or DOCKER_CONFIG). Hosts that already use docker login do not need a credentials file.
For ollama:// models, only the blob downloads use credentials. LocalAI fetches the model manifest without credentials, so the manifest must be readable anonymously.
A credential passed directly by LocalAI (for example HF_TOKEN for managed Hugging Face artifacts) takes precedence over the file.
Errors
When a server refuses a download with status 401 or 403, the error shows which case applies:
authentication required for <target> (status <code>): no credentials rule matches it: add an entry that matches this URL. For registries the message continues with and docker config credentials, if any, were not accepted, because LocalAI also tried your docker login.
credential "<match>" was rejected by <target> (status <code>): an entry matched, but the server did not accept it. Check the secret and its permissions.
the provided credential was rejected by <target> (status <code>): the download carried a credential that LocalAI got from somewhere other than the file (for example HF_TOKEN), so the file was not used. Check that credential.
Each message ends with the reason the server gave, when there is one, for example a registry’s DENIED detail. For HTTP downloads only the status text is shown, because the request URL can contain a signed query string.
If an _env variable is not set or a _file cannot be read, LocalAI logs a warning at startup and keeps the entry, because a secret mount can appear later. A download that matches the entry fails with an error that names the variable or file. LocalAI does not retry that download.
The controller downloads models and sends them to the workers, so model downloads only need credentials on the controller.
Each worker pulls its own backend images. To install backends from a private registry, give every worker the same credentials file. LocalAI does not send credentials over NATS. If a worker has no matching entry and no docker login for that registry, the install fails, and the node’s install error says that no credentials rule matches.
Backends
A backend is the program that runs a model. LocalAI downloads the right one the first time a model needs it, and you rarely have to choose.
Available Backends
LocalAI ships more than 80 backends covering text generation, speech-to-text, text-to-speech, music and sound generation, image and video generation, vision and object detection, audio processing, reranking, fine-tuning, and more. Each one is published as an on-demand OCI image with the appropriate acceleration variants (CPU, CUDA 12/13, ROCm, Intel SYCL, Vulkan, Metal, Jetson L4T).
Manage backends in Admin → Runtime → Backends. It is one list with two views, Installed and
Catalog, each with a count:
Catalog browses configured galleries, searches by name or description,
filters by capability, and installs a backend. Catalog is the default view.
On a new installation with nothing installed it recommends llama-cpp, which
runs most text models, with a single install button.
Installed shows the runtimes present on the host or cluster, those with
an update first.
Target-node links compose with the current view and selection instead of
opening a separate management page.
Above the list there is one row of controls: the two views, the search, a
Filters button and a More menu (⋮). The row stays at the top of the
page while you scroll a long list.
Filters opens a menu (a sheet on a phone). In Installed, filter by state:
user, system, with an update, or on an offline node. In Catalog, filter by
type: chat, image, video, TTS, STT, or vision. In both, Variant builds
and Development builds show the builds that are hidden by default, and,
when library sources are set up, Library narrows the list to one source.
The button shows how many filters are on.
The line under the controls shows how many backends are listed, each active
filter as a chip that you can remove, and, when updates exist, N updates
available · Review. Review opens the Updates page
on the ready updates.
More holds the actions you need less often: Updates opens the
Updates page, where Check now runs a real check,
Install from URL… installs a backend from an OCI image, a URL or a path,
and Manage libraries… opens the library sources panel.
Each row shows the backend, its version and its state: Current, Update
1.2.0, Not installed, Queued, Removing, or a progress bar while it
installs, with Cancel in the row. A failed install says why, with Retry.
The one action that matters sits in the row (Install, or Review when
an update exists). The row menu (⋮) holds Reinstall backend and Delete
backend in both views, and the chevron opens the row for the rest. This page
starts no update of a gallery backend. Review on a row only opens the
Updates page: the page of that backend when nodes report it (it asks before
it updates a node), otherwise the list of ready updates. The update runs there,
as an operation in Activity. A backend that came from a library keeps its
Update button in the row, which installs the newer build that library
lists and shows the progress in the row. The same update is also listed on
the Updates page.
The current view, search, filter, open row, and target node are stored in the
URL, so a shared link opens the same state.
Removing a backend asks first. The dialog names the configured models that
ask for that backend by name, and any installed meta backend that points at it
(for example llama-cpp pointing at a hardware-specific build), because those
stop working without it. The catalog does not report a size per backend, and
LocalAI keeps no earlier version of a backend once an upgrade has finished, so
there is no size column and no rollback after the fact.
Admin → Runtime → Logs (/app/backend-logs) lists the backend processes
that have printed something. Open one to read its output live, filter by stream
or text, follow the end, show or hide times, export the lines as JSON, or clear
them. Clearing hides the lines at once and wipes them on the server after 6
seconds, unless you press Undo.
Installs run in the background. The strip at the top of the app follows the
current one, and Admin → Activity lists everything in flight, what needs
attention, and what has finished, and is where a running install is paused,
cancelled or a failed one retried. See Activity.
Each open row displays:
Backend name and description
Type of models it supports
Installation status
Version, source, digest, placement, and catalog information
The models that use the backend, a link to its logs, and, in a cluster, the
per-node controls
The Updates page
Admin → Updates (/app/updates) is the one place that answers “what is
out of date, and what is changing”. It is for administrators. It lists backends of the gallery, backends of a library, add-ons and, in their
own rows, the installed gallery models whose entry changed (see Model
updates; in a review, models start unselected).
At the top, one sentence says how many updates there are and how many are ready,
updating or need you. Under it a line for each source (the backend gallery, the
backend library and the add-ons) says when it was last checked or why the check
failed, and the two settings Update backends automatically and Update
add-ons automatically are shown as facts, with a link to Settings. The page
never says “Everything is up to date” while a source failed or was never
checked. A failed source gets a red notice that says what may be missing, and
the list keeps the last good result and marks its rows as from an earlier check.
The rows are in four groups, in this order:
Group
What is in it
Needs you
An update that failed (Retry), an add-on upgrade that is held until you approve the access it asks for (Review), and an update that cannot start, with the reason (an add-on that cannot run on this host, or backend installs turned off on this server).
Updating
An update in progress, with its phase and progress. Cancel shows where the operation can be cancelled.
Ready to update
An update that you can start. Update opens the review of that row.
Up to date
One collapsed line. A backend is listed here only when its source answered.
Check now runs a real check of every source and waits for the answer. It
asks the registries (at most 45 seconds), reads each add-on library with your own
browser session, and shows the result under the sentence. The button waits 15
seconds before the next check, as the server answers a check within that time
from the last one.
Review and update run
Every update starts with a review, and nothing changes until you start it.
Update N ready reviews every ready row. Update or Retry on a row
reviews that row only. The server makes the plan of the review:
The items are grouped by kind: backends, add-ons and models. Each item has a
checkbox and its versions.
An item shows a risk line only when the server knows the risk. In a
cluster, a backend says how many loaded models stop while it switches and on
how many nodes (“Stops 2 loaded models on 2 nodes while it switches”). When
no loaded model is known to use it, it says on how many nodes it is replaced,
and when the nodes run different builds now, it says so. A single server does
not know which models use a backend, so its backends have no such line. An
add-on says that its data is backed up and migrated. A model update that
changes only the settings says that nothing is downloaded. See
Risks.
The versions are the versions you know: an add-on shows “0.8.1 to 0.8.2”,
and the run pins the exact release the review showed.
Models start unselected, because an update reloads a model. Select all,
Select none and the count (“6 of 8 selected”) are at the top.
An item that cannot start (for example a held add-on) shows the reason and
cannot be selected.
The primary button starts an update run with the selected items. The
Upgrade and Retry of a model row, and an approved add-on upgrade, start
a run of one item; the page shows that run as soon as the server accepts it. The server
owns the run. It updates the backends first, then the models, then the add-ons
one at a time. Each update keeps the previous version until the new version
runs. You can close the page: the run continues, and the page shows it again
when you come back (the address /app/updates?run=<id> opens one run).
While the run is active, the top of the page says how many items are updated,
running and waiting, with a progress bar and Cancel remaining. Each queued
item has Cancel, and a running item has it while its update can still stop. The group
This update run lists the items in the order they run, with their state:
queued (with the reason it waits), updating (with progress), updated, failed,
rolled back, cancelled, skipped, or not confirmed. An item is updated only when
its operation ended without an error and a new check no longer lists it. When
the result is not known (for example, the reply of a worker was lost), the item
is “not confirmed”: run Check now to see its version.
When the run ends, the top of the page gives the result, for example “5
updated, 1 needs attention”. An item needs attention when it failed, was
rolled back, is not confirmed, or was skipped for a reason; a cancelled item
does not. The result in the notification center counts the same items. A failed item says what happened, which version
it is on now and that its data did not change. Retry shows only when the
server can retry the item; Details shows the server’s own words.
Retry failed runs the retryable items again, and Dismiss removes the
result from the page.
Each run also has one item in the notification center: it shows the progress
while the run is active, and when the run ends it is replaced by the result.
It opens the run on this page. The footer of the notification center has Open Updates with the
number of updates, for administrators.
In a cluster, a backend that more than one node has shows a Nodes action.
It opens /app/updates/backend/<name>, which lists each node with its version,
the models that use the backend there, and its state, and updates one node or
every node that needs it, after a confirmation that names the models that stop.
On the Updates page, such a backend is part of the review like any other row,
and its risk line says how many loaded models stop on how many nodes. See
the Workers page.
Shortcuts from other pages
Other pages show that an update exists and send you here; none of them runs a bulk
update of its own. The Backends page has Review in its rows and in the line above
its list. The Admin → Overview page lists the backends with an update as one row,
“N updates available”, with Review. The Apps page has Open Updates. The
Nodes page keeps its Update button for the nodes you selected, which opens the same
confirmation as this page, and a node’s Backends tab has Update for a backend that
is behind on that node.
The count on the Updates tab and on Admin
A number on the Updates tab and on the Admin item of the sidebar (on
every page, for administrators) counts what needs a person: ready updates that
no automatic setting covers, plus updates that failed, are held for approval, or
are blocked by something other than the server setting for backend installs. An
update that an automatic setting will apply is listed on the page but not
counted. The number is red when an update failed. One poll reads the numbers
once a minute while the browser tab is visible, and again when an operation ends.
The badge on the Admin item has one number at a time, so it follows an
order: failed operations first (red, counting the failed operations), then the
count above, then the number of operations that are running. The tab always
shows the count above, so the two numbers differ while an operation has failed.
Updates in the inbox
Administrators get updates in the inbox (the Notifications entry in the sidebar), so they see them on any page and, through browser push and a Telegram chat, away from the browser. Four kinds of item exist. Every one has a code and params, so the app words it in your language. Every one is for administrators only (when authentication is off, for the one local user). They work with the chats on or off, and they never go to a Telegram or Slack chat: only the runs of your triggers and connectors do.
The digest, “N backend updates available”. It counts the backend updates (gallery and library) that need a person: the same updates the badge of the Updates tab counts for backends. It does not count a backend that Update backends automatically covers, so with that setting on there is no digest, and a stored digest is removed. With the setting off, every update that the last check found is counted, and a server that refuses backend installs counts none. There is one digest for each administrator, kept up to date in place:
the first update creates it;
a new update brings it back as a new, unread item at the top, and pushes it once. A new update is an id that the digest did not show before: a backend and the version or digest it would move to. A newer release of a backend that the digest already listed is a new update;
when updates are done, the count goes down quietly: the item keeps its place and its read state, and nothing is pushed;
when you delete it, it is hidden, not forgotten. It stays hidden while the updates are the same or fewer, and it comes back, unread, for the next new update;
when none is left it is removed. A later update is then new again.
The digest changes only when every source that can be checked answered in that pass. A failed check does not turn “unknown” into “all done”.
The result of an automatic pass, “Backends: 2 updated automatically, 1 failed”. On a server that keeps upgrade runs, the automatic pass starts a run instead of installing, and the run writes its own items (see Notifications of a run); the item below is then written only by a server without runs. When the automatic update installed or failed to install something, the pass writes one item, with the counts and the names. A pass that did nothing writes nothing. The item is a failure (red) when anything failed, and then it links to the updates that need you. A report is written once: the same failure of the same release at the next pass (the pass retries every six hours) does not write it again, also after you deleted the first item. A different release, or a different set of outcomes, is a new item. Gallery models write their own items (see Model updates). Add-ons write their own item in their own pass (see Add-ons).
The end of an operation, “Model qwen3-4b installed” or “Backend whisper: install failed”. When an install, removal or upgrade that an administrator started completes, fails or is cancelled, the frontend that ran it writes one item for each administrator (code updates.opDone, or updates.opFailed with the outcome failed or cancelled). It is a once item keyed by the operation, so it is written once. A failure carries the reason. Model items open the Models page, backend items the Updates page.
The failed check, “The update check failed”. When the automatic check of the backend gallery or the backend library fails in two passes in a row (more than half a day), one item names the sources. It is removed when the check works again, and written again only if a source fails again for two passes. The Updates page shows the same failure on its source line at once.
Each item opens the Updates page on the list it is about: the digest opens Ready, a result with a failure or a held update opens Needs you.
What is not in the digest. Add-on updates are not counted in the digest. The state of an add-on update is read by the add-on owner with the session of an administrator, and the frontend that writes the digest may not be the owner; the digest would then change with whichever frontend holds the lock. The Updates page and its badge show add-ons. With Update add-ons automatically on, the add-on result is in the inbox. With it off, an add-on update shows on the page and in the badge only.
Who writes them. The digest, the failed-check item and the backend result are written at the end of the automatic pass, by the process that runs it. In distributed mode that is the frontend that holds the update lock (KeyBackendUpgradeCheck), so there is one writer for the cluster, and its push and Telegram forward happen once. A standalone server writes after each pass that may install. A check you start with Check now, a trigger after an operation, and the first check of a frontend write nothing.
Checking for backend updates
GET /backends/updates (the UI uses the alias GET /api/backends/updates)
lists the gallery and library backends that have a newer build. Both routes
need an administrator. The answer comes from the cache of the instance that
serves the request and contacts no registry. It has:
items: one entry per backend with an update. kind is gallery or
library. Each has installedVersion, availableVersion, the digests when
there are any, and a state: update (a newer version or digest), stale
(a request showed that the backend is older than the server; reason says
how) or drift (the nodes of a cluster do not agree on the build). A library
item also has sourceId and signed. In a cluster an item has nodes, with
the version of every node that has the backend and drift on the ones that
differ from the majority. With Update backends automatically on, an item
has heldBack: true when the automatic update does not take its release,
because the same release already did not start in a recent upgrade run (see
Automatic updates are runs).
You can still update it by hand.
sources.gallery and sources.library: the freshness of each source. state
is ok, failed, never (not checked since the server started) or
disabled (with a reason). A source also has checkedAt, lastSuccessAt
and error. When the last check failed, stale is true and items still
lists what the last good check found. A client must not say “no updates”
while a source is failed or never.
autoUpdate.backends: the value of Update backends automatically
(auto_upgrade_backends). It covers gallery and library backends.
checkedAt: the latest check of any source.
POST /backends/updates/check (alias POST /api/backends/updates/check) checks
now. It refreshes the library index, asks the registries, waits for the check
(at most 45 seconds) and answers with the same body, with fresh times. A check
that fails or times out is an error in the state of its source, and the
previous list stays. Callers that arrive during a check share it. A call within
15 seconds of the last check is answered from it, with throttled set. A check
installs nothing. The older POST /backends/upgrades/check still only starts a
check and returns the cache at once.
Starting an upgrade.POST /backends/upgrade/{name} (alias
POST /api/backends/upgrade/{name}) and POST /api/nodes/{id}/backends/upgrade
answer at once when the request cannot do anything, and queue nothing. The body
is {"error": "...", "code": "..."}:
Status
code
Meaning
404
not_installed
The backend is not installed (on that node, for the node route).
409
no_update
The backend is installed but has nothing to upgrade to: no newer build in the last check, or a backend that the system provides.
409
stale
The request named a build with expected_to and it is no longer the available one.
expected_to is optional. It is the version or the digest that the caller saw
in the update list, in the query or in a JSON body field of the same name. The
server compares it with the available build when it accepts the request, and
answers stale when it moved. The job then installs the build the gallery
lists when it runs; it does not compare it with expected_to again. The
integrity checks of the gallery entry (SHA-256, signature policy) run before
the swap. A request without expected_to upgrades to whatever is available.
A request is never refused as no_update from an old list. When the last
successful check is older than five minutes, or there is none, the request first
runs a check (the one of Check now, shared with a check that already runs)
and waits for it at most 15 seconds. The fresh list decides. When that check
fails or runs out of time the request is accepted, and the job reports what
happens. A request for a build with expected_to is compared with the list as
it is.
An upgrade that fails after it started ends the job with an error_key next to
the error text in the status of the job (GET /backends/jobs/{id}):
error_key
The step that failed
download
The new build could not be fetched or staged.
verify
A checksum or signature check refused the new build, or its content is not a runnable backend.
swap
The new build could not be moved into place. The installed build is restored.
start
The new build was moved into place but did not start. See below: the previous build is normally back.
not_installed, no_update, stale
As above, when the request was accepted and the state changed before the job ran.
unknown
Any other failure.
Read the error_key, not the text: the text can change. Cancelled jobs have no
error_key, and neither has a failed install. A panic in an upgrade ends as
unknown. In distributed mode the key is stored with the operation record
(gallery_operations.error_key, added by the automatic migration at start-up),
so every frontend and the history (errorKey) have it.
When the new build does not start. An upgrade keeps the build you have
until the new one has started once. After the new build is moved into place
and its metadata is written, LocalAI starts it from its final path, the way a
model load starts a backend, on a free local port of its own, and waits up to
40 seconds for it to answer a health check. Then it stops it again. Only when
the new build answered is the previous build deleted.
When the new build exits, or does not answer in time, LocalAI puts the previous
build and its metadata back, registers the backends again, and ends the job
with error_keystart and rolled_back: true. The error text ends with the
last lines the new build wrote (at most 512 bytes), for example a missing
shared library. The backend then runs the version it ran before. A metadata
write or a backend registration that fails after the swap is handled the same
way, with error_keyswap. When the previous build cannot be put back,
rolled_back is false, the text says so, and the failed build stays in place
for diagnosis next to the previous one (<name>.backup). The next upgrade
moves that previous build to <name>.backup.kept-<time> instead of deleting
it.
A forced reinstall of an installed backend (force: true) keeps the replaced
build in the same way. A first install starts nothing.
Limits of the start check:
It proves that the build starts and listens. It loads no model, so it does
not prove that a model loads, or that it loads on the GPU. A build that starts
but fails to load a model is found at the next load.
Models that run on the backend keep running during the check: the check uses
its own process and port, and running processes keep the files of the build
they started from.
Cancelling the job stops the check and puts the previous build back.
The check runs the downloaded build as the user LocalAI runs as. Without
strict integrity, a build with no SHA-256 and no signature policy runs at
this point, at upgrade time, and not only at the next model load.
Limits:
Library backends are those of the host. The library comparison reads the
backends installed on the host that answers. On a cluster frontend that holds
no backends, library backends installed on workers are not listed, and the
library source says so in its note.
Models that would stop. A node entry lists the loaded models whose
recorded backend has the name of the item. The node registry records the
backend a model was loaded with; it can be empty, or name a meta backend
instead of the installed build. An empty models list does not prove that no
model would stop.
Without a checker (backend installs are disabled, or no backend gallery is
configured) both sources are disabled and items is empty.
In distributed mode
the cache is per frontend. The frontend that gets a check request updates its
own cache only, whether or not it holds the lock that runs automatic updates.
checkedAt says how old each answer is.
The LocalAI Assistant reads the same data with the backend_updates tool
(actionlist or check).
Prefer installed development backends
Development builds are ignored when a stable build is installed. Set LOCALAI_PREFER_DEV_BACKENDS=true (legacy alias: PREFER_DEV_BACKENDS)
or pass --prefer-development-backends to prefer them for generic backend aliases. The default is false, which preserves existing selection,
including installations that contain only development builds.
When enabled, LocalAI selects compatible installed builds with an existing,
non-directory run file. It prefers names ending in -development (or the
configured LOCALAI_BACKEND_DEV_SUFFIX). Within that group, existing hardware
ranking and lexical-name ordering still apply. If no eligible development build
exists, LocalAI selects an eligible non-development build. If neither group has
an eligible build, it does not register the alias.
For example (my-engine is a placeholder name, not a real backend), generic my-engine selects cpu-my-engine-development
over cpu-my-engine when both are installed and compatible. A compatible
CPU development build also takes priority over a stable CUDA build.
An incompatible development build cannot take priority over a compatible stable
build. Compatibility uses LocalAI’s existing hardware heuristics, including the
LOCALAI_FORCE_META_BACKEND_CAPABILITY=disable override; it does not guarantee
that native libraries can load.
Explicit concrete names keep their original paths. Selecting
cpu-my-engine does not redirect to its development counterpart.
Installing a development image under a stable name does not rename that entry.
The preference also retains its existing development-first download behavior.
The Settings value prefer_development_backends supplies the frontend’s
preference at its next startup. POST /api/settings returns restart_required: true when this value changes,
while retaining the existing success and message response fields. Unchanged
values return restart_required: false. This notification does not reconfigure
the watchdog; genuine watchdog setting updates still apply live. Neither API
updates nor edits to runtime_settings.json change
registered paths or restart running models. The displayed preference can change
before the resolver adopts it. Startup uses the existing settings merge:
explicit default-valued CLI or environment values, including false, can be
indistinguishable from unset and do not necessarily override a saved true.
For distributed local-ai worker, set the flag or environment variable on each
worker, then restart it. Frontend flags and Settings changes do not configure
remote workers. Legacy specialized worker subcommands do not expose this
worker-local option.
Backend Galleries
Backend galleries are repositories that contain backend definitions. They work similarly to model galleries but are specifically for backends.
Adding a Backend Gallery
You can add backend galleries by specifying the Environment VariableLOCALAI_BACKEND_GALLERIES:
To use a backend gallery or backend images that need authentication, such as a private registry, add a matching entry to the credentials file. See Private Registries and Galleries.
Backend Gallery Structure
A backend gallery is a collection of YAML files, each defining a backend. Here’s an example structure:
name:"llm-backend"description:"A backend for running LLM models"uri:"quay.io/username/llm-backend:latest"alias:"llm"tags:- "llm"- "text-generation"
Verifying OCI Backends
The default backend gallery tries https://index.localai.io/backends, then github:mudler/LocalAI/backend/index.yaml@master, then oci://quay.io/go-skynet/local-ai-backends:gallery-backends. The OCI fallback is signed by gallery_publish.yml. Its artifact_verification policy applies only to the gallery artifact; verification continues to control backend image signatures. Existing custom gallery lists are not changed. See gallery publishing for details.
Backend galleries can require keyless Sigstore signatures for every OCI image
they provide. Add a verification policy to the gallery configuration, then
enable strict integrity mode:
exportLOCALAI_BACKEND_GALLERIES='[{"name":"localai","url":"https://index.localai.io/backends","mirrors":["github:mudler/LocalAI/backend/index.yaml@master"],"verification":{"issuer":"https://token.actions.githubusercontent.com","identity_regex":"^https://github\\.com/mudler/LocalAI/\\.github/workflows/backend_merge\\.yml@refs/(heads/master|tags/.+)$"}}]'exportLOCALAI_REQUIRE_BACKEND_INTEGRITY=1local-ai run
The policy pins the Fulcio issuer and the GitHub Actions workflow identity that
signed the image. The identity expression covers development images produced
from master and release images produced from tags. Use a narrower expression
if your deployment only accepts one release channel.
Without strict mode, an OCI gallery without a verification policy installs
with a warning. With strict mode, LocalAI refuses galleries without a policy,
images without a compatible Sigstore bundle, and signatures that do not match
the configured identity. Existing images published before bundle signing was
enabled must be rebuilt or re-signed before strict deployments can install
them.
An optional not_before RFC3339 value revokes signatures logged before that
time. Advance it after a signing-workflow compromise, then rebuild or re-sign
the trusted images:
When one reusable workflow signs images for several repositories, the
certificate identity names the shared workflow, not the repository that called
it, so an identity match alone accepts an image signed for any of those
repositories. Add source_repository to pin the repository the signature was
made for. LocalAI compares it exactly with the source-repository extension of
the signing certificate: a trailing slash, a different letter case or a .git
suffix does not match. The value must be an https:// URL, or LocalAI refuses
the policy when it uses it, when it installs a backend or fetches an oci://
gallery. LocalAI versions before this field existed ignore it and do not pin
the repository, so upgrade every node, workers included, before you rely on it:
Some deployments must not acquire executable code at runtime: production
systems that run only the backend set they were tested with, locked-down or
air-gapped hosts, images that are built once and then promoted unchanged, and
hosts where backends come from a package manager (placed under
--backends-system-path, LOCALAI_BACKENDS_SYSTEM_PATH). For all of these,
--disable-backend-install (LOCALAI_DISABLE_BACKEND_INSTALL=1) tells
LocalAI never to install or upgrade a backend itself:
exportLOCALAI_DISABLE_BACKEND_INSTALL=1local-ai run
What is refused:
installs from the backend gallery, from OCI images, URLs or local paths:
the Backends page, POST /backends/apply, the /api/backends/...
install routes, the LocalAI Assistant’s install_backend tool and the
LOCALAI_EXTERNAL_BACKENDS boot-time list;
upgrades: manual, “update all”, the Assistant’s upgrade_backend tool and
the background auto-upgrader, which is not started at all (upgrade checks
stop too, so no registry is polled for versions nobody can apply);
installing a model whose backend is not present: refused before anything
is downloaded, naming the backend, on every install path (gallery, import,
preload, the Assistant’s tools).
What still works: backends already installed, backends provided under the
system path, listing and browsing the backend galleries, and deleting a
backend. In distributed mode a model counts as installable when a healthy
worker has its backend, under its own name or an alias. Availability is
judged where inference runs. The frontend keeps no backends of its own.
How clients can tell: install and upgrade endpoints answer 403 with
"code": "backend_install_disabled"; installing a gallery model whose
backend is not present answers 409 with "code": "backend_not_installed"
and the backend’s name. GET /api/features and the capabilities object in
GET /.well-known/localai.json report "backend_install": false, and the
Backends page shows a notice and offers no install or upgrade actions.
The switch is read at start-up only; it is not a runtime setting. In
distributed mode
each worker enforces it for its own backends, so set it on every frontend
and every worker. The standalone local-ai worker ... subcommands honour
the same variable: they start with the backend already present under their
backends or system path and exit with an error instead of installing one.
The backend library and the generated gallery
The backend library, gallery/backends/index.yaml, is the source of truth of the backends, the way the model library is for the models. Edits go there. The backend gallery, backend/index.yaml, is a generated copy of it. It stays only so that releases from before the cutover, which read the gallery, keep working. Never edit it by hand; CI fails when it differs from the generated copy.
An entry of the library is one backend image for one platform, pinned by a digest. It carries what the gallery carried: the name, alias, description, license, urls, tags, an icon URL, the ordered mirrors and the capabilities map of a meta backend. A development image (a master- tag) keeps its tag and has no digest in the library; the install pins it. The Add-ons page lists every field.
Which source a build reads
A build reads one of the two by default, and the other stays listed so you can turn it on with local-ai library enable:
Build
Default backend source
From master, or a plain go build
The library (official-backends)
From a tag, before the cutover
The gallery (localai-backends)
From a tag, after the release workflow cuts over
The library
The value is set at build time with -X github.com/mudler/LocalAI/core/library.BackendSource=library (or gallery), through LOCALAI_BACKEND_SOURCE in the Makefile and GoReleaser. The Makefile picks gallery when the commit carries a tag. The release workflow has a step that sets LOCALAI_BACKEND_SOURCE=library, so a release build cuts over by itself. The container image Dockerfile pins LOCALAI_MODEL_SOURCE=library and LOCALAI_BACKEND_SOURCE=library as build arguments, so a tagged image reads the same sources as a release binary; pass --build-arg LOCALAI_BACKEND_SOURCE=gallery to build an image that reads the gallery. Any other value reads the library, so a build never has no backend source. --addons-backend-library=false removes the library and every build reads the gallery.
When the library is the source, LocalAI reads it as a gallery in library format. A backend installs by the tag and the mirrors of its entry, the way the gallery installs it, and the Backends page lists the same backends. If the library cannot be fetched or read, listing the backends fails with an error; LocalAI does not fall back to the gallery, so the problem is never silent. The library has no mirrors of its own. A backend library you add with local-ai library add is read by the add-on catalog only, which installs its images by digest.
Edit the library, generate the gallery
To add a backend, write its entries in the gallery shape in a scratch file (see Adding a new backend) and merge them into the library. Then generate the gallery:
go run ./scripts/backends/cmd/backendcatalog --add my-backend.yaml --library gallery/backends/index.yaml
go run ./scripts/backends/cmd/backendcatalog --library gallery/backends/index.yaml --out backend/index.yaml
The first command pins the latest- images that are in the registry to the digest of each platform. An image that is not published yet is written unpinned and mutable, and installs by its tag until a maintainer pins it with --repin. The second command reads the library with the same strict reader the host uses, converts every backend to a gallery entry and back, loads its own output the way the host loads a gallery, and fails if one backend does not come back equal. It does not use the network.
CI (the backend library workflow) checks the library file itself. It decodes, every entry passes the checks a host applies, every backend round trips, every meta backend names backends the library has, and the gallery reader loads the generated gallery and sees the same backends as the library. It then generates the gallery again and fails with a message to regenerate, not to edit by hand, when backend/index.yaml differs. The tests in core/gallery run the same checks on every entry of the real backend gallery from before the library became the source, kept as golden files in core/gallery/testdata/backend_library, and log how many entries they covered.
Installing from a library
A library of the Add-ons page can list backends too, and the backend library is one of them. A library entry installs with a pinned image digest, the signature check of the library and a size limit (8 GiB by default). The Browse tab of the Add-ons page shows each entry with its kind. See Backends in the library for the entry format, the signer pattern and the install route.
Pre-installing Backends
You can pre-install backends when starting LocalAI using the LOCALAI_EXTERNAL_BACKENDS environment variable:
exportLOCALAI_EXTERNAL_BACKENDS="llm-backend,diffusion-backend"local-ai run
Backend Directory Format
Every backend, whether the gallery installed it into the user-managed
location or a system package shipped it, is a directory with one
required file:
run.sh: the entry point LocalAI executes to start the backend.
and one optional file, metadata.json:
{"name":"rocm-audio-cpp","alias":"audio-cpp"}
name: the concrete backend name (defaults to the directory name).
alias: registers this directory as a variant of a backend
family. When several installed variants share an alias
(cpu-audio-cpp, rocm-audio-cpp, … all aliased to audio-cpp),
a model config using backend: audio-cpp resolves to the variant
best matching the host’s capability (CUDA before Vulkan before CPU
on an NVIDIA host, ROCm first on AMD, and so on). Each variant also
stays individually addressable by its concrete name, e.g.
backend: cpu-audio-cpp to keep VRAM free for other models.
meta_backend_for: points a meta entry at a concrete backend
directory installed next to it.
A directory without metadata.json is a plain backend under its
directory name. Gallery installs write this metadata automatically
(with additional bookkeeping fields such as gallery_url and
installed_at); it only needs writing by hand when packaging backends
outside the gallery.
System-Provided Backends
Backends do not have to come from the gallery: directories under
LOCALAI_BACKENDS_SYSTEM_PATH (default /var/lib/local-ai/backends, on
Windows %ProgramData%\LocalAI\backends)
are discovered on every scan, using the same
directory format as user-managed
backends. This is the integration point for distribution packages.
The package manager installs backends there, while gallery installs
keep living in the user-managed LOCALAI_BACKENDS_PATH.
One difference in error handling: a system directory with unreadable
metadata is skipped with a warning, while unreadable metadata in the
user-managed location fails the listing. A system package must not
be able to break the discovery of the user’s own backends.
Precedence between the two locations
User-managed backends always win over system-provided ones:
Same name in both locations: the user-managed backend hides the
system one entirely.
Family takeover: installing any variant of an alias family
into the user-managed location (e.g. from the gallery) replaces the
whole system family: the alias resolves only among user-managed
variants, and the system family’s concrete names disappear from the
listing. Variants of one family are versioned together; resolution
never mixes installations of different origins within a family, and
a stale system variant is not kept reachable.
Names never get hijacked: a system variant’s alias cannot take
over a name that exists as a user-managed backend (including a meta
backend): backend: audio-cpp keeps running the user’s audio-cpp installation even if
a system package later ships variants aliased to that name.
Creating a Backend
To create a new backend, you need to:
Create a container image that implements the LocalAI backend interface
Define a backend YAML file
Publish your backend to a container registry
Backend Container Requirements
Your backend container should:
Implement the LocalAI backend interface (gRPC or HTTP)
Handle model loading and inference
Support the required model types
Include necessary dependencies. Python backends are unpacked from the
builder path into a runtime directory, so packages must be installed into
the backend virtualenv with a regular pip install . / uv pip install .
not an editable (-e) source install. An editable finder keeps pointing
at the vanished builder tree, and import fails after relocation.
Have a top level run.sh file that will be used to run the backend
Pushed to a registry so can be used in a gallery
Warning
An already-installed Python backend that was built with an editable install
(for example vllm-omni from v4.0.0) keeps that broken finder until it is
replaced with a rebuilt artifact. Reusing or renaming the unpacked directory
does not rewrite the stale path; delete or upgrade the backend so the new
site-packages copy is what runs.
LLM Backends: For running language models (e.g., llama.cpp, vLLM, vllm.cpp, SGLang, transformers, MLX, the experimental Strata engine (NVIDIA CUDA, AMD ROCm, Intel SYCL, Apple Metal, prebuilt engine packages), the experimental colibri engine (very large mixture-of-experts models with the experts streamed from disk; CPU, Vulkan, Apple Metal), and RKLLM on Rockchip NPUs through the cloud-proxy backend)
Speech-to-Text Backends: For transcription, forced alignment and speaker diarization (e.g., whisper.cpp, parakeet.cpp, moss-transcribe.cpp, NeMo-Speech.cpp, faster-whisper, Whisper-Medusa, FunASR/SenseVoice, NeMo, audio.cpp)
3D Generation Backends: For image-to-3D mesh generation (trellis2.cpp: Microsoft TRELLIS.2, producing GLB assets with PBR textures)
Vision & Detection Backends: For object detection, segmentation, depth, and face/voice recognition (e.g., rf-detr.cpp, locate-anything.cpp, sam3.cpp, insightface)
Time-Series Backends: For quantile forecasting of numeric series (timestral.cpp, Mistral’s Timestral models)
Audio Processing Backends: For voice activity detection and audio enhancement (e.g., Silero VAD, LocalVQE, audio.cpp)
Source Separation & Voice Conversion Backends: For splitting a mix into named stems (vocals, drums, bass) and for converting speech or singing to a target voice (e.g., audio.cpp)
Utility Backends: For reranking, PII/NER token classification, fine-tuning, quantization, and vector storage (e.g., rerankers, privacy-filter.cpp, TRL, local-store, valkey-store, qdrant-store)
The DS4 backend stops inference when a client cancels or disconnects, including
when a streaming response can no longer be written. Already-streamed chunks
cannot be retracted; DS4 does not flush incomplete buffered parser state or
persist an abandoned request to the disk KV cache. Cancellation is cooperative:
DS4 checks it at safe prompt-prefill and decode-loop boundaries, so a GPU kernel
already in flight may finish before the request stops.
llama.cpp request cancellation
The llama.cpp backend stops a streaming generation as soon as the response can
no longer be written to the client, not only when the RPC is formally cancelled.
A stream never recovers once a write fails, so the backend treats the first
failed write as final and returns, which releases the slot the generation held.
This matters most for a model configured without a generation cap. With
max_tokens: 0 and a large context_size, an abandoned request that keeps
decoding occupies its slot until it reaches the context limit, which takes tens of minutes
on a large model, and every other request for that model queues behind it. A
couple of abandoned requests is enough to make a healthy node look wedged.
Cancellation is cooperative and checked between decoded results, so a batch
already in flight may finish before the request stops.
Tip
A generation cap is still worth setting. Cancellation only helps once a client
has actually gone away; a client that waits receives the full context worth of
tokens. Set max_tokens on the model config, and keep repeat_penalty above
1 so a repetition loop terminates on its own.
In distributed mode, expand a row in Backends → Installed to see its node
installations. Turn on Variant builds and Development builds under
Filters when needed to reveal concrete builds such as cpu-my-engine-development. Removal uses
that exact row name, not a generic alias or the recommended build.
Remove from worker-alpha… asks for confirmation naming both the backend and
node. Only that installation is affected; other nodes and sibling builds remain.
Removal can stop models using the backend on that node. Cancel, Escape, or clicking
outside the dialog sends no removal request. A target-node URL restricts the
available actions to that node; it never falls back to a different worker.
The page checks each expanded node’s actual inventory. System and meta backends,
unknown protection metadata, absent builds, and unavailable or draining nodes
cannot be removed through these controls. A system installation on one node does
not prevent removal of a user-managed installation on another. Inventory and
node status are checked again when you confirm; server-side protection still
applies. Retry inventory explicitly if it could not be loaded.
A removal error is scoped to the node and backend. Refresh and confirm again
before retrying; an API failure does not guarantee that nothing changed. If
removal succeeds but refresh fails, the page keeps the last successful installed
list and warns that it may be stale. Retry refreshes data without repeating
the deletion. Ordinary refresh failures do not report deletion success. Targeted
installation and removal controls block conflicting requests for the same node
and build, including while the post-removal refresh is pending. Generic catalog
removal also stays blocked during targeted installation, scoped removal, and
refresh, even if the URL
target is cleared. Its confirmation rechecks current row conflicts before
deleting. Standalone deletion and its system-backend protection are unchanged.
Engines
These backends have their own page because they need a hardware list or extra setup.
vllm.cpp is the LocalAI team’s C++20 port of vLLM: the same continuous-batching scheduler, paged KV cache and automatic prefix caching, with no Python at inference time. LocalAI serves it through the native vllm-cpp backend, which loads either a HuggingFace safetensors directory or a .gguf file and applies the chat template, tool-call parsing and reasoning split inside the engine.
This page covers installing the backend and the models LocalAI ships ready to run on it. For the full engine_args reference (KV sizing, scheduling policy, speculative decoding, LMCache), see the vllm.cpp section of the text generation guide.
Strata runs very large mixture-of-experts models, such as a 125B Qwen, on one machine with a GPU, a lot of RAM and a lot of disk. Strata is a separate project. LocalAI wraps it in the experimental strata backend, which starts the Strata engine as a child process and talks to it over the engine’s line protocol.
Warning This backend is experimental. LocalAI’s tests have not run the Qwen gallery entries against a real Strata engine and model, and the pack build has not been run on a real model file. The Hy4-Flash and Inkling 2 Mini entries have not been run on real hardware either: the backend was tested against a stub engine and against the real tokenizer data of the model file. The speed, memory and quality figures on this page are Strata’s own.
colibri runs very large mixture-of-experts models, from about 300B to 1T parameters, on one machine with little RAM. It keeps the dense weights in memory and reads the experts from disk while it generates, with a cache of the experts that a model uses most. colibri is a separate project. LocalAI wraps it in the experimental colibri backend.
Warning This backend is experimental. LocalAI has tested it on a CPU with a small model (Qwen3-0.6B): load, chat, streaming, reasoning, cancel and the restart after a crash. LocalAI has not run a large model with it yet. The speed and memory figures of colibri are colibri’s own. Expect a few tokens per second, or less, when the experts are read from disk.
audio.cpp is a GGML audio inference framework covering roughly thirty model families in one engine. LocalAI exposes it through the native C++ audio-cpp backend, so a single installed backend can serve text to speech, voice cloning, transcription, forced alignment, voice activity detection, speaker diarization, source separation, voice conversion and music generation, depending only on which model you point it at.
audio.cpp is developed by ShugoAI LLC, not by the LocalAI project. Model packages live in huggingface.co/audio-cpp/audio.cpp-gguf.
NeMo-Speech.cpp is NVIDIA’s Apache-2.0 C++/ggml runtime for the Nemotron Speech models. LocalAI exposes it through the native nemo-speech-cpp backend, which serves four model families from one installed backend: transcription, speaker diarization, speech synthesis and text translation.
NeMo-Speech.cpp is developed by NVIDIA, not by the LocalAI project.
Installing local-ai backends install nemo-speech-cpp Or install it from the Backends page in the web UI. nemo-speech-cpp is a preference-only backend: LocalAI never picks it automatically during model import, because the family is decided by the GGUF’s general.architecture key, which cannot be read from a remote repository, and because a translation model carries an ordinary LLM architecture with no NeMo-specific marker at all. Set backend: nemo-speech-cpp in the model YAML, or select it explicitly in the import form.
Run Whisper-Medusa speech-to-text checkpoints with LocalAI
Subsections of Engines
vllm.cpp backend
vllm.cpp is the LocalAI team’s C++20 port of
vLLM: the same continuous-batching scheduler, paged KV cache and automatic prefix
caching, with no Python at inference time. LocalAI serves it through the native
vllm-cpp backend, which loads either a HuggingFace safetensors directory or a
.gguf file and applies the chat template, tool-call parsing and reasoning split
inside the engine.
This page covers installing the backend and the models LocalAI ships ready to run
on it. For the full engine_args reference (KV sizing, scheduling policy,
speculative decoding, LMCache), see the
vllm.cpp section of the text generation guide.
Installing
local-ai backends install vllm-cpp
Or install it from the Backends page in the web UI. Images are published for
CPU, CUDA 13, Vulkan, Metal and Jetson L4T.
Which GPUs the CUDA images cover
The CUDA images are currently built for Blackwell-family architectures only:
sm_120a (RTX 50 series, RTX PRO 6000 Blackwell) and sm_121a (GB10 / DGX
Spark) on x86-64, and sm_121a alone on arm64. CUDA 13 is required, so there is
no CUDA 12 variant.
That is narrower than vllm.cpp itself, which builds ten architectures. On an
Ampere, Ada, Hopper, Jetson Orin or Jetson Thor GPU the CUDA backend installs
successfully and then fails at the first request with no kernel image is available for execution on the device. Until the build widens, use the Vulkan
or CPU image on those cards: vulkan-vllm-cpp builds with CUDA off entirely and
gives them a GPU path, without the NVFP4 and Marlin kernels.
Ready-made models
The model gallery carries a curated set of vllm.cpp configurations. Each one
arrives with the engine settings already applied, so tool calling, the reasoning
split and speculative decoding work without hand-editing YAML.
Gallery entry
Model
Size
Needs
qwen3.6-27b-nvfp4-vllm-cpp
Qwen3.6-27B, NVFP4
25 GB
Blackwell GPU
qwen3.6-27b-nvfp4-mtp-vllm-cpp
the same, with MTP speculative decoding
25 GB
Blackwell GPU
qwen3.6-27b-nvfp4-dflash-vllm-cpp
the same, with DFlash speculative decoding
28 GB
Blackwell GPU
qwen3.6-35b-a3b-nvfp4-vllm-cpp
Qwen3.6-35B-A3B MoE, NVFP4
23 GB
Blackwell GPU
qwen3.6-35b-a3b-nvfp4-mtp-vllm-cpp
the same, with MTP speculative decoding
23 GB
Blackwell GPU
qwen3-coder-30b-a3b-vllm-cpp
Qwen3-Coder-30B-A3B, bf16
57 GB
Blackwell GPU, or CPU
qwen3-4b-vllm-cpp
Qwen3-4B, bf16
8 GB
CPU, Metal, Vulkan, Blackwell GPU
qwen3-0.6b-vllm-cpp
Qwen3-0.6B, bf16
1.4 GB
CPU, Metal, Vulkan, Blackwell GPU
local-ai models install qwen3-0.6b-vllm-cpp
The two small bf16 entries are the ones that run anywhere the backend does,
including CPU. The NVFP4 entries need a Blackwell-class NVIDIA GPU on two counts:
NVFP4 has no kernel on older architectures, and the CUDA images are built only
for Blackwell in any case.
Sizing note: every entry sets num_blocks to give roughly one to four full
contexts of KV cache, which is a starting point rather than a tuned value. KV is
not free; the 4B entry, for instance, spends 144 KiB per token, so its 1024
blocks are about 4.5 GB on top of the weights. Raise num_blocks for more
concurrency, lower it on a small box.
Why the 27B entries pin a revision
The Qwen3.6-27B entries pin their weights to a specific HuggingFace commit rather
than tracking the repository’s default branch. This is deliberate and worth
understanding before you copy one of these configs.
The upstream repository was later re-quantized in place, under the same name, from
NVFP4 to FP8 W8A8. A config that names the repository without a revision therefore
resolves to entirely different weights, with different numerics and different
performance, and nothing about the load reports that anything changed. Pinning is
what makes the entry reproducible:
The same reasoning applies to any quantized community repository you depend on.
Choosing between the speculative variants
Speculative decoding trades memory for decode throughput. All three Qwen3.6-27B
entries serve the same weights and produce the same quality; they differ only in
how tokens are proposed.
Entry
Method
Extra weights
Extra memory
qwen3.6-27b-nvfp4-vllm-cpp
none
none
none
qwen3.6-27b-nvfp4-mtp-vllm-cpp
MTP, depth 1
none, the draft head ships inside the checkpoint
about 3.6 GB
qwen3.6-27b-nvfp4-dflash-vllm-cpp
DFlash, 16-token blocks
a separate 3.5 GB drafter
drafter plus draft cache
MTP drafts one token per step from a head that already lives in the target
checkpoint’s own mtp.* tensors, so it costs no extra download. DFlash drafts a
whole 16-token block in one non-autoregressive pass from a separate drafter, which
is the larger win at the cost of a second checkpoint on disk.
Start with the plain entry if you are short on memory, and with the DFlash entry
if you are not.
Tool calling
Every entry above sets use_tokenizer_template: true and disables LocalAI’s
Go-side grammar path, so tool calls are detected and parsed by the engine’s own
streaming parsers and arrive as real tool_calls on the OpenAI response.
The parser is normally auto-detected from the chat template, but one case cannot
be: Qwen3-Coder’s tool dialect is byte-identical on the wire to another family’s,
so template sniffing would pick the wrong parser. The
qwen3-coder-30b-a3b-vllm-cpp entry therefore names it explicitly, and any
Qwen3-Coder config you write yourself should do the same:
engine_args:tool_parser:qwen3_coder
Overriding config.json keys (hf_overrides)
engine_args.hf_overrides is a JSON object of top-level config.json keys that
the backend merges over the model directory’s own config.json before the
engine loads it, like vLLM’s --hf-overrides. The main use is to opt a published
checkpoint into an engine adapter that its config does not name. For example,
the Tev1 repositories declare Qwen3_5ForConditionalGeneration, and vllm.cpp
serves them as decision models only when the architecture is Tev1Model:
The downloaded model files do not change. At load the backend creates a private
temporary directory. It writes the merged config.json there and adds a
symlink for each other entry of the model directory (weights, tokenizer files,
a tokenizer/ subdirectory). Then it gives that directory to the engine. When
the model unloads, the backend removes the directory.
Rules:
The merge is top-level only. An override key replaces the whole value of that
key, including a nested object such as text_config.
The model must be a directory that contains a config.json. A .gguf file
or a directory without config.json fails the load.
A value that is not a JSON object (an array, a scalar, or JSON that does not
parse) fails the load. The backend does not ignore it, because loading the
unchanged config would serve a different architecture than the one you
configured.
An empty object ({}) does nothing.
Named entity recognition (GLiNER2.5)
The vllm-cpp backend serves GLiNER2.5,
a zero-shot NER and structured-extraction model. Point the backend at the
safetensors directory and the backend exposes the TokenClassify gRPC method,
which LocalAI maps to its standard NER API surface.
Labels are supplied at inference time, not baked into the model config. Set
them in engine_args:
ner_labels is a comma-separated list. When omitted, the backend falls back to
a built-in default set (person, organization, location, date, time,
money, quantity). ner_threshold is the sigmoid cutoff (default 0.5);
ner_max_width is the maximum span length in tokens (default 12).
The model runs the DeBERTa v2 encoder with disentangled attention on the host
forward, which is the required contract for pooling models in vllm.cpp. A
device-resident forward is tracked as a performance optimization, not a
correctness gap.
Decisions API
The vllm-cpp backend serves the kev-compatible SystemOne endpoints (the Decisions API): typed
choice, noul and score questions over a state text, answered by a
non-generative decision model in one pass. A decision model declares
known_usecases: [decisions]. See Decisions API
for the request shape, the models you can install and the access rules.
Endpoint
Method
Description
/v1/systemone
POST
Answer all questions in one pass
/v1/systemone/permute
POST
Re-run one choice question under n_perm option orders
/v1/systemone/separate
POST
Answer each question in its own pass (N passes)
The GLiNER2.5 zero-shot NER model (token_classify) also serves
/v1/systemone, through the NER path, and it is the model to use for
/v1/systemone/permute and /v1/systemone/separate, which decision models
refuse with a 400. It derives its NER labels from the question definitions, so
no ner_labels configuration is needed.
Beyond text generation
MiniMax-H3, which generates video and audio jointly, is supported through the
stable-diffusion.cpp backend (the -ggml gallery entries), not through
vllm-cpp. The vllm-cpp video path has no gallery entries because it does not
finish a clip in a practical time. See
Video generation.
RKLLM runs converted language
models on supported Rockchip NPUs. Its server already exposes an
OpenAI-compatible chat-completions API, so LocalAI can put its authentication,
routing, usage tracking, and web UI in front of the board with the
cloud-proxy backend.
This integration does not install or convert RKLLM models. Model conversion is
a separate host-side step using RKLLM-Toolkit, and the resulting .rkllm file
must match the target SoC.
Requirements
A Linux Rockchip board supported by the installed RKLLM runtime. Upstream
RKLLM 1.3.0 accepts rk3588, rk3576, rv1126b, and rk3562 in its server
demo.
A model converted to .rkllm for that target.
The upstream RKLLM Flask server running on the board and reachable from
LocalAI.
RK3566 boards, including Quartz64 models with that SoC, are not in the current
upstream RKLLM server target list. LocalAI cannot add support for a SoC that the
RKLLM runtime does not support.
Start the RKLLM server
Follow the upstream
rkllm_server_demo
instructions to deploy the runtime library, server, and converted model to the
board. For example, from an RKLLM checkout on the host:
The helper starts the server on port 8080. Confirm it is reachable before
configuring LocalAI:
curl http://ROCKCHIP_BOARD_IP:8080/v1/models
Configure LocalAI
Create models/rkllm.yaml:
name:rockchip-rkllmbackend:cloud-proxyproxy:mode:passthroughprovider:openaiupstream_url:http://ROCKCHIP_BOARD_IP:8080/v1/chat/completionsupstream_model:rkllmrequest_timeout_seconds:600# The upstream is on the local network, so cloud-egress PII filtering is not# enabled by default in this example. Enable it if your deployment needs it.pii:enabled:false
No API key setting is required by the upstream demo server. If you expose the
board beyond a trusted network, put an authenticated reverse proxy in front of
it and configure the corresponding key through api_key_env or api_key_file.
Start LocalAI, then use the local model name with any OpenAI-compatible client:
LocalAI forwards the request and the streaming response without translating
the wire format. Sampling fields supported by the upstream server, including
temperature, top_p, top_k, max_tokens, repeat_penalty, and
enable_thinking, pass through unchanged.
Limitations
The upstream demo serves chat completions and model listing only. Embeddings,
image generation, audio APIs, and legacy text completions are not available.
Model conversion and runtime installation remain upstream RKLLM operations.
Upstream serializes inference for a loaded model and returns HTTP 503 while
it is busy. Scale with multiple boards and LocalAI routing if concurrent
inference is required.
The upstream demo returns model-generated tool calls as markup in
message.content; passthrough mode does not convert that markup into OpenAI
message.tool_calls. Clients that use tools must parse the model-specific
format or put an adapter in front of the RKLLM server.
See Cloud passthrough proxy for the
full proxy configuration, authentication, routing, and PII options.
Strata backend (experimental)
Strata runs very large mixture-of-experts models, such as a 125B Qwen, on one machine with a GPU, a lot of RAM and a lot of disk. Strata is a separate project. LocalAI wraps it in the experimental strata backend, which starts the Strata engine as a child process and talks to it over the engine’s line protocol.
Warning
This backend is experimental. LocalAI’s tests have not run the Qwen gallery entries against a real Strata engine and model, and the pack build has not been run on a real model file. The Hy4-Flash and Inkling 2 Mini entries have not been run on real hardware either: the backend was tested against a stub engine and against the real tokenizer data of the model file. The speed, memory and quality figures on this page are Strata’s own.
Qwen entries, Tencent Hy4-Flash and Inkling 2 Mini take text and images.
RAM and disk as listed for the model in Models. Even the smallest Qwen entry downloads about 24 GB, and the largest ones more than 250 GB. Tencent Hy4-Flash needs at least 64 GiB of RAM and about 130 GB of disk. Inkling 2 Mini is much smaller: from about 9 GB of disk, and a 4 GiB GPU is enough to start.
An SSD or NVMe drive for the larger entries, because the n-gram table is read from disk.
Installing
local-ai backends install strata
LocalAI picks the image that fits the machine. The image already contains everything the
backend needs: the engine, a portable Python (with numpy) for the tokenizer helper and the pack
tool, and the Strata Python modules. You do not build or download an engine yourself.
Supported hardware
Hardware
Image
Notes
NVIDIA GPU, CUDA 12 (x86_64)
cuda12-strata
GTX 10 and newer. NVIDIA driver 575 or newer.
NVIDIA GPU, CUDA 13 (x86_64)
cuda13-strata
RTX 20 series and newer. NVIDIA driver 580 or newer.
NVIDIA DGX Spark (arm64, CUDA 13)
cuda13-nvidia-l4t-arm64-strata
The engine is built for the GB10 chip (sm_121) only. Needs glibc 2.39 or newer.
AMD Radeon (x86_64, Linux)
rocm-strata
RX 9000 and Radeon AI PRO R9700, RX 7000, Strix Halo, and RX 6000. The image holds one engine per GPU family and the launcher picks the one that matches the card. Only the amdgpu kernel driver is needed, not a ROCm install. RX 6000 is built upstream but not tested on a real card.
Intel Arc (x86_64, Linux)
intel-strata
SYCL engine. Install the Intel compute runtime on the host (libze1, intel-opencl-icd). Tested upstream on Arc A-series only.
Apple Silicon
metal-strata
macOS 15 or newer.
These targets have no Strata engine, so there is no image for them: CPU only, Vulkan,
NVIDIA Jetson (JetPack 6, CUDA 12 on arm64), other AMD GPU families, and Intel Macs. On
those hosts local-ai backends install strata reports that no variant fits the machine.
The images are large because each engine package carries its own GPU runtime libraries
(CUDA, ROCm or oneAPI). The ROCm image carries four engines, one per GPU family. Each image
also carries the same set of engines for Tencent Hy4-Flash and for Inkling 2 Mini, which run on their own
engine programs (strata-hy4 and strata-inkling) and have their own packages; the launcher picks the one
that matches the card, as it does for the Qwen engine. Upstream publishes both engines for the same targets as above.
Licensing
The engine and the Strata Python modules are MIT licensed. The engine packages published
by Strata also bundle runtime libraries from NVIDIA (CUDA), AMD (ROCm) and Intel (oneAPI),
which keep their own licences. The images ship the upstream packages unchanged.
Models
Strata does not run a single GGUF file. A model is a directory that holds the GGUF files and
a Strata pack (an index, the dense weights and the tokenizer). The model gallery installs all
of them in one step, with the strata backend, the model’s own chat template, and the vision
projector for images. Every file is pinned to a Hugging Face commit and checked by SHA-256.
For the GGUF models the gallery downloads only the GGUF files. The backend builds the pack
with Strata’s own tools the first time the model loads (the pack_gguf option; see
the backend README). This takes a few minutes and a few GB of disk. A finished pack
is never built again. If the build fails, the load fails with the last lines of the tool. Deleting the model removes the pack too.
Qwen3.8-Flash-Next (125B parameters, mixture of experts, Qwen Community License 1.0). The
n-gram table (about 29 GB in the ISTA-DASLab files) is read from disk, so use an SSD. RAM is
what the experts need plus about 10 GB; with less RAM it still runs, at lower speed. Add --resident-experts to engine_args to copy
the experts into RAM when there is room.
Gallery name
Source and format
Download
Memory
qwen3.8-flash-next-ista-q2_0
ISTA-DASLab GSQ-RCO Q2_0, the fastest
67 GB
about 38 GB
qwen3.8-flash-next-ista-iq2_xs
ISTA-DASLab IQ2_XS
69 GB
about 39 GB
qwen3.8-flash-next-ista-iq3_xxs
ISTA-DASLab IQ3_XXS
77 GB
about 47 GB
qwen3.8-flash-next-ista-iq3_s
ISTA-DASLab IQ3_S, the best quality
85 GB
about 55 GB
qwen3.8-flash-next-coder-iq1_m
ISTA-DASLab Coder IQ1_M, half the experts, for code
59 GB
about 32 GB of RAM
qwen3.8-flash-next-unsloth-ud-iq1_m-v3.1
Unsloth UD-IQ1_M (Dynamic v3.1), the smallest download
68 GB
about 45 GB
qwen3.8-flash-next-unsloth-ud-q2_0-v3.1
Unsloth UD-Q2_0 (v3.1)
71 GB
about 47 GB
qwen3.8-flash-next-unsloth-ud-iq2_xs-v3.1
Unsloth UD-IQ2_XS (v3.1)
76 GB
about 52 GB
qwen3.8-flash-next-unsloth-ud-q2_k_xl-v3.1
Unsloth UD-Q2_K_XL (v3.1)
80 GB
about 56 GB
qwen3.8-flash-next-unsloth-ud-iq3_xxs-v3.1
Unsloth UD-IQ3_XXS (v3.1)
84 GB
about 60 GB
qwen3.8-flash-next-unsloth-ud-q3_k_xl-v3.1
Unsloth UD-Q3_K_XL (v3.1)
90 GB
about 66 GB
qwen3.8-flash-next-unsloth-ud-iq4_xs-v3.1
Unsloth UD-IQ4_XS (v3.1), a newer file than the one below
94 GB
about 70 GB
qwen3.8-flash-next-unsloth-ud-iq4_xs
Unsloth UD-IQ4_XS
95 GB
about 72 GB for all experts
qwen3.8-flash-next-unsloth-ud-q4_k_xl
Unsloth UD-Q4_K_XL
112 GB
about 88 GB
qwen3.8-flash-next-unsloth-ud-q5_k_xl
Unsloth UD-Q5_K_XL
159 GB
about 108 GB
qwen3.8-flash-next-unsloth-ud-q6_k_xl
Unsloth UD-Q6_K_XL
170 GB
about 118 GB
qwen3.8-flash-next-unsloth-q8_0
Unsloth Q8_0, the reference
189 GB
about 136 GB
qwen3.8-flash-next-gyro-s
agentionai Gyro-S, the smallest
59 GB
about 28 GB
qwen3.8-flash-next-gyro-m
agentionai Gyro-M
93 GB
about 35 GB
swift-1.5-qwen3.8-flash-next-iq2_xs
UkisAI Swift 1.5 fine-tune, IQ2_XS
69 GB
about 39 GB
swift-1.5-qwen3.8-flash-next-iq3_xxs
Swift 1.5, IQ3_XXS
77 GB
about 47 GB
swift-1.5-qwen3.8-flash-next-iq3_s
Swift 1.5, IQ3_S
85 GB
about 55 GB
qwen3.8-flash-next-nvfp4-gptq
NVFP4 experts (GPTQ), ready Strata pack
129 GB
about 80 GB of RAM
qwen3.8-flash-next-nvfp4-nvidia
NVIDIA’s NVFP4 checkpoint, ready Strata pack
129 GB
about 80 GB of RAM
The ISTA-DASLab, Unsloth and Gyro files are those of the Hugging Face repositories of the same
names. The -v3.1 entries are the Unsloth “Dynamic v3.1” files of 2026-11-04. They are new builds, not
re-uploads of the older entries, and the Hugging Face files of those older entries stay pinned
as they were. Upstream Strata has run some of these sets on real hardware; LocalAI has not run
them yet. The Unsloth and Gyro files need the
pack tool’s --compat-bf16 option, which the entries set. NVFP4 packs run on NVIDIA GPUs only.
The MTP draft layer is not configured in any entry. The context size is 32768 tokens by
default; set context_size for more. For less RAM with the Unsloth files, add
--resident-budget-gib N to engine_args, as described in the
Strata model guide.
The memory columns come from Strata’s guides. They are a minimum, and Strata does not state them the same way for every model.
Qwen3.6-35B-A3B (35B parameters, 3B active, Apache License 2.0). Unsloth’s GGUF with the
MTP layer, which the engine uses for speculative decoding. It runs on NVIDIA and AMD GPUs; the
Intel Arc and Apple builds of Strata do not run it. The engine keeps every expert it can in
VRAM and computes the rest on the CPU. On the first load the backend only exports the tokenizer
from the GGUF file (pack_tool:tokenizer).
Gallery name
Format
Download
Memory
qwen3.6-35b-a3b-ud-q4_k_xl-strata
Unsloth UD-Q4_K_XL
24 GB
about 32 GB
qwen3.6-35b-a3b-ud-q6_k_xl-strata
Unsloth UD-Q6_K_XL
34 GB
about 44 GB
qwen3.6-35b-a3b-q8_0-strata
Unsloth Q8_0
39 GB
about 52 GB
Tencent Hy4-Flash (220B parameters, 12B active per token, 1M tokens of context, text and
images in, Tencent Hy License 1.0). Strata publishes three quantizations of it as .strata files
(not GGUF) with a shared Engram file that is read from disk while the model answers, and a small vision file.
A model entry downloads the build, the Engram file and the vision file. The three entries use one
directory, so the Engram and vision files are downloaded once and shared. There is no pack to build: the
backend reads the tokenizer and the chat template from the build file on the first load (seconds).
local-ai models install hy4-flash-sq-64-strata
Gallery name
Made for
Download
Memory in use
hy4-flash-sq-64-strata
64 GiB of RAM and a GPU with 8 GiB or more
about 130 GB
about 59.4 GiB
hy4-flash-sq-96-strata
96 GiB of RAM, close to the full model
about 157 GB
about 85.1 GiB
hy4-flash-sq-128-strata
128 GiB of RAM, the closest to the full model
about 181 GB
about 107.5 GiB
The download is the build plus the 67.6 GB Engram file and the 0.93 GB vision file. Memory in use is
RAM and GPU memory together. All figures in this table are the model author’s and Strata’s own, not
measured by LocalAI. Use a fast SSD or NVMe drive: the Engram file is read at random while the
model answers. The entries set a context of 131072 tokens, Strata’s default for this model; lower
context_size on a card with little memory. Speculative decoding (DFly2) is built into the engine
and is on by default. Strata’s recommended sampling is temperature 0.9, top_p 1.0 and no top_k; the entries
set it. The reasoning effort of a request can be none, or any of the usual words, which the backend
maps to the model’s no_think, high and max.
Options of the Hy4-Flash entries (set in options:; the backend README lists all options):
Option
Meaning
family:hy4
Selects the Hy4-Flash engine and file layout.
native, engram, vision
The build file, the Engram file and the vision file, relative to the model directory. vision:off turns images off; the other two are required.
drafter
dfly2 (default) or off. The drafter is used only if the engine says it has one.
vram_experts_gb, ram_experts_gb
Engine flags that cap how many gigabytes of experts go to the card and to RAM. Strata’s own launcher computes them for a card; the entries set none, so the engine decides. Set them if the model does not fit your card.
The engine takes no logprobs and no logit bias, and the backend refuses a request for them.
Inkling 2 Mini (Thinking Machines Lab, 26.4B parameters, 3.4B active per token, up to 1M tokens of
context, text and image input, tool calling, Apache 2.0). It has no thinking mode and answers directly.
It is much smaller than the models above, and it runs on its own engine, strata-inkling. There are two
kinds of entry. The Strata builds (.strata files, by Strata) carry their own DSpark drafter. The Unsloth
GGUF files are read as they are, with no conversion step, and use the DSpark drafter file that Unsloth
publishes. All entries use one directory, so the vision file (0.64 GB), the tokenizer files and the drafter
file are downloaded once. There is no pack to build: the backend makes the tokenizer from the model files on
the first load (seconds). A Strata build has the chat template inside it and needs the published
tokenizer.json; a GGUF needs the published tokenizer.json and chat_template.jinja. The entries download them.
a 12 GiB card or a 16 GiB Mac, whole in memory; mixed RAM and GPU from a 4 GiB card
inkling-2-mini-sq-15-strata
Strata SQ-15
about 15 GB
a 16 GiB card or a 24 GiB Mac; mixed on a 12 GiB card
inkling-2-mini-sq-20-strata
Strata SQ-20 (lossless)
about 20 GB
a 24 GiB card or more, or 32 GiB or more of unified memory
inkling-2-mini-ud-q8_k_xl-strata
Unsloth UD-Q8_K_XL
about 24 GB
24 GiB or more of GPU memory, or 32 GiB or more of RAM
inkling-2-mini-ud-q4_k_xl-strata
Unsloth UD-Q4_K_XL
about 19 GB
a 16 to 24 GiB card
inkling-2-mini-ud-q4_k_m-strata
Unsloth UD-Q4_K_M
about 18 GB
a 16 to 24 GiB card
inkling-2-mini-ud-iq4_xs-strata
Unsloth UD-IQ4_XS
about 17 GB
a 16 GiB card
inkling-2-mini-ud-q3_k_xl-strata
Unsloth UD-Q3_K_XL
about 15 GB
a 12 to 16 GiB card
inkling-2-mini-ud-iq3_xxs-strata
Unsloth UD-IQ3_XXS
about 13 GB
an 8 to 12 GiB card
inkling-2-mini-ud-q2_k_xl-strata
Unsloth UD-Q2_K_XL
about 10 GB
a 4 to 12 GiB card with about 16 GiB of RAM
inkling-2-mini-ud-iq2_xxs-strata
Unsloth UD-IQ2_XXS
about 10 GB
a 4 to 8 GiB card with about 16 GiB of RAM
inkling-2-mini-ud-iq1_m-strata
Unsloth UD-IQ1_M
about 9 GB
a 4 to 8 GiB card
inkling-2-mini-ud-iq1_s-strata
Unsloth UD-IQ1_S
about 9 GB
a 4 to 8 GiB card
The sizing column is Strata’s own guidance, not measured by LocalAI. The entries set a context of 32768 tokens
(the model reads up to 1M, and the cache grows with the context) and the model card’s sampling, temperature 1.0 with no
truncation. LocalAI already has inkling-2-mini entries on the llama-cpp backend; these run the same model on Strata.
Options of the Inkling 2 Mini entries (set in options:; the backend README lists all options):
Option
Meaning
family:inkling
Selects the Inkling engine and file layout.
native, vision
The model file and the vision file, relative to the model directory. vision:off turns images off.
dspark
The drafter file of a GGUF entry. A Strata build carries its own drafter.
drafter
dspark (default) or off. The drafter is used only if the engine says it has one.
vram_experts_gb, ram_experts_gb
Engine flags that cap how many gigabytes of experts go to the card and to RAM. The entries set none, so the engine decides.
The engine takes no logprobs and no logit bias, and the backend refuses a request for them.
Licences. Qwen3.8-Flash-Next models are under the Qwen Community License 1.0: free use, but it
asks for a separate licence from Qwen if you run a Model as a Service or AI Work Assistant
business with it, and for the model name to be shown in products above its user and revenue
limits. Swift 1.5 adds UkisAI’s Swift Open License 1.0. The NVIDIA checkpoint adds the NVIDIA
Open Model License Agreement. Qwen3.6 and Inkling 2 Mini are Apache 2.0. Tencent Hy4-Flash is under the Tencent Hy
License 1.0, derived from Apache 2.0 with extra commercial terms for very large Model as a
Service businesses. Read the LICENSE file of the repository
before you offer a model to other people. The ISTA-DASLab model cards also carry an Apache 2.0
tag; their text says the weights inherit the base model’s licence, and the entries follow the
text.
DeepSeek V4.1-Flash is not supported: Strata v0.2.15 removed it, and the backend refuses family:deepseek41.
Not in the gallery:
NVIDIA’s retrained FP4 checkpoint (NVFP4-QAD). Strata converts NVIDIA’s 102 GB of files on
the user’s machine with a tool that needs a heavy Python stack.
OrcaRouter’s uncensored IQ3_XXS. Upstream documents it as a manual conversion.
You can still run these by building the pack with Strata and writing a model config by hand
(see the backend README).
Vision
For vision chat requests with template.use_tokenizer_template: true, send images as
image_url content parts on their conversation messages. LocalAI adds one placeholder
per decoded image to that message before Strata applies the model’s chat template,
including images in earlier turns. There is no need to insert media_marker into the
text or change the model’s chat template. The backend’s optional media_marker setting
changes the placeholder used between LocalAI and Strata.
Limits
The backend has no embeddings, no grammar and no video or audio input, and it serves one request at a time. Qwen entries support images, logprobs, tool calls and reasoning. Hy4-Flash supports images, tool calls and reasoning, and no logprobs. Inkling 2 Mini supports images and tool calls, has no thinking mode, and no logprobs. The backend README has the full list.
Versions
Upstream versions each platform on its own, and a release doesn’t always hold every package. One release can have the NVIDIA engine at one version and another platform’s engine at an older one. Mixed versions are normal.
backend/go/strata/Makefile pins every package on its own: the release tag it comes from, its version and its SHA-256 (STRATA_ENGINE_TAG_<package>, STRATA_ENGINE_VERSION_<package> and STRATA_ENGINE_SHA256_<package>). The download URL is built from the package’s own tag. STRATA_VERSION and STRATA_COMMIT name the newest release, and the backend’s Python modules are fetched at that commit.
The Hy4-Flash and Inkling engine packages have their own pins of the same kind (STRATA_HY4_TAG_<package>, STRATA_HY4_VERSION_<package> and STRATA_HY4_SHA256_<package>, and the same with STRATA_INKLING_), and the same job moves them.
A nightly job (bump-strata in .github/workflows/bump_deps.yaml, script .github/bump_strata.sh) takes each package from the newest release that has it and opens one pull request when any pin changes. If a package is missing from the newest release, the job takes it from an older one and logs a notice. If a package is in no release, it keeps its pin and prints a warning. The job fails when a SHA-256 in the release’s SHA256SUMS.txt differs from the digest GitHub computed for the uploaded file. The pull request lists each package that changed, with its old and new tag and version. The backend speaks an unversioned line protocol, so review each bump against the backend README.
colibri backend (experimental)
colibri runs very large mixture-of-experts models, from
about 300B to 1T parameters, on one machine with little RAM. It keeps the dense weights in
memory and reads the experts from disk while it generates, with a cache of the experts that a
model uses most. colibri is a separate project. LocalAI wraps it in the experimental colibri
backend.
Warning
This backend is experimental. LocalAI has tested it on a CPU with a small model (Qwen3-0.6B):
load, chat, streaming, reasoning, cancel and the restart after a crash. LocalAI has not run a
large model with it yet. The speed and memory figures of colibri are colibri’s own. Expect a few
tokens per second, or less, when the experts are read from disk.
How it works
The backend starts colibri’s own server, coli serve, as a child process. The server listens
on a free port on 127.0.0.1 only, with a random API key, so other users of the machine
cannot use it. The backend sends the requests to the OpenAI-compatible API of that server.
colibri renders the chat template of the model and reads the tool calls in the model’s own
format. LocalAI sends the structured chat (the messages, the tools, tool_choice and the
reasoning settings) and gets back the answer, the reasoning and the tool calls as separate
parts. This is the same flow as the llama.cpp backend with use_tokenizer_template. A request
with a plain prompt goes to colibri’s completions endpoint.
Installing
local-ai backends install colibri
LocalAI picks the image that fits the machine. The image contains everything the backend
needs: the colibri release (the engines and coli serve, pinned and checked by SHA-256) and a
portable Python 3, which coli serve needs. You do not install colibri or Python yourself.
Hardware
Image
Notes
CPU, Linux x86_64 and arm64
cpu-colibri
The default.
NVIDIA GPU, CUDA 12, Linux x86_64
cuda12-colibri
Ampere and newer (sm_80, 86, 89, 90, 120), with a PTX fallback for newer cards.
NVIDIA GPU, CUDA 13, Linux x86_64
cuda13-colibri
The same targets, plus GB10 (sm_121).
NVIDIA arm64, CUDA 13
cuda13-nvidia-l4t-arm64-colibri
Jetson AGX Orin (sm_87), Jetson Thor (sm_110) and DGX Spark (sm_121).
Vulkan GPU, Linux x86_64 and arm64
vulkan-colibri
Sets COLI_VULKAN=1. An engine that finds no Vulkan device runs on the CPU.
Apple Silicon
metal-colibri
macOS on arm64. Not tested by LocalAI yet.
colibri publishes no Linux CUDA build. The CUDA images compile colibri’s engines from the
source of the pinned release (tag and commit) with colibri’s own CUDA=1 build option, and use
the release archive for everything else. colibri’s own CI only checks that its CUDA code
compiles on Linux, and its releases build CUDA only for Windows, so the Linux CUDA path is less
tested upstream than the CPU and Vulkan paths. LocalAI has not run these images on a GPU yet.
The CUDA images turn on colibri’s CUDA backend: COLI_CUDA=1, CUDA_DENSE=1 (the dense
layers on the GPU), CUDA_EXPERT_GB=auto (a cache of experts that fills the free VRAM) and,
for DeepSeek V4, DSV4_CUDA=1. Set any of them in the model’s env to change it, for example
CUDA_EXPERT_GB: "20" to leave VRAM for other models, or COLI_CUDA: "0" to run on the CPU.
The engines without a CUDA backend (Qwen-Image, Laya and GLiNER-Decide) are the CPU builds of
the release.
The pins move with colibri’s releases: a scheduled job opens a pull request that updates the
release tag, its commit and the SHA-256 of every archive together.
Models
The backend accepts two kinds of model:
A GGUF file. On the first load the backend runs coli import once. This writes a small
colibri model directory next to the GGUF file, named after it (Model-Q4_K_M.gguf gives
Model-Q4_K_M.colibri). The directory points at the GGUF file; the weights are not copied.
For a split GGUF, give the first part.
A colibri model directory (it has a config.json), for example one made by coli import or
coli convert.
colibri supports only the model families it has an engine for (GLM-5.x, Qwen3.6, Qwen3.8,
DeepSeek V4, Kimi K3, MiMo, Inkling, OLMoE and others). See the
colibri README for the list.
The model gallery has the models that colibri’s own setup offers (coli setup), with every
file pinned to a Hugging Face commit and checked by SHA-256. Install one with:
local-ai models install qwen3.6-35b-a3b-colibri
Gallery name
Model
Download
RAM: minimum, as measured
qwen3.6-35b-a3b-colibri
Qwen3.6-35B-A3B, colibri int4 container
23 GB
10 GB, 20 GB
qwen3-coder-30b-a3b-colibri
Qwen3-Coder-30B-A3B, colibri int4 container
19 GB
8 GB, 18 GB
inkling-2-mini-ud-q4_k_xl-colibri
Inkling-2-Mini, Unsloth UD-Q4_K_XL GGUF
18 GB
6 GB, 21 GB
inkling-2-mini-ud-iq2_xxs-colibri
Inkling-2-Mini, Unsloth UD-IQ2_XXS GGUF
9 GB
4 GB, 12 GB
qwen3.8-flash-next-ud-iq2_xs-colibri
Qwen3.8-Flash-Next, Unsloth UD-IQ2_XS GGUF with the MTP head
80 GB
16 GB, 54 GB
qwen3.8-flash-next-ud-iq3_xxs-colibri
Qwen3.8-Flash-Next, Unsloth UD-IQ3_XXS GGUF with the MTP head
88 GB
16 GB, 62 GB
deepseek-v4-flash-reap-150b-colibri
DeepSeek V4 Flash REAP 150B, official weight format
85 GB
16 GB, 32 GB
deepseek-v4-flash-colibri
DeepSeek V4 Flash 284B, official checkpoint
167 GB
16 GB, 32 GB
qwen3.8-flash-next-fp8-colibri
Qwen3.8-Flash-Next, official FP8 checkpoint
186 GB
24 GB, 32 GB
mimo-v2.6-flash-colibri
MiMo-V2.6 Flash 309B, official checkpoint
172 GB
32 GB, 52 GB
glm-5.3-colibri
GLM-5.3 744B, colibri int4 container
419 GB
16 GB, 24 GB
glm-5.2-colibri
GLM-5.2 744B, colibri int4 container with the MTP head
429 GB
16 GB, 24 GB
inkling-colibri
Inkling 975B, colibri container
514 GB
120 GB, 128 GB
mimo-v2.6-pro-colibri
MiMo-V2.6 Pro 1.02T, official checkpoint
564 GB
54 GB, 64 GB
The RAM figures are colibri’s (coli setup’s catalog): the minimum to start the model, and the
amount at which colibri measured it. For the models larger than RAM, put them on a fast NVMe SSD:
colibri reads the experts from disk while it answers. LocalAI has not run these entries yet.
colibri’s Kimi K3 entries are not in the gallery, because they need a tokenizer step after the
download that the backend does not run, and its Qwen-Image entries are not, because this backend
generates text only.
To use a GGUF model from the import form, choose colibri as the backend. A model config by
hand:
use_tokenizer_template: true makes LocalAI send the structured chat to colibri.
grammar.disable: true is necessary for tool calls: colibri reads the model’s own tool-call
format and does not accept LocalAI’s grammars.
Options
Model config
coli serve flag
What it does
context_size
--ctx
Context size in tokens. Without it, colibri chooses from the free memory.
threads
OMP_NUM_THREADS
Number of CPU threads. An OMP_NUM_THREADS in env takes priority.
options: [parallel:N] (or kv_slots:N)
--kv-slots
Number of conversations that the engine keeps at the same time.
options: [ram:N]
--ram
RAM budget in GB, which sets the size of the expert cache.
options: [cap:N]
--cap
Expert cache slots per layer.
options: [gpu:...]
--gpu
auto, none, or a device list such as 0,1.
options: [vram:N]
--vram
VRAM budget in GB.
options: [policy:...]
--policy
quality, balanced or experimental-fast.
options: [effort:...]
--effort
Default reasoning effort: minimal to xhigh.
options: [think:true]
--think / --no-think
Reasoning on or off by default.
options: [ngen:N]
--ngen
Maximum tokens of an answer when a request does not set it.
options: [max_queue:N], [queue_timeout:S]
--max-queue, --queue-timeout
colibri’s request queue.
options: [start_timeout:S]
Time to wait for coli serve to start. Default 600 seconds.
options: [import_dir:PATH]
Where coli import writes the model directory.
env
Environment variables for colibri, for example COLI_VULKAN: "0". See colibri’s environment variables.
Requests
The backend sends these request fields to colibri: the messages (with tool calls, tool results
and earlier reasoning), tools, tool_choice, max_tokens, temperature, top_p, stop
(colibri accepts up to four), logit_bias, logprobs and top_logprobs, and the reasoning
settings enable_thinking and reasoning_effort.
colibri refuses what it cannot do with an error, and the backend passes that error on. For
example, colibri gives log probabilities only for some engines and not while streaming, and it
does not support a non-empty logit_bias.
The backend refuses these requests itself:
A request with a grammar, which includes response_format with json_object or
json_schema.
Images, video and audio in the request.
Tools in a request without structured messages (no use_tokenizer_template).
colibri has no setting for top_k, min_p, the repeat, presence and frequency penalties,
typical_p, tfz, mirostat and seed. LocalAI fills some of these with defaults on every
request, so the backend cannot tell a default from a value that you set. It does not send them.
Tool calls work only when the model writes the tool-call format of its colibri family. A model
that colibri runs with the engine of another family can write a format that colibri does not
read. Then the call is returned as text. LocalAI’s test with Qwen3-0.6B, which runs on the
Qwen3.6 engine, had this result.
Embeddings and tokenization are not supported.
When colibri stops
coli serve restarts its own engine when the engine stops. When coli serve itself stops, the
request that was in progress fails with the last lines that colibri wrote. The next request
starts coli serve again from the same configuration. If that fails too, the model stays in an
error state until it is loaded again, and each request returns the reason. The model status
shows the real state of the process.
Licensing
colibri is licensed under the Apache License 2.0. The images contain the upstream release
archive without changes (the CUDA images replace its engines with ones compiled from the same
release’s source), a portable CPython from
python-build-standalone, and in the
CUDA images the NVIDIA CUDA runtime and cuBLAS libraries, which keep their own licence. Each
model in the gallery has its own licence, which its entry names.
audio.cpp backend
audio.cpp is a GGML audio inference framework
covering roughly thirty model families in one engine. LocalAI exposes it through the
native C++ audio-cpp backend, so a single installed backend can serve text to speech,
voice cloning, transcription, forced alignment, voice activity detection, speaker
diarization, source separation, voice conversion and music generation, depending only on
which model you point it at.
Or install it from the Backends page in the web UI. audio-cpp is a
preference-only backend: LocalAI never picks it automatically during model import,
because the only reliable signal for an audio.cpp model is the audiocpp.model_spec.family
key stored inside the GGUF, which cannot be read from a remote repository, and the
upstream GGUF repository hosts every family in one place. Set backend: audio-cpp
in the model YAML, or select it explicitly in the import form.
The bundled audio-cpp gallery entries set backend:best in options to select
an available compute backend, with CPU as the fallback. To force CPU execution,
replace that option with backend:cpu. Model configurations that omit this
option still default to CPU, unless the AUDIOCPP_DEFAULT_BACKEND
environment variable is set on the backend process, which supplies the
fallback for exactly those models (an explicit backend: option always
wins). Set it to best in a deployment to give hand-written model
configurations the same accelerator selection the gallery entries get.
Sortformer installation
Install the Sortformer model for speaker diarization from the gallery:
If installation fails with SHA mismatch, compare the reported metadata checksum
with the current gallery entry. An outdated gallery checksum can reject a complete
download. Report a persistent mismatch with both checksum values and the model name.
Stable Audio SFX installation
Install the Stable Audio 3 Small SFX model for text-to-sound generation:
The gallery pins the Q8_0 file to an immutable upstream revision that matches
its SHA256 checksum. Changes to the upstream main branch do not change this
download. Use this model with /v1/sound-generation and set duration_seconds
to control the sound length.
What it serves
One model serves one family, and a family advertises the tasks it can perform. The
backend routes each LocalAI endpoint onto an audio.cpp task and refuses, with the
family’s real capability list in the message, when the loaded model cannot serve it.
LocalAI endpoint
gRPC RPC
audio.cpp tasks tried
/v1/audio/speech, /tts
TTS, TTSStream
tts, clon (voice cloning), vdes (voice design)
/v1/audio/transcriptions
AudioTranscription, AudioTranscriptionStream
asr, align (forced alignment, when a prompt is supplied)
/v1/realtime live transcription
AudioTranscriptionLive
asr in streaming mode
/v1/vad
VAD
vad
/v1/audio/diarization
Diarize
diar
/v1/sound-generation
SoundGeneration
gen
/audio/transform, /audio/transformations
AudioTransform
sep (separation), vc (voice conversion), svc, s2s
A supplied speaker clip routes TTS to clon; free-form instructions route it to vdes.
Singing voice conversion (svc) is never chosen automatically, because no request signal
means “this input is singing”; pin it with task:svc.
Not served, and why
These RPCs return UNIMPLEMENTED with an explanation rather than a degraded answer:
AudioEncode / AudioDecode: audio.cpp has no codec task kind, so no family can be
asked to turn PCM into codec frames or back.
AudioTransformStream: no family advertises streaming for any task
AudioTransform routes to (sep, vc, svc, s2s). Upstream advertises streaming for
tts, asr and vad only, so a streaming transform here would be a buffered offline
call in disguise.
AudioToAudioStream: LocalAI’s contract is an OpenAI-Realtime shaped audio
conversation with a system prompt and a tool loop. audio.cpp’s s2s is offline
clip-to-clip processing against a target voice.
VoiceEmbed: no family advertises the spk (speaker recognition) task, so nothing in
the engine can produce a speaker embedding. Use the
voice recognition backends instead.
Model YAML
None of the option names are guessable, so here is the full shape:
name:supertonicbackend:audio-cppparameters:model:supertonic-3-orig.ggufknown_usecases:- FLAG_TTSoptions:# Optional for an audio.cpp GGUF: the family is read from the file's# audiocpp.model_spec.family metadata. REQUIRED for a safetensors file or a# package directory, which carry no such key.- family:supertonic# Optional: pins the audio.cpp task instead of routing it from the RPC.- task:tts# ggml compute backend inside audio.cpp (not the LocalAI backend above).- backend:cuda- device:0- threads:8# Give up on a queued request instead of piling up behind a wedged run.- busy_timeout_ms:120000# Per-family knobs, passed through to the upstream loader and session.- load.vibevoice.lora:/models/my-adapter- session.seed_vc.weight_type:q8_0
Every entry is key:value, split on the first colon so values may contain more
(paths, for instance). An unknown key fails the load with INVALID_ARGUMENT and a message
listing the keys that exist, rather than being silently ignored.
Option reference
Option
Default
Meaning
family:<name>
read from the GGUF
The audio.cpp family. Optional for a standalone audio.cpp GGUF, which embeds audiocpp.model_spec.family. Required for a safetensors file or a package directory. Setting it explicitly also overrides the embedded value.
task:<name>
routed from the RPC
Pins the task. One of gen, tts, clon, vc, svc, s2s, asr, align, vad, diar, sep, vdes, spk. A pinned task is honoured exactly: if the family cannot serve it, the request is refused rather than rerouted.
backend:<name>
cpu
ggml compute backend: cpu, cuda, hip (rocm is an alias), vulkan, metal, best. Must match the backend image you installed (a hip value needs the ROCm image).
device:<n>
0
GPU index for the selected compute backend. Non-negative integer.
threads:<n>
runtime default
CPU threads. 0 leaves the choice to the runtime.
busy_timeout_ms:<n>
0 (unbounded)
Bounds the wait for the model’s single inference lane. A request that arrives while a run has already been in flight longer than this fails immediately with UNAVAILABLE instead of queueing, and a request that waits this long without the lane freeing up fails the same way. 0 waits indefinitely.
live_idle_timeout_ms:<n>
30000
How long AudioTranscriptionLive waits for the next audio frame before cancelling the stream and releasing the lane. That RPC holds the lane for the whole stream, so a peer that stops sending without closing would otherwise block every other request against this model. 0 disables the limit.
model_spec_override:<path>
unset
A model spec JSON file, or a directory containing <family>.json, used instead of the spec embedded in the GGUF. The path must exist at load time.
load.<key>:<value>
none
Forwarded to the upstream loader with the load. prefix stripped.
session.<key>:<value>
none
Forwarded to the upstream session with the session. prefix stripped.
Numeric options are validated at load time: a non-integer or negative value is refused
before the model is read, not after.
The load. and session. namespaces
Upstream families advertise their own options in two buckets, and the prefix decides which
bucket an entry lands in. The key that follows the prefix is passed through verbatim, and
upstream names those keys after the family, so both segments are needed:
The names each family accepts are declared upstream in its loader, and audio.cpp’s own CLI
prints them under “Model session options” and “Model load options” when asked for a model’s
help. Options that upstream lists as request options are not configurable here: they come
from the API request, not from the model YAML.
Voice activity detection with no download
The backend package ships upstream’s silero_vad and marblenet_vad assets, so VAD works
with nothing to fetch. bundled:<name> resolves to the asset directory inside the installed
backend. Those assets are directories rather than GGUF files, so the family cannot be
inferred and family: is required:
Separation families such as htdemucs and mel_band_roformer produce several named
outputs from one
run. Running inference once per stem would cost a full separation each time, so the backend
runs once, writes every stem to a sibling file next to the main output, and puts the
selected one in the response body. params[stem] picks which one:
Without params[stem] the body carries vocals when the model produces it, and the first
output otherwise. An unknown stem name is refused with a message listing the stems the model
really has, rather than quietly returning a different one. Every stem, including the one in
the body, is listed in the X-Audio-Stems response header. See
Audio Transform for the full endpoint contract.
params[stem] against a model that produces a single unnamed output is refused rather than
ignored.
Text-conditioned transforms
s2s is a text-and-prosody route, not an audio-only one: vevo2 resynthesises a line in
another voice and reads the line itself, refusing the run without it. AudioTransform has
no text field, so the text arrives as params[text] (or params[target_text], the name
vevo2’s own option table uses) and the backend lifts it into the engine’s text input.
params[language] rides along when the line is not English.
curl http://localhost:8080/audio/transformations \
-F model=audio-cpp-vevo2-speech-to-speech \
-F audio=@source.wav -F reference=@target-speaker.wav \
-F 'params[text]=The quick brown fox jumps over the lazy dog.' -o converted.wav
A model that takes no text ignores the keys, so separation and plain voice conversion are
unaffected.
Pinned tasks
The upstream turn task performs turn detection. LocalAI has no RPC for this
task, so requests to a model that only advertises turn are refused. It is not
routed through voice activity detection (vad).
The upstream wake (wake-word detection) and cls (audio classification) tasks
are reported in capability diagnostics. They cannot serve LocalAI audio RPCs,
including VAD, even when selected with the task option.
Two routes are unreachable by auto-routing and need task: in the model config, because
nothing in a request distinguishes them from a task the same family also advertises:
task:svc for singing voice conversion. seed_vc and vevo2 advertise both svc and
ordinary vc, and no request signal means “this input is singing”, so vc always wins.
task:s2s for speech to speech, for the same reason against the same vc.
The gallery entries that ship these routes carry the pin already. Removing it gives plain
voice conversion from the same weights.
Family notes
Fish Audio voice cloning: save a reference clip with its transcript in the
Voice Library (the Voice add-on, Speech voices), then select Use in Text to Speech. The backend accepts
params.ref_text as an alias for params.reference_text in both ordinary and
streaming speech requests. If you supply both parameters, reference_text
takes precedence. For direct requests with a reference file in voice, supply
its transcript in one of these parameters.
YuE2: the audio-cpp-yue2-3b gallery entry installs a model
directory containing the Q8_0 main model, the F16 VAE, and four required
sidecar files. Each request requires a non-empty params.style string. Set
the params.cot string to off, melody, or full. The model and GGUF
package are licensed under CC-BY-NC-4.0 for non-commercial use.
Supertonic: use the orig GGUF package, whose weights are f32. The f16 package was
observed to reach ggml_concat with mismatched operand types and take the backend
process down with SIGABRT on the first request, rather than returning an error.
Upstream’s docs/gguf.md leaves supertonic’s 16-bit column untested and records its
q8_0 as “No (unsupported weight dtype)”, which says the format is unusable rather than
that it crashes. The backend refuses both at load time with a message naming the
offending tensor, so neither reaches that abort.
Live transcription latency: AudioTranscriptionLive needs a family advertising asr
in streaming mode. At the pinned upstream revision that is nemotron_asr,
higgs_audio_stt and voxtral_realtime. higgs_audio_stt and voxtral_realtime decode
incrementally and emit partial text as chunks arrive. nemotron_asr only buffers in its
chunk handler and decodes everything in finalize(), so with that family every delta
arrives after the client closes its send side. Pick accordingly if you need partials
during speech.
Voice conversion vs singing: seed_vc and vevo2 advertise both vc and svc, and
automatic routing always picks vc. Pin task:svc for singing voice conversion.
Cloning-only families: chatterbox advertises clon and vc, and no plain tts at
all, so every /v1/audio/speech request against it must carry a reference clip in
voice. Without one the request is refused with INVALID_ARGUMENT naming that field,
rather than failing deep inside the model.
Acceleration
Variant
Platform
CPU
linux/amd64, linux/arm64
CUDA 12
linux/amd64
CUDA 13
linux/amd64
ROCm 10.1
linux/amd64
Metal
darwin/arm64
The ROCm image includes kernels for these GPU targets:
gfx908, gfx90a, gfx942, gfx950, gfx1030, gfx1100, gfx1101, gfx1102,
gfx1103, gfx1150, gfx1151, gfx1152, gfx1153, gfx1200 and gfx1201. Set the model option to backend:hip or
backend:rocm. There is no Vulkan image because the container would have no Vulkan ICD.
BUILD_TYPE=vulkan still works when you build the backend yourself.
NeMo-Speech.cpp backend
NeMo-Speech.cpp is NVIDIA’s Apache-2.0
C++/ggml runtime for the Nemotron Speech models. LocalAI exposes it through the native
nemo-speech-cpp backend, which serves four model families from one installed backend:
transcription, speaker diarization, speech synthesis and text translation.
NeMo-Speech.cpp is developed by NVIDIA, not by the LocalAI project.
Installing
local-ai backends install nemo-speech-cpp
Or install it from the Backends page in the web UI. nemo-speech-cpp is a
preference-only backend: LocalAI never picks it automatically during model import,
because the family is decided by the GGUF’s general.architecture key, which cannot be
read from a remote repository, and because a translation model carries an ordinary LLM
architecture with no NeMo-specific marker at all. Set backend: nemo-speech-cpp in the
model YAML, or select it explicitly in the import form.
How the family is chosen
The backend reads general.architecture from the GGUF at load time and picks the family
from it. Nothing else in the config selects it.
general.architecture
Family
Serves
asr
Transcription
/v1/audio/transcriptions, the same endpoint with stream=true, and the realtime live-transcription path
sortformer
Diarization
/v1/audio/diarization
magpietts
Text to speech
/v1/audio/speech, /tts, including streamed audio
nemo-nano-codec, vad, pnc
(none)
Auxiliary assets. Loading one directly is refused.
anything else
Translation
/v1/chat/completions and /v1/completions
Two rows need explaining.
The auxiliary architectures are converted NeMo components that attach to a primary
model and cannot run on their own. Pointing parameters.model at one fails the load with
a message naming the option it belongs on: the codec belongs on codec_model of a
magpietts model, the VAD on vad_model of an asr model, the punctuation model on
pnc_model of an asr model.
Everything else is translation, and that is deliberate rather than a fallback that
happens to catch it. Riva-Translate GGUFs are produced by llama.cpp’s converter and carry
an ordinary LLM architecture such as qwen3, so there is no NeMo-specific string to match
on. Selecting this backend explicitly is the signal that the model is meant for it.
A request for the wrong family is refused with UNIMPLEMENTED naming the family the model
was loaded as, rather than failing somewhere inside the runtime.
Model YAML
Options are key:value entries in the options: list, split on the first colon so a
value may contain more. Every path option is resolved relative to the models directory
when it is not absolute. An unknown key is ignored rather than rejected, so a config
written for a newer backend still loads on an older one.
Transcription
name:nemotron-asrbackend:nemo-speech-cppparameters:model:asr.ggufknown_usecases:- FLAG_TRANSCRIPToptions:# All optional. Each attaches a converted NeMo component to the recognizer.- vad_model:vad.gguf- pnc_model:pnc-bert-base-en.q8_0.gguf- itn_dir:sparrowhawk_grammars- diar_model:diarization.gguf- language_code:en-US# GPU device index. Omit it, or set -1, to run on the CPU.- gpu:0
Attaching diar_model is what turns on per-word speaker tags: the backend asks for
diarization only when the recognizer was created with a diarization model, because the
runtime refuses a request for it otherwise. Transcript segments are then cut at each
change of speaker. Without it there is a single unlabelled segment. Word-level timings are
returned only when the request asks for them with
timestamp_granularities[]=word, following the OpenAI contract.
language_code is the model-level default. A per-request language wins over it, and
both may be left empty, which the runtime reads as the model’s own default.
Diarization
A sortformer model is standalone: this pipeline has no ASR in it, so segments carry
speaker labels and timings but no text.
Sortformer is end to end and its speaker capacity is fixed by the checkpoint, so
num_speakers, min_speakers, max_speakers and clustering_threshold have nothing to
map onto and are logged and dropped. include_text is dropped for the same reason: there
is no ASR in this pipeline. min_duration_on and min_duration_off are honoured. To get
speaker labels on a transcript, use an asr model with diar_model instead.
Text to speech
name:magpie-ttsbackend:nemo-speech-cppparameters:model:magpie-tts/magpietts.ggufknown_usecases:- FLAG_TTSoptions:# Both are required, and both are auto-discovered when unset (see below).- codec_model:magpie-tts/nanocodec.gguf- tokenizer_dir:magpie-tts/extracted# Optional Sparrowhawk text-normalization grammars applied to the input text.- tn_dir:tts_grammars- language_code:en-US- gpu:0
codec_model and tokenizer_dir are both required, and both are discovered from the
model’s own directory when they are not set: a sibling file whose name contains
nanocodec or nano-codec becomes the codec, and a sibling directory named extracted
becomes the tokenizer directory. If discovery finds nothing, the load fails naming the
option to set. That is a hard error rather than a warning because the alternative is a
synthesizer that loads and emits noise.
Voices are selected by the request’s voice field. A non-negative integer is used as a
speaker index; anything else is passed through as a voice name. MagpieTTS conditions on a
speaker, not on a prose style, so instructions has nothing to map onto and is logged and
ignored. Per-request params are read for seed, steps, top_k, temperature and
cfg_scale; anything else is left at the synthesizer’s configured value.
The TTS runtime has a three-way CPU/CUDA/auto preference rather than a device index, so
gpu with a non-negative value means “let the runtime choose” here, and any negative
value (-1 is the default) pins it to the CPU.
Both flags run through the same pair of RPCs, Predict and PredictStream, which is why
both are listed for this backend in core/config/backend_capabilities.go. FLAG_COMPLETION
is the plain shape: prompt in, translation out. FLAG_CHAT adds three things, and each
turn of the conversation is translated on its own: the model becomes eligible as the
default chat model when a request names none, it appears in the web UI’s chat model
picker, and it stays visible under the gallery’s Chat filter (completion is not a
gallery filter, chat is). Neither flag gates a request that names the model explicitly.
Option reference
Option
Family
Default
Meaning
vad_model:<path>
ASR
unset
Converted Silero VAD GGUF, attached to the recognizer.
pnc_model:<path>
ASR
unset
Punctuation and capitalization BERT GGUF.
diar_model:<path>
ASR
unset
Sortformer GGUF. Setting it is the opt-in that enables per-word speaker tags.
itn_dir:<path>
ASR
unset
Sparrowhawk grammar directory for inverse text normalization, or a parent directory whose children are named per language (en, es, …). Linux only, see the limitations below.
language_code:<code>
ASR, TTS
unset
Model-level default language. A per-request language overrides it.
codec_model:<path>
TTS
auto-discovered
NanoCodec GGUF. Required.
tokenizer_dir:<path>
TTS
auto-discovered
Directory holding the extracted MagpieTTS tokenizer assets. Required.
tn_dir:<path>
TTS
unset
Sparrowhawk text-normalization grammars applied to the input text. Linux only, see the limitations below.
source_language:<code>
Translation
unset
Default source language. May be overridden per request.
target_language:<code>
Translation
unset
Default target language. A request with neither this nor a per-request override is refused.
gpu:<n>
all
-1 (CPU)
Device index. -1 selects the CPU. A value that is not an integer is ignored with a warning and the model runs on the CPU.
Translating
Translation is reached through the text endpoints: the prompt is the text to translate,
and the languages come from source_language and target_language.
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "riva-translate",
"messages": [{"role": "user", "content": "The quick brown fox jumps over the lazy dog."}]
}'
A leading [src->tgt] prefix on the prompt overrides the configured pair for that one
request:
{"role":"user","content":"[en->zh-cn] The quick brown fox jumps over the lazy dog."}
Either side may be left out to keep the model-level default for it, so [->de] changes
only the target. Three-segment pair tags such as en-zh-cn, en-pt-br and zh-tw-en
parse correctly. The prefix is stripped before the text reaches the model.
The C API takes a source and a target language and has no free-form generation entry
point, so there is no prompt in the LLM sense. Sampling parameters, tools, grammars and
attached media have no equivalent and are ignored; the structural ones (grammar,
tools, images, videos, audios, negative_prompt, logprobs) are named in the log
when a request sets them. Streaming works, but the runtime returns the finished
translation in one piece, so the whole result arrives as a single chunk rather than token
by token.
Streaming transcription
Streaming transcription and the realtime live path both emit a delta per finalized
utterance. Interim hypotheses are produced by the runtime and deliberately dropped: the
wire contract defines delta as newly finalized text that consumers concatenate, and the
runtime rewrites a final rather than extending its interims (it runs ITN and formatting
stripping on the final only). Forwarding interims would assemble “he”, “hell”, “hello”,
“Hello.” into hehellhelloHello. rather than into the transcript, and no diffing trick
recovers it.
The cost is latency: the first delta of an utterance arrives at its endpoint rather than
mid-word. That is the trade this backend takes.
Acceleration
Variant
Platform
CPU
linux/amd64, linux/arm64
CUDA 12
linux/amd64
CUDA 13
linux/amd64
Vulkan
linux/amd64, linux/arm64
NVIDIA Jetson (L4T), CUDA 12
linux/arm64
NVIDIA Jetson (L4T), CUDA 13
linux/arm64
Metal
darwin/arm64
There is no AMD ROCm and no Intel SYCL support, because upstream NeMo-Speech.cpp has
no HIP and no SYCL backend, so there is nothing to build against. A host reporting either
capability gets the CPU build, which is the honest answer rather than a broken image. If
you want NeMo ASR on an AMD or Intel GPU, use
parakeet-cpp instead, which is described on the
Audio to text page.
Limitations
Text normalization is Linux only. The macOS build ships without it: the
Sparrowhawk/OpenFST stack assumes a GNU toolchain, and the gcc-12 pin it needs (OpenFST’s
templates fail to compile on gcc-13 and gcc-14 at -O2) has no macOS equivalent. One
build flag covers both directions, so on macOS bothitn_dir (inverse text
normalization on ASR output) and tn_dir (text normalization on TTS input) do nothing.
A tn_dir set on a macOS build logs a warning and carries on with normalization
disabled. pnc_model is unaffected: punctuation is always compiled in.
Interim streaming results are suppressed, as described above. This costs latency.
Translation runs at the library’s default limits: 1024 tokens of context and 256
new tokens per call. Neither is configurable from the model YAML, because both are
create-time settings on the translator and raising the context costs one context-sized
KV cache per pooled context. The two limits fail differently. Input longer than the
context is rejected, with nmt: prompt too long (N tokens) for context 1024
surfacing as a failed request, so you will know. Output longer than 256 tokens is
silently cut: generation simply stops at the limit and the truncated translation is
returned as if it were complete. Translate a sentence or a paragraph at a time rather
than a whole document.
Converting models
Upstream has a single conversion entry point for every family. SOURCE may be a .nemo
archive, an extracted NeMo checkpoint, a local Hugging Face directory, or a Hugging Face
repository ID.
Copy the resulting GGUF into your models directory and write the YAML above against it.
Text to speech is the one family that needs more than a single conversion. It loads two
GGUFs, the MagpieTTS token generator and the NanoCodec decoder, and it needs the tokenizer
assets that live inside the MagpieTTS .nemo archive rather than in the GGUF. Extract the
archive and keep the extracted directory next to the converted model, so that
tokenizer_dir (or the extracted/ auto-discovery) has something to point at, and put the
codec GGUF in the same directory so codec_model (or its auto-discovery) finds it.
# 1. MagpieTTS: download the .nemo, extract it for the tokenizer, convert ithf download nvidia/magpie_tts_multilingual_357m --revision v2602 \
--local-dir /models/magpie-tts
mkdir -p /models/magpie-tts/extracted
tar -xf /models/magpie-tts/magpie_tts_multilingual_357m.nemo \
-C /models/magpie-tts/extracted
python3 convert_model.py /models/magpie-tts/extracted \
--outfile /models/magpie-tts/magpietts.gguf
# 2. NanoCodec: no tokenizer, it is a codec decoder. The filename carries# "nanocodec" so the auto-discovery in the YAML above picks it up.hf download nvidia/nemo-nano-codec-22khz-1.89kbps-21.5fps \
--local-dir /models/magpie-tts/nano-codec
python3 convert_model.py \
/models/magpie-tts/nano-codec/nemo-nano-codec-22khz-1.89kbps-21.5fps.nemo \
--outfile /models/magpie-tts/nanocodec.gguf
Skipping the codec leaves the model unloadable: the backend fails with
no NanoCodec GGUF found next to ... naming the codec_model option.
Translation additionally uses the pinned llama.cpp converter, which has to be initialized
first:
The whisper-medusa backend serves aiola’s Whisper-Medusa checkpoints through
LocalAI’s OpenAI-compatible audio transcription endpoint. Whisper-Medusa uses
multiple decoding heads to predict several tokens per decoding step.
Model configuration
Install the whisper-medusa backend from the backend gallery, then create a
model configuration such as:
language in the request overrides the configured default. The regulation
options control the exponential length penalty passed to upstream generation.
Warning
The upstream Whisper-Medusa repository is archived. Its implementation accepts
clips of at most 30 seconds and expects 16 kHz audio; LocalAI resamples input to
16 kHz and rejects longer clips. The LibriSpeech checkpoints are optimized for
English. Use aiola/whisper-medusa-multilingual for supported multilingual
audio.
The backend currently ships Linux CPU and NVIDIA CUDA 12 images. It is not
advertised for macOS, ROCm, Intel GPU, or Jetson because upstream pins PyTorch
2.2.2 and has not published compatibility for those platforms.
Model Updates
A gallery entry can change after you install it. The weights can move to a new
build, the configuration can change, or a checksum bot can rewrite a hash.
LocalAI checks for this and tells you. It never changes a model by itself: a
model upgrades only when you ask for it.
This page covers gallery models. Backends have their own updates; see
Backends.
What counts as an update
When LocalAI installs a model from a gallery, it records where the model came
from and a digest of what the entry installed. The digest covers:
the files of the entry (name, URI and sha256 of each),
the configuration the entry writes (config_file, overrides and the base
configuration it points to, with its prompt templates),
the variant that was installed.
An update is a new digest. A change of the description, the icon, the license,
the tags, the size or the URLs of the entry does not change it.
Only models that were installed from a gallery entry are tracked. A model that
you imported from a URL or a configuration file has no entry to compare with.
The states
Admin → Updates lists each tracked model with one of these states. The
Models page shows the same state on each model.
State
Meaning
up-to-date
The entry is the same as at install time.
update-available
The entry changed. The update does not overwrite anything you edited.
edited
The entry changed, and it would overwrite keys that you edited in the model configuration. You choose a value for each of them before the upgrade starts.
unknown
The check cannot compare. The reason is one of: the model was installed before this feature (see below), the check has not run yet, the check could not read the base configuration of the entry, or the model files cannot be read.
gone
No configured gallery lists the entry any more. The installed version keeps working.
held
You hold this version. LocalAI offers no update for it.
failed
The last upgrade did not complete. The old version serves. The row has the error and Retry.
A model that you installed with an earlier release has no record of its origin.
It shows as unknown (reason legacy-sidecar) until you adopt it, or
install it again from the gallery.
Adopting a model installed by an earlier release
Adopt records the gallery entry a model came from, so that LocalAI checks its
updates like those of a model installed now. It writes only the record of the
model:
the gallery and the entry,
the files the model has, as its old record lists them,
what the gallery would write as the configuration of the model now.
Adopt does not change the configuration on disk. A key that differs from what
the gallery would write reads as an edit at the next check, so your changes
stay protected by the edited keys rules. A value that an older
version of the entry wrote and that the entry changed since also reads as an
edit; choose Take the gallery’s for it at the upgrade.
LocalAI finds the entry by the name of the model (and the entry name in its
old record) in the configured galleries. It adopts only when exactly one
gallery lists that entry. Otherwise the request is refused with the list of
candidates (gallery@entry), and you send it again with the gallery, and the
entry when its name differs from the model’s. When the files of the model are
not the files the entry lists now, the next check shows update-available.
Adopt does not run a check: press Check now to see the new state.
Checking
LocalAI checks 30 seconds after the server starts and then every six hours. The
interval is not a setting. A check reads the gallery indexes again (it does not
use the copy that LocalAI keeps in memory for up to an hour) and compares each
tracked model with its entry. It installs nothing.
Check now on the Updates page runs a check at once and waits for the
answer (at most 60 seconds). A check that ended less than 15 seconds before
answers from that result and is marked throttled. If the check fails, the
gallery line on the Updates page shows the error and the list keeps the result
of the last good check.
Where you see it
The Updates page (Admin → Updates) has a row for each model that
needs you or is changing. Held models, unknown and gone models, and
models that still keep an old version, are in the group Other models.
Upgrade on a model row opens the model’s own confirmation (the files, the loaded model that stops, a choice for each edited key). The review of Update N ready lists the models too, unselected: a model update reloads the model. Upgrades you start run on the server in the background, so you can close the page. On a server that keeps upgrade runs, the Upgrade of a model row starts a run of one item, and the page shows the run at once. Only one run runs at a time: while a run runs, another upgrade (also one with options, and a Retry) is refused with 409 and code run_active, and the row says so. A run updates the models after the backends, one model at a time (see Upgrade runs), and Cancel remaining cancels the items that have not finished. A server that keeps no runs queues each upgrade directly; upgrades of different models then run at the same time, up to the limit of concurrent model operations (default 2, see Concurrent Model Operations), and the rest wait as queued and can be cancelled.
The notification center gets three kinds of item for administrators. They
work with the chats on or off, and they are not sent to a Telegram or Slack
chat.
A digest, “N model updates available”. It lists the models in the states
update-available, edited and failed. It is kept up to date in place
and removed when none is left.
The end of an upgrade, “Model X upgraded” or “Model X: the upgrade failed”
with the reason. It is written once for each upgrade operation, also when
the upgrade ends before it changes anything: the model is up to date, the
entry is gone, a check of the preflight refuses it, edited keys need a
choice, or the model is held. A cancelled or paused upgrade is told as
“cancelled”, not as a failure: the model keeps the state it had before.
“Model X: the old version was removed”, after Remove old version.
The LocalAI Assistant
has the tools model_updates and upgrade_model.
Upgrade on a row opens a confirmation. It lists the files that change, says
whether the model is loaded now, and, for an edited model, asks for a choice
for each key. Nothing starts until you confirm.
Edited keys
LocalAI compares the configuration on disk with what the install wrote. A key
that you changed is an edit. An edit that the update does not touch is kept
without asking. For an edit that the update also changes, you choose:
Keep mine: the key keeps your value.
Take the gallery’s: the key gets the new value.
The upgrade does not start while one of these keys has no choice.
If the record of the model has no copy of the configuration that the install
wrote, LocalAI cannot tell an edit from a value of the old version. The upgrade
then writes the gallery’s new configuration and keeps only the operator state
(pinned and disabled) from the configuration on disk.
Config-only upgrades
When an update changes no model file (only the configuration or the prompt
templates), nothing needs to download. The dialog then offers Apply only the
config and the prompt templates. A config-only upgrade is refused when the
new configuration needs a file that is not on disk.
What happens during an upgrade
An upgrade runs as an operation, like an install. It reads the gallery indexes
again when it starts, so it installs what the entry gives now, also on a
frontend of a cluster that did not run the last check. Its phases are:
Preflight. LocalAI checks that the backend the new version needs is
installed, that no file to replace is used by another model, that the gallery
gives a sha256 for each new weights file, and that the disk has room for the
new files (when the server tells the file size). A failed check ends the
upgrade here, with nothing changed.
Staging. The new files download next to the old ones under a .next
name, and LocalAI checks each sha256. The model keeps running on the old
version.
Unloading. LocalAI refuses every new load of the model, and if the
model is loaded, it stops. From here until the new version can load, a
request to the model is answered 503 with a Retry-After header. A
request cannot start the old version again while the files change.
Committing. LocalAI keeps each old file as <file>.prev-<digest8>
(digest8 is the first eight characters of the old digest), moves the new
files into place and writes the new configuration.
Loading. LocalAI reads the new configuration, stops any instance of the
model that still runs (for example a load that was already starting when
the upgrade stopped the model), and allows loads again. Then the new version
loads, as a check. A change of the weights alone does not change the
configuration, so this stop does not depend on it. A model that was not
loaded before the upgrade is stopped again after the check.
Confirmed. The upgrade is done.
You can cancel or pause an upgrade only in the first two phases. After the
model stops, the upgrade runs to its end (confirmed or rolled back), and
LocalAI refuses a cancel or a pause: POST /api/operations/{id}/cancel and
/pause answer 400 with the reason. A cancel removes the partial downloads.
A pause keeps them, so the next upgrade to the same version resumes them. If
the gallery changed in between, the resumed file fails its checksum and the
upgrade fails; run it again.
If the server stops during an upgrade, it ends the upgrade at the next start
(in a cluster, another frontend ends it within minutes; see
Distributed mode).
Before the unloading phase it removes the staged files and the upgrade ends
failed. From the unloading phase on, it puts the old version back.
An edit during an upgrade
The upgrade merges the new configuration with your configuration when it
starts. If you save a change to the model configuration while the upgrade
runs, LocalAI does not overwrite it:
An edit before the switch (during the download, or between the stop and the
switch) ends the upgrade with the error “the model config was edited while
the upgrade ran”. Nothing of the upgrade is applied and your edit stays. If
the model was stopped, the old version loads again. Run the upgrade again to
merge your edit with the update.
An edit after the switch, while the new version loads, is kept if the load
fails and the upgrade rolls back: the old files come back, but the
configuration stays as you saved it, and the error of the upgrade says so.
A failed load and the rollback
If the new version does not load, LocalAI puts the old version back: the old
configuration (from a copy that it keeps in its record of the model while the
check runs), the old files, and the old record. It then loads the old version
again if the model was loaded. The state of the model is failed. The row and
the notification show the error. Fix the cause, or wait for a new gallery
entry, and press Retry. A retry uses the same options and choices and aims
at what the gallery entry installs now.
If the rollback itself fails, the error names both failures. Check the model
files before you retry.
The old version stays
After a confirmed upgrade, the old files stay on disk as .prev-<digest8>
files. The row says “Old version kept” and has Remove old version. That
action deletes those files after a confirmation and cannot be undone. It does
not change the model configuration. A file that another model uses is not
deleted.
The old configuration is not kept after the load check passes. The old
files are.
Hold this version
Hold this version (the row menu, or the Updates card on the model’s own
page) stops LocalAI from offering an update for that model. The state becomes
held. Release hold undoes it. A hold changes only the record of the model:
the configuration and the loaded model stay as they are, and a reinstall keeps
the hold. You cannot change a hold while an upgrade of the model runs.
The server enforces the hold. An upgrade or a retry of a held model is refused,
from the REST API (409, “release the hold before you upgrade it”) and from
the assistant, as well as in the web UI. An upgrade that was queued before the
hold was set is refused when it starts. Release the hold, then upgrade. In a
cluster, a hold and an upgrade of the same model take the same lock, so a hold
set on one frontend is never lost to an upgrade on another.
A hold is not a pin. A pin keeps a model loaded and out of the eviction
list (see VRAM and Memory Management).
A hold only says “do not offer me an update”. Both can be set on the same model.
Known limits
There is no way back to an earlier version after the upgrade is confirmed.
Rollback happens only when the new version fails its load check. The old
files stay until you remove them, but LocalAI does not restore them for you.
A Hugging Face artifact snapshot (a model that the gallery points at a
Hugging Face repository) is not part of the staged files. An upgrade does not
keep the old snapshot, does not roll it back, and Remove old version does
not delete it.
An upgrade is refused when the new version needs a backend that is not
installed. Install the backend first.
The new weights need a sha256 in the gallery entry. Without one, the upgrade
does not download them.
In a cluster, the strategy canary is stored but not active yet. See
Distributed mode.
REST API
All routes need an administrator. The same routes serve the web UI. Their
definitions are in the API reference (Swagger).
Check now. The call waits for the check and installs nothing:
curl -X POST http://localhost:8080/api/models/updates/check
Upgrade a model. The body is optional. config_only applies only the
configuration and the templates. choices gives mine or gallery for each
conflicting key, by dotted key name:
Follow the job on status_url or on /api/operations. Without config_only
and choices, the upgrade runs as an upgrade run
of one item, and the answer also has the run in run. With config_only or
choices, and for POST /api/models/{name}/upgrade/retry, the upgrade is
queued directly, because a run makes no such choice; while a run runs, these
are refused with 409 and code run_active too. The route answers:
Status
Meaning
404
The model is not installed.
409
An upgrade of this model runs, the model is held, or edited keys need a choice. The last case lists the keys in keys. With coderun_active, an upgrade run is running.
422
The model was not installed from a gallery with a recorded origin.
400
A choice is not mine or gallery.
500
An unexpected error. The answer does not repeat its text, which can name paths of the server; the server log has it.
Errors of an upgrade, in the API, in the record of the model and in the
notifications (a browser push included), name files relative to the models
directory, never by their full path.
A refusal of the preflight (no backend, no checksum, not enough disk) does not
come from this call. It ends the operation with an error, and nothing changes.
Retry a failed upgrade. The call has no body. It answers 409 when the last
upgrade did not fail, or when the model is held:
curl -X POST http://localhost:8080/api/models/qwen3-4b/upgrade/retry
Remove the old version after a confirmed upgrade:
curl -X POST http://localhost:8080/api/models/qwen3-4b/remove-old
# {"name": "qwen3-4b", "removed": ["qwen3-4b-q4.gguf.prev-1a2b3c4d"]}
When only some of the old files can be removed (a file that another model uses
now stays), the call answers 200 and adds kept, the files still listed for
a later removal, and errors, the reason for each. When none can be removed it
answers 409.
It answers 409 with candidates when more than one gallery lists the entry,
when the model already records its origin, or while an upgrade of it runs, and
422 when the model has no record of a gallery install or no gallery lists the
entry (with the candidates of other galleries, when there are some).
The old rewrite route is gone
POST /api/models/config/{id} used to rewrite a model configuration from its
gallery entry at once, with no check and no backup. It now always answers
410 Gone, with a Link header that points to POST /api/models/upgrade/{name}.
To get the same result, upgrade the model with {"config_only": true}. The
410 answer stays for one release.
model_updates lists the models and their states. With actioncheck it
reads the galleries now.
upgrade_model takes the name of a model and an action: upgrade,
config_only, retry, remove_old, hold, unhold or adopt. choices
applies to upgrade and config_only; gallery and entry apply to
adopt. The assistant asks you to confirm before it runs
it.
An upgrade run updates a set of backends, gallery models and add-ons in one
request. The server owns the run: it orders the items, starts each update,
follows it to the end and keeps the result. A reload of the page, a restart of
the server or the loss of one frontend in a cluster does not lose the run.
Each item has a key <kind>:<name>, the same id the Updates page uses:
Kind
Example
What it updates
gallery
gallery:kokoro
A backend from a backend gallery
library
library:main/whisper
A backend from a backend library (<source>/<name>)
model
model:qwen3-8b
A model installed from a model gallery
addon
addon:notes
An installed add-on
Starting a run
A preview lists the items that have an update, in run order, with what each
update does (for example, a backend update stops the models that use it) and
whether it can start. Backends and add-ons are selected by default. Models are
not, because a model upgrade stops the model.
A start request names the items and, for each one, the expected_to of the
preview. The server checks every item before it creates the run: the item must
be installed, it must have an update, and the update must still go to
expected_to. If one item fails a check, the server refuses the whole request
and creates no run.
What expected_to guarantees
expected_to is checked, not enforced inside the operation:
Before each item starts. Just before the operation of an item starts,
the run checks the item again. When the update no longer goes to
expected_to, the item ends failed with the error key stale
(retryable), and nothing is installed.
During the operation. A gallery backend or model operation reads the
gallery when it runs and installs the build the gallery lists then. It does
not compare that build with expected_to again, so a gallery change in the
short time between the check and the download is installed. A library
backend item passes the version it was checked for to the library install. The integrity
checks of the gallery entry (the SHA-256 and the signature policy) run on
the downloaded build before the swap; a build that fails them is never put
in place.
Add-on items are pinned: the add-on owner records the upgrade with the
installed digest and the candidate digest (expected_to) when the item is
queued, and checks both again when the operation runs. A candidate that
moved ends the item with the owner’s code, for example candidate_changed.
from and to are for people: the version, or the digest when there is no
version. expected_to is what the request pins. For a backend and a model it
is the same as to. For an add-on, from and to are versions and
expected_to is the digest of the candidate release, because a version tag can
move to other content. An add-on item also has title, the name the Add-ons
page shows.
Risks
A preview item lists what its update does beyond replacing the item, as
risks (the codes) and risk (each code with its numbers). The numbers are
decimal strings. A risk is listed only when the server knows it:
Code
Params
Meaning
stops_models
count, nodes
count loaded models use the backend on nodes nodes. They stop while it is replaced.
cluster
nodes
The backend is replaced on nodes nodes. Sent when no loaded model is known to use it.
drift
count
count nodes run a different build of the backend now. The update moves every node to the new build.
config_only
The model update changes only its configuration. Nothing is downloaded.
migrates_data
An add-on update. The owner backs up the data of the add-on first, and the new version can migrate it.
Only a cluster knows which models run with a backend, so a single server does
not send stops_models, cluster or drift. Every model update stops the
model, downloads the changed files and loads the new version as a check; this
has no risk code.
A held model, or a model whose update changes configuration keys that a
person edited, is part of the run as skipped. A run makes no choice for
edited keys. Upgrade such a model from its own page.
Only one run runs at a time.
Order
A run has three stages:
Backends (gallery and library). Up to the backend operation limit
(max_concurrent_backend_operations, default 2) run at the same time. Two
updates of the same backend never run at the same time.
Models, after all backends are done, one at a time.
Add-ons, after all models are done, one at a time. The add-on owner
runs one lifecycle operation at a time.
A queued item tells why it waits (queued_reason): after_backends,
after_models, backend_limit, same_backend, one_model_at_a_time or
one_addon_at_a_time.
Each item uses the same operation as a single update: the backend operation
queue, the model upgrade, the library install or the add-on upgrade. The
operation shows in /api/operations as usual, and the progress of the item is
read from it.
When an item is done
An item is updated only when both of these are true:
its operation ended without an error, and
a fresh check no longer lists the item.
If the operation ended but the check still lists the item, the item is
failed with the error key stale. If no check can answer (a source failed),
the item is unconfirmed.
Phase
Meaning
queued
Waits for its stage or a free slot
running
Its operation runs, or the check runs
updated
Done, and the check confirmed it
failed
The operation failed, or the item is still listed
rolled_back
The operation failed and restored the previous version
cancelled
Cancelled before or while it ran
skipped
Held, edited keys, or no update any more
unconfirmed
No check could confirm the result
While the check runs, the item has verifying: true: it is still in
progress, also in the unconfirmed phase after a restart. An unconfirmed
item without verifying is settled: no check could answer.
The error and message of an item, and the message of each node, are
cleaned where they enter the run, so the REST routes, the Updates page, the
inbox, the history and the assistant all get the same text: one line of at
most 512 characters, with no control characters or markup, each absolute or
home-directory path cut to its file name, and the user and password of a URL,
bearer credentials and values such as token= or password= removed.
A failure has an error key: download, verify, swap, start,
not_installed, no_update, held, edited_keys, stale or unknown. A
failed add-on keeps the failure code of the add-on owner, for example
upgrade_failed or recovery_required.
A backend item takes the error key and the rollback from its operation (see
Starting an upgrade):
a new build that did not start and was replaced by the previous one ends the
item rolled_back with the key start. The error of such an item is the
cause alone (for example “the backend process exited before it answered a
health check (exit code 3): …”): the key already says that the new build did
not start, and the Updates page and the inbox put that sentence before the
cause. An operation whose worker reply never
came ends the item unconfirmed, and a fresh check decides as above. In a
cluster, nodes lists the result of each node: id, name, phase
(success, error, rolled_back, unconfirmed, or a phase of a node that
still runs), progress, message and error_key. The frontend does not trust
the text a worker sends: it keeps at most the last 512 bytes of the error, the
cause and the restart error of each reply and cleans them as below, and a code
it does not know becomes unknown.
Cancel, retry and dismiss
Cancelling a queued item removes it from the run. A running item can be
cancelled only while its operation says it can stop. For example, a model
upgrade cannot stop while it switches the files. The cancellable field of
an item is true only for a running item whose operation can stop now; a
queued item has cancellable: false and can always be cancelled.
Cancelling the run cancels the queued items and stops the running ones when
they can stop. The run then ends cancelled.
Retry starts a new run with the retryable items of a finished run that
failed, rolled back or stayed unconfirmed, if they still have an update. The
old run does not change. A run that is over changes only when it is
dismissed. The new run is a manual run of the administrator who retries:
its checks and its add-on items run as that administrator, never as the one
who started the old run. The retry of an automatic run is a manual run too,
so its add-on items go through the path of an administrator, with the
digests pinned, and not through the automatic upgrade.
Dismiss hides a finished run from the default list.
An item is retryable when a new try can fix its failure without a person
doing something first. The error key decides:
Retryable
Error keys
Yes
download, verify, swap, start, stale, unknown, unavailable, interrupted (also an item that a restart stopped), and the add-on codes upgrade_failed, stale_installed, candidate_changed and check_failed
No
Every other key, for example incompatible, integrity_error, recovery_required, forbidden, not_human_surface, held, edited_keys, approval_required, approval_stale, upgrade_conflict and operation_conflict
An unconfirmed item is retryable: the retry checks it again. The Updates
page shows Retry only on a retryable item.
Restarts
The run and its items are stored in the database. When the server restarts,
it takes over the runs that were running. The operations of the old process
stopped with it, so each item that was running becomes unconfirmed and a
fresh check decides: updated if the item is no longer listed, failed with
interrupted if it is (“the update was interrupted by a restart”). The item
is retryable. Queued items continue.
A crash in the middle of a backend install or upgrade can leave files on
disk. At start, before any operation can run, a server that is not part of a
cluster cleans them: it removes the staged new build next to the backend
(<backend>.upgrade-tmp, <backend>.install-tmp) and the partial downloads in
the download staging directory (LOCALAI_DOWNLOAD_STAGING_PATH). It never
removes a previous build (<backend>.backup, <backend>.install-backup): when
the backend directory is missing, the previous build is put back; when both
are there, the server logs it and leaves both, because the backend in place
may be a new build whose start check never ran. A build moved aside because it
did not start (<backend>.failed) stays too. The next install or upgrade of
the backend does not delete a previous build it finds either: it moves it to
<backend>.backup.kept-<time> (or .install-backup.kept-<time>) and logs it,
and refuses to start when it cannot move it. Remove a kept build once the
backend works.
Distributed mode
The run uses two of the modes of distributed state: shared state and a single
runner.
Shared state. The runs are rows in the shared database (upgrade_runs
and upgrade_run_items), on PostgreSQL in a cluster and on SQLite on a
single server. Every frontend can read a run, list the runs, cancel a run or
an item, retry and dismiss. The progress of a running item is not copied
into these rows: each frontend reads it from the status of the operation,
which the frontends already share.
Single runner. One frontend runs a run. It holds an advisory lock of
that run for as long as it runs it, and only it starts operations, follows
them and writes the state of the run. A cancel through another frontend sets
a flag in the database, and the runner applies it. A broadcast on the bus
makes the runner apply it at once, and tells the other frontends that the
run changed.
Takeover. When the frontend that runs a run dies, PostgreSQL frees its
lock (in about 30 seconds). Every frontend looks for runs that nobody runs
at a regular interval, and the first one that takes the lock continues the
run as after a restart. A frontend that loses its lock but keeps running
(a lost database session) leaves its operations running: the frontend that
takes the run over follows an item whose operation still has a status, and
checks only the others. When that status shows no change for two minutes,
the frontend that ran it is taken as gone and the item is checked too. From the takeover on, the run rows refuse the writes
of the frontend that lost the run.
Admission. A second advisory lock lets only one frontend at a time start
a run, so two frontends cannot start two runs at the same time.
Stale operations. The 30-minute reaper of gallery operations fails an
operation that did not change for 30 minutes. An operation of a run can wait
that long in the queue behind a large download. The runner updates the
operations it follows at a regular interval, so the reaper does not fail
them. When the runner dies, it stops doing that, and the reaper handles
them as usual.
Where the runs are kept
In a cluster the runs are rows in the shared database. On a single server
they are in the authentication database when authentication is on, and
otherwise in the SQLite file upgrade_runs.db under the data path. A server
with neither does not keep runs: the run routes answer 503, and the single
upgrade routes below queue their upgrade directly, as before.
Retention
The server removes finished runs (finished or cancelled) and their items
that ended more than 30 days ago, and keeps at most the newest 200 finished
runs. A running run is never removed and does not count. Dismissing a run
only hides it; the retention removes it later.
Flag
Default
Environment variable
--upgrade-run-retention-days
30 (-1 keeps runs of any age)
LOCALAI_UPGRADE_RUN_RETENTION_DAYS
--upgrade-run-keep
200 (-1 keeps any number)
LOCALAI_UPGRADE_RUN_KEEP
The removal runs once an hour from the loop that takes over the runs nobody
runs. In a cluster, it takes the advisory lock that admits a new run, so one
frontend at a time removes runs; the others skip that round.
Notifications of a run
Every run is one item in the inbox of each administrator. The frontend that
runs the run writes it, so a cluster writes one item for each run.
While the run runs: the live item (code updates.run, key
updates.run.<id>). It is created when the run starts and edited in place
on every change, so it never grows into a list. It never notifies (no
browser push, no connectors), not even when it is created. It writes at most
once every 1.5 seconds for each run; the last change of a burst is always
written. It links to the run (/app/updates?run=<id>).
When the run ended: the end item (code updates.run.end, key
updates.run.end.<id>). It is written once, when the run ends, and notifies
once (browser push and connectors). Then the live item is removed, so the
end item is the only item of the run. It says how many items were updated
and how many need attention. When any needs attention, it is a failure and
names the first one with its error. The error is cleaned as the item error
is, and cut to 160 characters.
An item needs attention when it failed, rolled_back, stayed
unconfirmed, or was skipped with an error key (for example held,
edited_keys or not_human_surface). A cancelled item does not: a person
asked for it. The result at the top of the Updates page counts the same items.
The operations of the items do not write their own “installed”, “upgraded” or
“failed” items: the item of the run replaces them. This holds for every kind,
a model upgrade included. An operation started
outside a run (an install, a removal) still writes its own item when it ends.
The live item has these params: run, progress (0 to 100 for the whole run),
done, total, source (manual or auto), updated, running and
queued.
The end item has run, total, updated, failed and source. A run that
was cancelled also has state: "cancelled" and cancelled, the number of
items that did not run, and its title says “Update run cancelled: 1 updated”.
When failed is more than zero it also has first_name, first_from,
first_error and first_key. first_name is the title of an add-on,
first_from is the version the item is still on (a digest only when there is
no version), and first_key is the error key of that item.
The automatic update of backends (setting Update backends automatically)
and of add-ons (Update add-ons automatically) starts a run with the source
auto. The run shows in the Updates page and in /api/operations like a run
that a person started, and has the notifications above. Both settings are off
by default.
Backends. A scheduled check lists the gallery and library backends that
have an update, and starts one run for all of them. The check no longer
installs inside its own pass.
Add-ons. The add-on pass starts one run for the add-ons it would upgrade
now. Each add-on item goes through the add-on owner’s own automatic upgrade,
with the same rules as before: the owner’s system actor, the digests pinned,
no approval given for anybody, and a release that failed is not tried again
until the library lists another one. A release that needs host access nobody
approved stays on the old version. Its item ends failed with a message that
starts with “held”, and the end item of the run counts it as needing
attention. Approve the upgrade on the add-on page.
Only the add-on owner adds add-ons. The add-on pass runs on the process
of the add-on owner, and an automatic run lists and upgrades add-ons there,
on the owner itself, as the system actor of the automatic upgrade. That
actor never goes through the add-on gateway, which refuses it. Runs that a
person starts keep their path as that person. A process that is not the
owner can start the run of the backends, and never has add-on items.
A release that did not start is held back. An automatic run leaves out
an item whose target (the version or digest in expected_to) already ended
rolled_back, or failed with the key start, verify or swap, in the
newest attempt of that release in one of the last 20 runs, dismissed runs
included. A new try of the same release ends the same way, so without the
hold every pass ran its start check again and added an item to the inbox.
Other failures (download, unavailable, unknown, interrupted, …) are
tried again. The hold ends when the gallery lists another release. A run
that a person starts is never held back: start the item from its row to try
the release again. When every item of a pass is held back, no run starts and
nothing is written. The Updates page shows a held-back backend as
“Held back: this release did not start”, and GET /api/backends/updates
marks it with heldBack: true.
One run at a time. When a run is already running, the pass does not
start another and does not write anything. It tries again every minute,
and at the latest at the next scheduled pass, which lists the same items
again. No update is lost.
Results. A pass that started a run does not write its own result item
(“Backends: 2 updated automatically”): the end item of the run replaces it.
The digest of the updates that need a person and the item of a failed check
stay as they are.
Without the run service. A server that keeps no runs (see
Where the runs are kept) installs inside the pass
and writes the result items, as before.
Add-on items
An add-on item goes through the same path as
POST /api/addons/{id}/upgrade. The add-on owner records the upgrade for the
administrator who started the run, with the installed digest and the candidate
digest pinned, and checks it as it checks the explicit upgrade. The operation
queue then runs it for that administrator, and the owner checks the pins again
when it starts. A run that a person started never upgrades an add-on as a system identity.
The automatic run is the exception: it uses the owner’s own automatic upgrade
(see Automatic updates are runs).
The explicit upgrade is accepted only from the administrator’s own browser
session. A run keeps that rule: its add-on items run only when the request
that started the run came from that session, with the header
X-LocalAI-Confirm: upgrade-run. Otherwise each add-on item ends skipped:
Error key
Why
not_human_surface
The run was started with an API key, by the assistant, or without the confirmation header.
forbidden
The account that started the run is not an add-on administrator.
These two keys end the item skipped. unavailable (the add-on owner did not
answer) ends it failed, and a retry takes it.
A refusal of the owner ends the item failed with the type of the owner, for
example stale_installed, candidate_changed, incompatible or
upgrade_conflict. An upgrade that needs host access nobody approved fails
with the failure code of the owner (approval_required); approve it on the
add-on page. A retry of a run with add-on items needs the same browser
session and header.
The list of add-ons with an update comes from the add-on owner, read through
the add-on gateway as the account that asked: the owner answers on its own
process, and every other frontend forwards the read to it, as the add-on
routes do. A preview, a start and the checks of a run see the same add-ons on
every frontend. A run whose actor is not an add-on administrator cannot list
add-ons, so a start of an add-on item is refused with source_unchecked. When
the owner cannot be reached, a start of an add-on item is refused with
source_unchecked, and an add-on item that was about to start ends failed
with the error key unavailable (retryable).
Access and trust
Any administrator can read and cancel any run. The run tools are
shared admin tooling: every administrator sees every run, its items and its
errors, and can cancel a run or an item that another administrator or the
automatic update started. A retry is a new run of the administrator who
retries.
The assistant asks before it starts or cancels a run. The tools
upgrade_run_start and upgrade_run_cancel rely on the rule of the
assistant’s safety prompt that it confirms with you before it changes
anything. That rule is in the prompt, not in code, as for every mutating
admin tool. Add-on items are refused in code: upgrade_run_start does not
take them.
The start check runs the new build. After the swap, the server starts
the downloaded backend build once, as the user LocalAI runs as, to check
that it starts (see
When the new build does not start).
Without strict integrity (--require-backend-integrity off), a build from a
gallery entry with no SHA-256 and no signature policy is accepted, so such a
build runs at upgrade time, and not only at the next model load.
REST API
All routes need an administrator. Their definitions are in the API reference
(Swagger, tag updates). A refusal has the same shape on every route:
{"code":"run_active","key":"","message":"another upgrade run is running (2f0c...)"}
Code
Status
Meaning
invalid
400
The request is malformed: no item, an unknown kind, an empty name, a source other than manual.
not_found
404
No such run, or no such item in the run.
no_update
409
The item is not installed, has no update, or cannot be updated on this server.
stale
409
The update no longer goes to expected_to. Preview again.
source_unchecked
409
The check of the kind of the item did not answer. Check again.
run_active
409
Another run is running.
held_back
409
Only an automatic run: every item is a release that did not start before (see Automatic updates are runs).
not_cancellable
409
The item cannot stop now.
run_finished
409
The run is over.
run_not_finished
409
The run still runs (retry and dismiss).
nothing_to_retry
409
No item of the run can be retried, or none still has an update.
not_human_surface
409
A retry that includes add-on items did not come from the administrator’s browser session.
unavailable
503
The server keeps no runs.
key names the item when the refusal is about one.
Route
Answer
POST /api/updates/runs/preview
200, the plan
POST /api/updates/runs
202, the run
GET /api/updates/runs
200, {"runs": [...]}, the running run first, then the newest. ?active=1 lists only the running run; ?limit= caps the list (default 20). Dismissed runs are left out.
GET /api/updates/runs/{id}
200, the run
POST /api/updates/runs/{id}/cancel
200, the run
POST /api/updates/runs/{id}/items/{key}/cancel
200, the run. Encode the key: library:main%2Fwhisper.
POST /api/updates/runs/{id}/retry
200, the new run
DELETE /api/updates/runs/{id}
204
A cancel answers at once; the runner applies it, so the item changes phase a
moment later.
Preview. The body is optional; an empty list previews every item with an
update:
reason says why an item cannot start: held, edited_keys, in_run,
no_update or a reason of the server such as installs_disabled.
active_run_id is set while a run runs. complete is false when a source
did not answer, so items may be missing.
job_id is the operation of /api/operations that runs the item. actor is
the id of the account that started the run (for a retry, the account that
retried). An add-on item also has title,
and its expected_to is the digest it is pinned to. Empty fields are left out.
The single upgrade routes
These routes keep their answers for existing clients. Each starts a run of one
item and adds the run to its answer:
Route
Answer
Added
POST /api/backends/upgrade/{name}
200, jobID, uuid, statusUrl, message
run
POST /backends/upgrade/{name}
200, id, status_url
run
POST /api/models/upgrade/{name}
200, id, jobID, status_url, message
run
POST /api/addons/{id}/upgrade
200, the operation status with jobId
run in the payload
The backend routes first refuse a request that cannot do anything, before any
run starts: 404not_installed, or 409no_update or stale (see
Starting an upgrade).
While a run runs, every route answers 409 with code run_active before it
checks anything else (the add-on route in its error type), so no upgrade runs
beside a run. The backend routes take an optional expected_to, in the query
or the JSON body, and answer 409stale when it moved. When the item cannot
start, they answer 409 with the error key of the item as code. When no run
runs and the check of the run does not list the item (it was not checked yet,
or an older listing), or the server keeps no runs, they queue the upgrade
directly, as before.
Each route waits up to 30 seconds for the run to get the operation accepted.
When the wait ends first, the route answers 202 with code pending,
run_id and run, and no job: the run goes on and starts the item later.
Follow it with GET /api/updates/runs/{run_id}. The add-on route answers
202 with the operation status, run and runId in the payload, and no
jobId; the run then runs the operation the route recorded. The run stores
that operation with the item, so a frontend that takes the run over runs the
same record. When the item ends without starting it (cancelled, skipped or
refused), the run drops the record on the owner and the add-on is free for a
new upgrade.
A model upgrade with config_only or choices, and a model retry
(POST /api/models/{name}/upgrade/retry), are always direct: a run makes no
such choice. While a run runs, they are refused with 409run_active too.
The per-node route POST /api/nodes/{id}/backends/upgrade is the one
exception: it upgrades a backend on one node, directly, and does not start a
run or check for one. Use it to repair one node; it does not show in a run or
in its notifications.
From the assistant
The LocalAI Assistant
starts, reads and cancels runs of backends and models:
upgrade_run_start takes items, each {kind, name, expected_to} with kind
gallery, library or model. It refuses add-ons: their upgrade needs your
own browser session.
upgrade_run_status reads a run by id, or the running and recent runs.
upgrade_run_cancel cancels a run, or one item with key.
The assistant asks you to confirm before it starts or cancels a run.
upgrade_backend and upgrade_model still upgrade one item; they start a run
of one item too. When the run did not start the operation within the wait,
they answer with an error that names the run to follow, never a job.
upgrade_backend refuses a backend that is not installed or
has no update before it starts anything, as the REST routes do. While a run
runs, every upgrade from the assistant (also upgrade_model with the actions
config_only and retry, and install_library_backend) is refused with
run_active. POST /backends/library/install is refused the same way.
GPU Acceleration
This page covers how to use LocalAI with GPU acceleration across different hardware vendors. For container image tags and registry details, see Container Images. For memory management with multiple GPU-accelerated models, see VRAM Management.
Automatic Backend Detection
When you install a model from the gallery (or a YAML file), LocalAI intelligently detects the required backend and your system’s capabilities, then downloads the correct version for you. Whether you’re running on a standard CPU, an NVIDIA GPU, an AMD GPU, or an Intel GPU, LocalAI handles it automatically.
For advanced use cases or to override auto-detection, you can use the LOCALAI_FORCE_META_BACKEND_CAPABILITY environment variable. Here are the available options:
default: Forces CPU-only backend. This is the fallback if no specific hardware is detected.
nvidia: Forces backends compiled with CUDA support for NVIDIA GPUs.
amd: Forces backends compiled with ROCm support for AMD GPUs.
intel: Forces backends compiled with SYCL/oneAPI support for Intel GPUs.
Model configuration
Depending on the model architecture and backend used, there might be different ways to enable GPU acceleration. It is required to configure the model you intend to use with a YAML config file. For example, for llama.cpp workloads a configuration file might look like this (where gpu_layers is the number of layers to offload to the GPU):
name:my-model-nameparameters:# Relative to the models pathmodel:llama.cpp-model.ggmlv3.q5_K_M.bincontext_size:1024threads:1f16:true# 16-bit memory and KV cache (does not switch the GPU on)gpu_layers:22# GPU Layers (only used when built with cublas)
For diffusers instead, it might look like this instead:
For llama.cpp models, you can control which GPU layers are offloaded using gpu_layers. When multiple NVIDIA GPUs are present, llama.cpp distributes layers across available devices automatically. You can control GPU visibility with the CUDA_VISIBLE_DEVICES environment variable:
# Use only GPU 0 and GPU 1docker run --gpus all -e CUDA_VISIBLE_DEVICES=0,1 ...
For AMD GPUs, use HIP_VISIBLE_DEVICES instead:
docker run --device /dev/dri --device /dev/kfd -e HIP_VISIBLE_DEVICES=0,1 ...
llama.cpp tensor split (lower latency on several NVIDIA GPUs)
llama.cpp has two useful ways to split one model across GPUs. Set the mode with the split_mode option:
Mode
What it does
Use it when
layer (default)
Each GPU holds a block of whole layers. A token goes through the GPUs one after the other.
The model does not fit on one GPU and you want fast prompt processing or many parallel requests. Works on any interconnect.
tensor
Each layer is split across all GPUs, with its KV cache. The GPUs work on every token together and exchange results after each layer.
You want the fastest token generation for one or few requests. Experimental upstream. Needs a fast GPU interconnect.
Use this configuration as a starting point for tensor:
name:my-model-tensor-splitbackend:llama-cppparameters:model:my-model.gguf# Tensor split needs flash attention. "auto" also turns it on in this mode;# "on" makes a failure explicit.flash_attention:"on"# Unquantized KV cache: the safe choice for tensor split.cache_type_k:f16cache_type_v:f16# Auto-fit does not work with tensor split, so set the context size yourself.context_size:16384# Optional: share of each GPU, in device order. Without it, tensor split# divides the tensors evenly.# tensor_split: "1,1"options:- split_mode:tensor- fit_params:false
What to know before you use it:
Fit the model yourself. llama.cpp’s auto-fit is not implemented for tensor split. With fit_params left on, llama.cpp logs that it cannot fit and loads with the values you gave. If the load runs out of GPU memory, lower context_size first, then parallel, and only then gpu_layers (layers on the CPU are much slower).
Not every architecture supports it. The load fails with LLAMA_SPLIT_MODE_TENSOR not implemented for architecture '...' for many MoE, hybrid and state-space families (for example DeepSeek2, Nemotron-H, Granite-Hybrid, Jamba, Mamba, Minimax-M2) and for some others (OLMo2, Gemma-3n, T5). Use split_mode:layer for those. Upstream keeps the full list in llama.cpp’s multi-GPU guide.
KV cache type. The example uses f16. bf16 and f32 also work. The llama.cpp version that LocalAI ships also accepts quantized KV cache (q8_0, …) with tensor split; check the output quality if you use it.
tensor_split gives the share of each GPU, in the order llama.cpp lists the devices ("3,1" puts 75% on the first GPU). Use it when the GPUs have different memory sizes.
Validate the output. Upstream marks tensor split as experimental. Compare a few answers with split_mode:layer before you rely on it.
NCCL. In tensor mode the GPUs add up partial results after every layer. On NVIDIA GPUs llama.cpp does this with NCCL (NVIDIA Collective Communications Library) when the backend has it, and with its own slower code when it does not. The CUDA 12 and CUDA 13 llama-cpp backends for x86_64, and the CUDA 13 backend for arm64, ship NCCL in the backend’s lib/ directory, so there is nothing to install. The Jetson (CUDA 12 arm64) backend does not ship it, because NVIDIA does not provide NCCL for Jetson. NCCL is only used when a model runs with split_mode:tensor on two or more GPUs. With one GPU, or with layer split, nothing changes.
If NCCL cannot start (for example when CUDA virtual devices are in use), llama.cpp logs a warning and uses its own code. These environment variables of llama.cpp change the behavior. Set them on the LocalAI process or container, and the backend inherits them:
Variable
Effect
GGML_CUDA_ALLREDUCE=internal
Do not use NCCL; use llama.cpp’s own code (it supports exactly two GPUs and falls back further otherwise). Useful to compare speed with and without NCCL.
GGML_CUDA_ALLREDUCE=none
Use the simplest generic fallback. For troubleshooting only.
GGML_CUDA_P2P=1
Let the GPUs copy data directly to each other. Usually faster, but it needs driver support and can crash or corrupt output on some motherboards (for example with IOMMU on). Remove it if you see problems.
NCCL is distributed under the BSD-3-Clause license. Its notice is in licenses/NCCL-LICENSE.txt in the backend directory.
diffusers
For multi-GPU support with diffusers, configure the model with tensor_parallel_size set to the number of GPUs you want to use.
name:stable-diffusion-multigpumodel:stabilityai/stable-diffusion-xl-base-1.0backend:diffusersparameters:tensor_parallel_size:2# Number of GPUs to use
The tensor_parallel_size parameter is set in the gRPC proto configuration (in ModelOptions message, field 55). When this is set to a value greater than 1, the diffusers backend automatically enables device_map="auto" to distribute the model across multiple GPUs.
Tips
For optimal performance, use GPUs of the same type and memory capacity.
Ensure you have sufficient GPU memory across all devices.
When running multiple models concurrently, consider using VRAM Management to automatically unload idle models.
CUDA 12 tags: latest-gpu-nvidia-cuda-12, master-gpu-nvidia-cuda-12, v5.1.0-gpu-nvidia-cuda-12
CUDA 13 tags: latest-gpu-nvidia-cuda-13, master-gpu-nvidia-cuda-13, v5.1.0-gpu-nvidia-cuda-13
In addition to the commands to run LocalAI normally, you need to specify --gpus all to docker, for example:
docker run --rm -ti --gpus all -p 8080:8080 -e DEBUG=true -e MODELS_PATH=/models -e THREADS=1 -v localai-models:/models quay.io/go-skynet/local-ai:latest-gpu-nvidia-cuda-12
If the GPU inferencing is working, you should be able to see something like:
5:22PM DBG Loading model in memory from file: /models/open-llama-7b-q4_0.bin
ggml_init_cublas: found 1 CUDA devices:
Device 0: Tesla T4
llama.cpp: loading model from /models/open-llama-7b-q4_0.bin
llama_model_load_internal: format = ggjt v3 (latest)
llama_model_load_internal: n_vocab = 32000
llama_model_load_internal: n_ctx = 1024
llama_model_load_internal: n_embd = 4096
llama_model_load_internal: n_mult = 256
llama_model_load_internal: n_head = 32
llama_model_load_internal: n_layer = 32
llama_model_load_internal: n_rot = 128
llama_model_load_internal: ftype = 2 (mostly Q4_0)
llama_model_load_internal: n_ff = 11008
llama_model_load_internal: n_parts = 1
llama_model_load_internal: model size = 7B
llama_model_load_internal: ggml ctx size = 0.07 MB
llama_model_load_internal: using CUDA for GPU acceleration
llama_model_load_internal: mem required = 4321.77 MB (+ 1026.00 MB per state)
llama_model_load_internal: allocating batch_size x 1 MB = 512 MB VRAM for the scratch buffer
llama_model_load_internal: offloading 10 repeating layers to GPU
llama_model_load_internal: offloaded 10/35 layers to GPU
llama_model_load_internal: total VRAM used: 1598 MB
...................................................................................................
llama_init_from_file: kv self size = 512.00 MB
ROCM(AMD) acceleration
There are a limited number of tested configurations for ROCm systems. The hipblas images are built on ROCm 10.1, which AMD’s compatibility matrix lists for the Instinct accelerators (gfx908, gfx90a, gfx942, gfx950), the Radeon RDNA2/3/4 cards (gfx1030, gfx1100, gfx1101, gfx1102, gfx1200, gfx1201) and the Ryzen APUs (gfx1103, gfx1150, gfx1151, gfx1152, gfx1153). The Python backends are the exception: they bring their own ROCm 7.x runtime with the PyTorch ROCm wheel (see Limitations).
Due to the nature of ROCm it is best to run all implementations in containers as this limits the number of packages required for installation on host system, compatibility and package versions for dependencies across all variations of OS must be tested independently if desired, please refer to the build documentation.
A host OS and amdgpu kernel driver that the same matrix lists as compatible with ROCm 10.1. The ROCm user space comes with the image; the host only needs the kernel driver (amdgpu-dkms or the in-tree amdgpu of a supported kernel).
Recommendations
Make sure to do not use GPU assigned for compute for desktop rendering.
Ensure at least 100GB of free space on disk hosting container runtime and storing images prior to installation.
AMD Strix Halo / gfx1151 (RDNA 3.5)
AMD Ryzen AI MAX+ (Strix Halo) APUs with an integrated Radeon 8060S (gfx1151 / RDNA 3.5) are
supported with ROCm 7.11.0+, and gfx1151 is an officially supported target of ROCm 10.1, which the
hipblas images use. These systems provide up to 96 GB of unified VRAM accessible by the GPU.
Tested on: Geekom A9 Mega (AMD Ryzen AI MAX+ 395, ROCm 7.11.0, Ubuntu 24.04, kernel 6.14).
Required kernel boot parameters (add to GRUB_CMDLINE_LINUX in /etc/default/grub, then run update-grub):
Tells the HSA runtime to use gfx1151 code objects. Only for images built on a ROCm release that does not know gfx1151 natively; the ROCm 10.1 images do not need it
ROCBLAS_USE_HIPBLASLT
1
Prefer hipBLASLt over rocBLAS for GEMM (required for gfx1151)
HSA_XNACK
1
Enable XNACK (memory-fault retry) for APU unified memory
HSA_ENABLE_SDMA
0
Disable SDMA engine: causes hangs on APU/iGPU configs
Warning: Do not set GGML_CUDA_ENABLE_UNIFIED_MEMORY. The C-level check is
getenv(...) != nullptr, so even =0 activates hipMallocManaged (allocates from
system RAM instead of the 96 GB VRAM pool).
Running LocalAI on gfx1151 (use the standard ROCm/hipblas image; there is only one ROCm image, and it ships with ROCm 10.1 by default):
image:quay.io/go-skynet/local-ai:master-gpu-hipblasenvironment:- ROCBLAS_USE_HIPBLASLT=1- HSA_XNACK=1- HSA_ENABLE_SDMA=0devices:- /dev/dri- /dev/kfdgroup_add:- video
Note: When updating the image, always recreate the container (docker compose up --force-recreate)
rather than just restarting it. docker compose restart preserves the old container environment
and will not pick up updated env vars from the image.
For llama.cpp models, enable flash attention (--flash-attention) for best performance on APU systems. Leave mmap unset in the model configuration: llama.cpp then loads without mmap on devices that do not support it, such as APUs. Set mmap: false to force this on any device.
Limitations
Ongoing verification testing of ROCm compatibility with integrated backends.
Please note the following list of verified backends and devices.
LocalAI hipblas images are built against the following targets: gfx908, gfx90a, gfx942, gfx950, gfx1030, gfx1100, gfx1101, gfx1102, gfx1103, gfx1150, gfx1151, gfx1152, gfx1153, gfx1200, gfx1201
The Python backends (diffusers, transformers, vllm, coqui, …) are built on ROCm 7.2.1 and use the PyTorch ROCm wheels from download.pytorch.org/whl/rocm7.0. Their GPU support is that of the wheel, not the list above; PyTorch does not publish ROCm 10.1 wheels yet. To build a backend for another ROCm release, see Choosing the ROCm release for hipblas builds.
Note: Starting with ROCm 6.4, AMD removed rocBLAS kernel support for older architectures (gfx803, gfx900, gfx906). Since llama.cpp and other backends depend on rocBLAS for matrix operations, these GPUs (e.g. Radeon VII) are no longer supported in pre-built images.
The images and backends do not include other targets, and the container cannot rebuild them at startup. If your device is not one of the above targets, build the backend from source with AMDGPU_TARGETS set to your gfx target. See Build backends. This does not help for architectures that lack rocBLAS kernel support in your ROCm version.
Verified
The devices in the following list have been tested with hipblas images.
Backend
Verified
Devices
ROCm Version
llama.cpp
yes
MI100 (gfx908), MI210/250 (gfx90a)
7.x
llama.cpp
yes
Radeon 8060S / gfx1151 (Strix Halo)
7.11.0
diffusers
yes
MI100 (gfx908), MI210/250 (gfx90a)
7.x
whisper
no
none
-
coqui
no
none
-
transformers
no
none
-
vllm
no
none
-
You can help by expanding this list.
System Prep
Check your GPU LLVM target is compatible with the version of ROCm. This can be found in the LLVM Docs.
Check which ROCm version is compatible with your LLVM target and your chosen OS (pay special attention to supported kernel versions). See the ROCm compatibility matrix.
Install your chosen version of the dkms and rocm (it is recommended that the native package manager be used for this process for any OS as version changes are executed more easily via this method if updates are required). Take care to restart after installing amdgpu-dkms and before installing rocm, for details regarding this see the ROCm installation documentation.
Deploy. Yes it’s that easy.
Setup Example (Docker/containerd)
The following are examples of the ROCm specific configuration elements required.
# For full functionality select a non-'core' image, version locking the image is recommended for debug purposes.image:quay.io/go-skynet/local-ai:master-gpu-hipblasenvironment:- LOCALAI_LOG_LEVEL=debugdevices:# AMD GPU only require the following devices be passed through to the container for offloading to occur.- /dev/dri- /dev/kfd
The same can also be executed as a run for your container runtime
Please ensure to add all other required environment variables, port forwardings, etc to your compose file or run command.
Example (Kubernetes)
For k8s deployments there is an additional step required before deployment, this is the deployment of the ROCm/k8s-device-plugin.
For any k8s environment the documentation provided by AMD from the ROCm project should be successful. It is recommended that if you use rke2 or OpenShift that you deploy the SUSE or RedHat provided version of this resource to ensure compatibility.
After this has been completed the helm chart from go-skynet can be configured and deployed mostly un-edited.
The following are details of the changes that should be made to ensure proper function.
While these details may be configurable in the values.yaml development of this Helm chart is ongoing and is subject to change.
The following details indicate the final state of the localai deployment relevant to GPU function.
apiVersion:apps/v1kind:Deploymentmetadata:name:{NAME}-local-ai...spec:...template:...spec:containers:- env:- name:HIP_VISIBLE_DEVICESvalue:'0'# This variable indicates the devices available to container (0:device1 1:device2 2:device3) etc.# For multiple devices (say device 1 and 3) the value would be equivalent to HIP_VISIBLE_DEVICES="0,2"# Please take note of this when an iGPU is present in host system as compatibility is not assured....resources:limits:amd.com/gpu:'1'requests:amd.com/gpu:'1'
This configuration has been tested on a ‘custom’ cluster managed by SUSE Rancher that was deployed on top of Ubuntu 22.04.4, certification of other configuration is ongoing and compatibility is not guaranteed.
Notes
When installing the ROCm kernel driver on your system ensure that AMD lists it as compatible with the ROCm release of the image (10.1 at time of writing, 7.2.1 for the Python backends).
AMD documentation indicates that this will ensure functionality however your mileage may vary depending on the GPU and distro you are using.
If you encounter an Error 413 on attempting to upload an audio file or image for whisper or llava/bakllava on a k8s deployment, note that the ingress for your deployment may require the annotation nginx.ingress.kubernetes.io/proxy-body-size: "25m" to allow larger uploads. This may be included in future versions of the helm chart.
Intel acceleration (sycl)
Requirements
You need a machine with an Intel GPU and a kernel that drives it, which every current Linux kernel does. You do not need to install any Intel graphics packages: the backends carry their own copy of the Intel graphics driver, so they work on a machine that has none installed, and on a machine whose own driver was built against a newer C library than the backend.
The carried driver comes from Intel’s own package repository, so it knows the cards released up to the point the image was built. If your GPU is newer than that, or you would rather use the driver your distribution ships, point the backend at it:
Set the path to wherever your distribution keeps that file. Whatever you set is used as is, and the carried driver is left alone.
The backends carry only the driver Level Zero uses, which is how llama.cpp reaches an Intel GPU. They do not carry an OpenCL driver, so OpenCL inside a container continues to use whatever the image itself provides.
Container images
To use SYCL, use the images with gpu-intel in the tag, for example v5.1.0-gpu-intel, …
Note also that sycl does have a known issue to hang with mmap: true. You have to disable it in the model configuration if explicitly enabled.
On an integrated Intel GPU, the amount of free graphics memory can only be read if the driver is asked to report it. The backends do that for you by setting ZES_ENABLE_SYSMAN=1. If you set that variable yourself, your value is kept, and setting it to 0 makes the backend read zero free memory, because an integrated GPU has no memory of its own and shares the system’s.
Vulkan acceleration
Requirements
If using nvidia, follow the steps in the CUDA section to configure your docker runtime to allow access to the GPU.
Container images
To use Vulkan, use the images with the vulkan tag, for example v5.1.0-gpu-vulkan.
Example
To run LocalAI with Docker and Vulkan, you can use the following command as an example:
docker run -p 8080:8080 -e DEBUG=true -v localai-models:/models localai/localai:latest-gpu-vulkan
Notes
In addition to the commands to run LocalAI normally, you need to specify additional flags to pass the GPU hardware to the container.
These flags are the same as the sections above, depending on the hardware, for nvidia, AMD or Intel.
If you have mixed hardware, you can pass flags for multiple GPUs, for example:
LocalAI supports NVIDIA ARM64 devices including Jetson Nano, Jetson Xavier NX, Jetson AGX Orin, and DGX Spark. Pre-built container images are available for both CUDA 12 and CUDA 13.
For detailed setup instructions, platform compatibility, and build commands, see the dedicated Running on Nvidia ARM64 page.
Quick start
# Jetson AGX Orin (CUDA 12)docker run -e DEBUG=true -p 8080:8080 -v localai-models:/models \
--runtime nvidia --gpus all \
quay.io/go-skynet/local-ai:latest-nvidia-l4t-arm64
# DGX Spark (CUDA 13)docker run -e DEBUG=true -p 8080:8080 -v localai-models:/models \
--runtime nvidia --gpus all \
quay.io/go-skynet/local-ai:latest-nvidia-l4t-arm64-cuda-13
GPU monitoring
Use these vendor-specific tools to verify that LocalAI is using your GPU and to monitor resource usage during inference.
NVIDIA
# Real-time GPU utilization, memory, temperaturenvidia-smi
# Continuous monitoring (updates every 1 second)nvidia-smi --loop=1# Inside a containerdocker run --rm --gpus all nvidia/cuda:12.8.0-base-ubuntu24.04 nvidia-smi
Look for non-zero GPU-Util and Memory-Usage values while running inference to confirm GPU acceleration is active.
AMD
# ROCm System Management Interfacerocm-smi
# Continuous monitoringwatch -n1 rocm-smi
# Show detailed GPU inforocm-smi --showallinfo
LocalAI reads AMD GPU memory for /api/resources and the model fit check from rocm-smi. ROCm 7 and later images no longer ship rocm-smi; there LocalAI reads the same figures from the amdgpu driver in sysfs (/sys/class/drm/card*/device/mem_info_*). On APUs with a small VRAM carve-out and a large GTT pool (for example Strix Halo), the GTT pool counts toward GPU memory in both cases.
GET /api/resources also returns memory: how the GPU of the server reaches its memory (kind is unified, discrete or system for no GPU), the GPU it was read from (device), and the memory a model can use (total: the smallest discrete GPU, else the system memory). Such an APU counts as unified memory. The quick setup of the model editor uses it to pick its values; see Engine settings.
Intel
# Intel GPU top (part of intel-gpu-tools)sudo intel_gpu_top
# List available Intel GPUssycl-ls
Troubleshooting
GPU not detected in container
NVIDIA: Ensure nvidia-container-toolkit is installed and the Docker runtime is configured. Test with docker run --rm --gpus all nvidia/cuda:12.8.0-base-ubuntu24.04 nvidia-smi.
AMD: Ensure /dev/dri and /dev/kfd are passed to the container and that amdgpu-dkms is installed on the host.
Intel: Ensure /dev/dri is passed to the container. No Intel graphics packages are needed on the host, since the backends bring their own driver. If the GPU is a recent model that the carried driver does not know, point the backend at the host’s own driver as shown in Intel acceleration.
Model loads on CPU instead of GPU
Check that gpu_layers is set in your model YAML configuration. Setting it to a high number (e.g., 999) offloads all possible layers to GPU.
Verify you are using a GPU-enabled container image (tags containing gpu-nvidia-cuda, gpu-hipblas, gpu-intel, etc.).
Enable DEBUG=true and check the logs for GPU initialization messages.
Out of memory (OOM) errors
Reduce gpu_layers to offload fewer layers, keeping some on CPU.
Lower context_size to reduce VRAM usage.
Use VRAM Management to automatically unload idle models when running multiple models.
Use quantized models (e.g., Q4_K_M) which require less memory than full-precision models.
ROCm: unsupported GPU target
The prebuilt hipblas images and backends support only the targets listed in Limitations. The container cannot rebuild them for another target: LocalAI has no REBUILD or GPU_TARGETS setting. To use another target, build the backend from source with AMDGPU_TARGETS set to your gfx target. See Build backends.
Intel SYCL: model hangs
SYCL has a known issue where models hang when mmap: true is set. Ensure mmap is disabled in the model configuration:
mmap:false
Slow performance or unexpected CPU fallback
f16: true in the model YAML sets 16-bit memory and KV cache for that model. It does not turn GPU use on. GPU use comes from the backend build and gpu_layers.
Set threads: 1 when using full GPU offloading to avoid CPU thread contention.
Verify the correct BUILD_TYPE matches your hardware (e.g., cublas for NVIDIA, hipblas for AMD).
Engine runtime settings
An inference engine has its own runtime settings: the context size, the GPU
offload, the KV cache type, and many more. LocalAI keeps them in the model’s
YAML file, as YAML keys or as entries of the options list. The model editor
has a Runtime tuning section that shows the settings of the model’s engine
as fields, so you do not have to know which key or option holds each one.
This page explains how the settings are described, how an engine registers,
and how to add an engine. Then it lists the settings of llama.cpp, the first
engine.
How it works
Each engine is one description in Go, in the package pkg/enginesettings. The
description is the only place that knows the settings of the engine. The model
editor, the API and the LocalAI Assistant read it, so they always agree.
An engine description has these parts:
Part
What it is
ID and name
A stable id, for example llama-cpp, used in the API routes, and a display name, for example llama.cpp.
Backends
The model backend names the engine serves: exact names, families (a name and its hardware builds, such as cuda12-llama-cpp), names to exclude, and whether a model with no backend uses this engine.
Flag table
One row per setting: a key, where the value goes (a YAML key or an options entry), the option name and its aliases, the command-line spellings, the type, the allowed values, the limits, the default, a doc line and the editor group.
Groups
The editor sections, in the order the editor draws them.
Combined controls
Optional. One control that writes several settings, such as a load mode that writes mmap, mmlock and direct_io.
Presets
Optional. Whole-setup starting points. A preset marked as a profile is one of a set of exclusive setups over the same keys; the editor shows the profiles of each Set as one choice and reads the current one back from the file. A profile can give other values per memory kind (Memory: unified, discrete, system), with a floor on the memory size and Tight values for when the estimate does not fit. A null value in a preset unsets the key.
Memory
Optional. What each memory kind means, the kind to assume when the host is unknown, the share of memory an estimate may take, and advice for a control per kind (for example the load mode on unified memory).
Estimate
Optional. Maps the fields of POST /api/models/vram-estimate (context_size, gpu_layers, cache_type_k, cache_type_v, batch, ubatch) to flag keys, so the editor can show what a setup costs in memory.
Capabilities
Optional features. command-line: the engine reads a pasted command and writes the command of a config. tensor-placement: the engine builds and reads an options entry that keeps MoE expert tensors on the CPU. drafting: the engine describes its speculative decoding as a few modes, each with the drafting kinds it reads back, the fields it shows and the values it writes.
The editor draws the fields, groups, combined controls and presets from the
schema of the engine. It shows the command preview and the paste box only for
an engine with command-line, the placement control only for an engine
with tensor-placement, and the Drafting section only for an engine with
drafting. The editor has no code for a specific engine.
The editor finds the engine of a model from its backend key, with
GET /api/engines?backend=<name>. A model whose backend no engine serves has
no Runtime tuning section. You can still set every option in the YAML tab.
Add an engine
To add the runtime settings of another engine:
Create a package under pkg/enginesettings/, for example
pkg/enginesettings/myengine, with a function Engine() that returns an
*enginesettings.Engine.
Set the id, the display name and the Backends match. Use the backend names
of the gallery.
Write the flag table. Each row needs a unique key, a target (config with a
YAML path, or option with an option name), a type, a doc line and a group
from the Groups list. Add the command-line spellings if the engine has a
command line.
Optional: add combined controls, presets and ReservedOptions (option names
that another part of LocalAI writes).
Optional: set Command for the command-line capability. Give the binary
name, the flags that LocalAI sets itself (Ignored), and handlers for flags
that do not map to one key (Special).
Optional: set Placement for the tensor-placement capability.
Register the engine in pkg/enginesettings/builtin. The registry validates
the description at start-up, so a broken table fails early.
Write Ginkgo tests for the table: parse and build round trips, the backend
match, and the presets.
Add translations for new group, field, preset and profile labels under
engineSettings in the modelEditor namespace of the React UI (profiles
go under engineSettings.profiles, with an optional note, bestFor,
short for the label of the choice, and memory.<kind> for the note of a
memory kind; memory kinds and advice go under engineSettings.memory). Without a
translation, the editor shows the name or the English text of the schema.
Document the settings in a section of this page.
Other engines, such as vLLM, can be added this way. Today only llama.cpp is
registered.
llama.cpp
The engine id is llama-cpp. It serves the llama-cpp backend, every
hardware build of it, and models with no backend. It has the command-line
and tensor-placement capabilities. A model that uses it runs llama-server
settings that you write in its YAML file.
Some settings are read by the llama.cpp backend of LocalAI and have no
llama-server flag. The flag table marks them as LocalAI only: they have a
field, but no command-line spelling, and the command preview leaves them out
with a warning.
Setting
Model YAML
Paged serving
options: [paged_kv:true] (also read as paged_serving)
Pause on a full cache
options: [paged_preempt:false]
Prefill budget
options: [prefill_budget:N] or prefill_budget:auto (also read as max_prefill_tokens)
KV pool tokens
options: [kv_pool_tokens:N]
Output reserve
options: [kv_output_reserve:N] (default 256)
GPU sampling
options: [backend_sampling:auto] or options: [backend_sampling:on]
options: [grammar_engine:auto], gbnf or llguidance (default auto; llguidance also covers the tool-call grammars of the chat template)
Recurrent state snapshots
options: [n_rs_seq:N] (also read as rs_seq)
A backend build without these features ignores the options.
GPU sampling is one choice in the Speed group:
Choice
Model YAML
What it does
Off (default)
no entry
Tokens are sampled on the CPU.
Auto
backend_sampling:auto
Use GPU sampling when the model runs on a GPU with several parallel requests and the request does not need grammar or logprobs.
On
backend_sampling:on
Sample tokens on the GPU. Faster with many parallel requests. Turned off automatically for requests that use a grammar, a reasoning budget or logprobs.
Any other flag works too. Write it in options with a leading dash and put a
colon between the flag and its value, for example --rope-freq-base:10000.
LocalAI passes the entry to the llama-server parser as it is.
Sampling values go in parameters, not in raw flags. A request that sets its
own temperature, top_p, top_k or min_p replaces the value of a raw flag.
Load mode
--load-mode is a combination of three settings. LocalAI derives it:
--load-mode
Model YAML
none
mmap: false (with no mmlock and no direct_io)
mmap
mmap: true
mlock
mmap: false and mmlock: true
mmap_mlock
mmap: true and mmlock: true
direct_io
options: [direct_io:true]
--load-mode auto has no LocalAI equivalent. The paste flow leaves the keys
unset and shows a warning.
Open a model in the model editor (Models, then Edit on the model). When
the model’s backend is llama-cpp (or a build of it, or no backend at all),
the Interactive tab has a Runtime tuning section with the badge
llama.cpp.
Quick setup. Two choices at the top of the section: the Batch
(Balanced, Long prompts or Custom) and the Concurrency (Default, 8,
16 or 32+ streams). The chosen setup has one line that says what it is for.
Each other setup shows how much more (+) or less (−) memory it needs than
the current values; a setup with about the same memory shows no figure. The
figure is an estimate of the KV cache and the compute buffers, beside the
weights, from the model file. Memory now shows the current KV cache and
compute buffer sizes. Compare setups opens a table with what each setup
changes and who it suits. Nothing changes until you pick a setup.
Memory type. The values of a setup depend on how the GPU reaches its
memory. LocalAI detects it and says so in one line next to the Quick setup
title, and you can pick another type in the list next to it (the browser
keeps your choice):
Unified memory: the GPU shares the system memory. DGX Spark (GB10),
Jetson and Thor, Apple silicon, AMD APUs such as Strix Halo, and Intel
integrated GPUs. More slots fit. The prompt cache and the context
checkpoints use the same memory as the model, so they are kept small.
Discrete GPU: the GPU has its own memory. The slots are capped by the
VRAM estimate, 32 streams use an 8-bit KV cache, and the prompt cache stays
in system memory at its default size.
No GPU: the model runs on the CPU. The caches are kept small, and
32 streams are not offered.
LocalAI reads the type from the GPU it detects: the name (GB10, Thor, Orin,
Radeon 8060S, an Intel iGPU and so on), the driver (an AMD APU whose GTT
pool is much larger than its memory carve-out), or an L4T install. A discrete
GPU wins over an integrated one. In distributed mode the type is the one of
the server you are connected to, not of the worker nodes, so pick the type of
the nodes in the list. When nothing is detected, the discrete rules apply.
Setup
Unified memory
Discrete GPU
No GPU
Balanced
Removes parameters.batch and ubatch.
Same.
Same.
Long prompts
parameters.batch: 2048, ubatch:2048.
parameters.batch: 2048, ubatch:1024 (the compute buffer must fit one card).
parameters.batch: 2048, ubatch:512.
Default
Removes parallel, paged_kv, paged_preempt, and what a stream setup wrote.
Same.
Same.
8 streams
parallel:8, paged_kv:true, paged_preempt:true, cache_ram:4096. From 16 GB.
parallel:8, paged_kv:true, paged_preempt:true. From 8 GB.
As unified memory. From 16 GB.
16 streams
8 streams with parallel:16, backend_sampling:on, spec_type:none and no draft model. From 16 GB.
Same, without the cache bounds. From 8 GB.
As unified memory, without GPU sampling. From 16 GB.
32+ streams
parallel:32, backend_sampling:on, drafting off, the cache bounds, f16 KV cache; cache_type_k/cache_type_v: q8_0 and flash attention only when the f16 cache does not fit. From 16 GB.
parallel:32, backend_sampling:on, drafting off, q8_0 K and V cache, flash attention on. From 8 GB.
Not offered.
A stream setup is also refused when its estimate needs more than 90% of the
memory and more than the current values. The slots share one KV cache, so
more streams need about the same memory; each stream gets a smaller part of
the context, and each row says how many tokens. The slot floors and the cache
bounds are conservative placeholders until the measurements of paged serving
on more hardware are in.
On unified memory, a load mode that maps the model (mmap, mmap + mlock)
shows a warning with a button to use Default (auto): llama.cpp then skips
mmap on CUDA, ROCm and Vulkan integrated GPUs, where a mapped model is held
twice while it is copied to the GPU.
Batch and concurrency setups touch different settings, so one does not undo
the other. Within one choice, a switch removes only what the previous setup
wrote: a flash attention value that you set stays. The choice shows the
setup the file holds. A file with any other value of these settings shows
Custom. Custom changes nothing: set the fields yourself. The section
lists the settings a setup changed, with Undo.
Fields. Every option the llama.cpp backend of LocalAI reads has a field,
in the groups Memory, Speed, Concurrent serving, Sampling defaults and Chat
template, and in the Drafting section below. Rarely used or risky options
are in a group that starts closed, Advanced llama.cpp options (for example
context_shift, cont_batching and kv_unified, which turn paged serving
off). A file that uses another name of an option (an alias such as
unified_kv or max_prefill_tokens) shows in the field of that option; an
edit writes the main name in its place. A test reads the option names that
backend/cpp/llama-cpp/grpc-server.cpp parses and fails when one has no
field, so a new option is not missed. The full list with defaults is in
Model configuration. Each field shows the first
sentence of the server’s description; More shows the rest. Turn on Show llama.cpp flags in the section head to see the
llama-server flag of each field; the browser keeps the choice. An empty field, or Default, keeps the
setting out of the file. A value that does not fit the type or the range is
marked, and Save stays off until you correct it.
Start from a setup. Three presets fill several fields at once: Big MoE
on a small GPU (all layers on the GPU, experts on the CPU, 8-bit KV cache),
Max context (128K context, flash attention, 8-bit KV cache) and Low
VRAM (4K context, 4-bit KV cache, a small micro-batch). The section lists
each setting it changed, with Undo. A setting you edit after the preset
keeps your value when you undo.
Command preview. The llama-server command that matches the form, with a
Copy button. It follows your edits.
Advanced options. The other entries of options, one per row. An entry
that a field above sets is refused here, so no setting is written twice.
The section edits the same file as the YAML tab. Nothing is written until you
press Save, and a YAML save shows in the section.
Drafting
Drafting lets a fast guesser propose the next tokens, and the model checks
them all in one step. When the guesses are right, answers come faster. The
output is the same as without drafting. The Drafting section of Runtime
tuning sets it up with one choice, so you do not need the llama.cpp flags.
Mode
What it writes
When to use it
Off (default)
Removes spec_type, draft_model and the drafting fields. For a model with an MTP head, it writes spec_type:none.
Normal chat.
N-gram
options: [spec_type:ngram-mod]
Output that repeats its input, such as code edits or long quotes. It needs no extra model and no extra memory. On normal chat it gains little and can cost a few percent.
Draft model
draft_model: <file of the model you pick>. llama.cpp reads the kind from the draft file.
A small model of the same family, for example a 0.6B or 1B model for a large model of the same series. It loads beside the model and uses its own memory.
Only for a model whose file has a multi-token prediction head. LocalAI turns MTP on for such a model when the file sets no spec_type, and the section shows it as on by default.
Each mode shows only the fields that matter for it: the fewest and most draft
tokens (spec_ngram_mod_n_min and spec_ngram_mod_n_max for N-gram,
spec_n_min and spec_n_max for a draft model), the acceptance threshold
(spec_p_min) and Pause drafting above N streams (spec_max_streams, 0
never pauses). The other drafting options are under More drafting options.
For Draft model, pick one of the installed models that llama.cpp runs.
Models of the same family as this one come first. The section then shows:
Compatibility. The vocabulary sizes of both models. llama.cpp refuses a
draft whose vocabulary differs by more than 128 tokens, so the model would
not load.
Memory. The memory the draft model adds, from the VRAM estimate of the
draft model at the context size of this model: its weights and its KV cache.
A file with a spec_type that no mode covers (for example two kinds) is kept
as it is, with a note, until you pick a mode. The old option names
(draft_max, draft_min, draft_p_min, speculative_type) show in the same
fields.
spec_max_streams is read by builds with paged serving. Other builds ignore
it.
Paste a command
In the Runtime tuning section, paste the command in Paste a llama-server
command and press Fill the form. LocalAI reads the text and writes what it
found into the fields. The section lists the settings that changed, with
Undo.
The text is only split into words, with the quoting rules of a POSIX shell.
Nothing is run, and $(...), backticks and ; are plain text.
Flags with a first-class key go to that key.
Flags without one stay in options as raw entries. They are also listed as
unmapped, so you see what was not turned into a field. Remove drops one.
Flags that LocalAI sets itself (--host, --port, --api-key, -hf and
similar) are listed as ignored, with the reason, and are not kept.
A value that does not fit (for example -c abc) is listed as unmapped with the
reason and is not kept. Keep as raw option adds it to options as written.
A model path in -m maps to parameters.model. LocalAI expects a file
name inside the models directory, so the editor warns about a path. The editor
keeps the model’s own file and shows the one of the command with Use this
file.
The editor also shows a live preview of the command that matches the form.
The preview is text for you to read. It is never run.
Tensor placement
Placement is opt-in. LocalAI never adds an -ot entry for you, and a model
without one loads as before.
On a model with mixture-of-experts layers (ffn_*_exps tensors), you can keep
the large expert tensors in system memory and the rest on the GPU. The
Tensor placement group of the editor offers three presets, a Custom
regex box for any other pattern, and shows the value it writes:
Preset
Result
Experts on the CPU, all layers
-ot:\.ffn_.*_exps.*=CPU
Experts on the CPU for some layers, for example 0-6,18-23
-ot:blk\.([0-6]|1[89]|2[0-3])\.ffn_.*_exps.*=CPU
First N layers fully on the GPU, experts of the rest on the CPU
the pattern matches layer N and higher
Ranges are sorted and merged, and layers run from 0 to 999. If you give the
number of layers, the last preset writes a range, such as 8-23. The generated
patterns contain no comma, because llama-server splits the value on commas.
When you open a model, the editor shows the picker for a pattern that LocalAI
generated. Any other pattern is shown as raw text.
API
These routes need an administrator. The LocalAI Assistant has the same
operations as the parse_engine_command and preview_engine_command tools.
Route
Purpose
GET /api/engines
The registered engines: id, name, binary, the backend names each serves, and the capabilities. With ?backend=<name>, only the engine that serves that backend. An empty name is a model with no backend.
GET /api/engines/{engine}/settings-schema
The schema of one engine: the flag table (key, target, YAML path, option name and aliases, CLI spellings, type, allowed values, limits, default, doc line, group, and localai_only for an option with no command-line flag), the groups, the combined controls, the presets (with profile: true for a quick setup, set: concurrency and streams for a concurrency setup, and memory for the values per memory kind), memory (the memory kinds, the fallback kind, the fit fraction and the advice per control), the reserved options, the estimate map, the capabilities, and drafting for an engine with that capability (the kind and model keys, the off kind, the streams option and the modes).
POST /api/engines/{engine}/parse-command
Needs command-line. Body {"command": "..."}. Returns fields, options, unmapped and warnings, plus placements for an engine with tensor-placement.
POST /api/engines/{engine}/command-preview
Needs command-line. Body {"config": {...}} with model YAML keys. Returns {"command": "...", "warnings": []}.
POST /api/engines/{engine}/placement
Needs tensor-placement. Body {"placement": {...}, "layers": "0-6,18-23"} returns the options entry. Body {"option": "-ot:..."} returns its structured form, or raw: true.
An unknown engine returns status 404. An operation of a capability that the
engine does not have returns status 400.
A command longer than 16 KiB is refused with status 413. A command with an
unclosed quote is refused with status 400.
VRAM and Memory Management
When running multiple models in LocalAI, especially on systems with limited GPU memory (VRAM), you may encounter situations where loading a new model fails because there isn’t enough available VRAM. LocalAI provides several mechanisms to automatically manage model memory allocation and prevent VRAM exhaustion:
Max Active Backends (LRU Eviction): Limit the number of loaded models, evicting the least recently used when the limit is reached
Concurrency Groups: Per-model anti-affinity rules that prevent specific models from coexisting on the same node
Watchdog Mechanisms: Automatically unload idle or stuck models based on configurable timeouts
The Problem
By default, LocalAI keeps models loaded in memory once they’re first used. This means:
If you load a large model that uses most of your VRAM, subsequent requests for other models may fail
Models remain in memory even when not actively being used
There’s no automatic mechanism to unload models to make room for new ones, unless done manually via the web interface
This is a common issue when working with GPU-accelerated models, as VRAM is typically more limited than system RAM. For more context, see issues #6068, #7269, and #5352.
Solution 1: Max Active Backends (LRU Eviction)
LocalAI supports limiting the maximum number of active backends (loaded models) using LRU (Least Recently Used) eviction. When the limit is reached and a new model needs to be loaded, the least recently used model is automatically unloaded to make room.
Configuration
Set the maximum number of active backends using CLI flags or environment variables:
# Allow up to 3 models loaded simultaneously./local-ai --max-active-backends=3# Using environment variablesLOCALAI_MAX_ACTIVE_BACKENDS=3 ./local-ai
MAX_ACTIVE_BACKENDS=3 ./local-ai
Setting the limit to 1 is equivalent to single active backend mode (see below). Setting to 0 disables the limit (unlimited backends).
Use cases
Systems with limited VRAM that can handle a few models simultaneously
Multi-model deployments where you want to keep frequently-used models loaded
Balancing between memory usage and model reload times
Production environments requiring predictable memory consumption
How it works
When a model is requested, its “last used” timestamp is updated
When a new model needs to be loaded and the limit is reached, LocalAI identifies the least recently used model(s)
The LRU model(s) are automatically unloaded to make room for the new model
Concurrent requests for loading different models are handled safely - the system accounts for models currently being loaded when calculating evictions
Eviction Behavior with Active Requests
By default, LocalAI will skip evicting models that have active API calls to prevent interrupting ongoing requests. This means:
If all models are busy (have active requests), eviction will be skipped and the system will wait for models to become idle
The loading request will retry eviction with configurable retry settings
This ensures data integrity and prevents request failures
You can configure this behavior via WebUI or using the following settings:
Force Eviction When Busy
To allow evicting models even when they have active API calls (not recommended for production):
# Via CLI./local-ai --force-eviction-when-busy
# Via environment variableLOCALAI_FORCE_EVICTION_WHEN_BUSY=true ./local-ai
Warning: Enabling force eviction can interrupt active requests and cause errors. Only use this if you understand the implications.
LRU Eviction Retry Settings
When models are busy and cannot be evicted, LocalAI will retry eviction with configurable settings:
# Configure maximum retries (default: 30)./local-ai --lru-eviction-max-retries=50# Configure retry interval (default: 1s)./local-ai --lru-eviction-retry-interval=2s
# Using environment variablesLOCALAI_LRU_EVICTION_MAX_RETRIES=50\
LOCALAI_LRU_EVICTION_RETRY_INTERVAL=2s \
./local-ai
These settings control how long the system will wait for busy models to become idle before giving up. The retry mechanism allows busy models to complete their requests before being evicted, preventing request failures.
Example
# Allow 2 active backendsLOCALAI_MAX_ACTIVE_BACKENDS=2 ./local-ai
# First request - model-a is loaded (1 active)curl http://localhost:8080/v1/chat/completions -d '{"model": "model-a", ...}'# Second request - model-b is loaded (2 active, at limit)curl http://localhost:8080/v1/chat/completions -d '{"model": "model-b", ...}'# Third request - model-a is evicted (LRU), model-c is loadedcurl http://localhost:8080/v1/chat/completions -d '{"model": "model-c", ...}'# Request for model-b updates its "last used" timecurl http://localhost:8080/v1/chat/completions -d '{"model": "model-b", ...}'
Single Active Backend Mode
The simplest approach is to ensure only one model is loaded at a time. This is now implemented as --max-active-backends=1. When a new model is requested, LocalAI will automatically unload the currently active model before loading the new one.
# These are equivalent:./local-ai --max-active-backends=1./local-ai --single-active-backend
# Using environment variablesLOCALAI_MAX_ACTIVE_BACKENDS=1 ./local-ai
LOCALAI_SINGLE_ACTIVE_BACKEND=true ./local-ai
Note: The --single-active-backend flag is deprecated but still supported for backward compatibility. It is recommended to use --max-active-backends=1 instead.
Single backend use cases
Single GPU systems with very limited VRAM
When you only need one model active at a time
Simple deployments where model switching is acceptable
Solution 1b: Concurrency Groups (per-model anti-affinity)
--max-active-backends is a global count - three loaded models is fine, but it
doesn’t know that two of them are 120B and shouldn’t share a GPU.
Concurrency groups give per-model rules: any two models that share a group
name are mutually exclusive on the same node. Loading one evicts the others.
Models with no groups behave exactly as before.
Request llama-120b-b → llama-120b-a is evicted (shared group
vram-heavy); zed-predict stays loaded.
A model can declare multiple groups; two models conflict if they share any
group name. Group names are arbitrary strings - pick names that make sense for
your hardware (vram-heavy, gpu-1, large-context, …).
Interaction with other knobs
--max-active-backends: groups are checked before the LRU cap. Group
evictions may already make room; LRU then enforces the global count.
pinned: true: a pinned model is never evicted, including by a group
conflict. The new request is loaded with a warning logged - pinning two
models in the same group is a configuration mismatch.
--force-eviction-when-busy: same retry semantics as LRU. A busy
conflict is skipped and retried (--lru-eviction-max-retries,
--lru-eviction-retry-interval); after retries exhaust, the load proceeds
with a warning.
Distributed mode
concurrency_groups is enforced per node, not cluster-wide - VRAM is a
node-local resource, so two heavy models on different nodes is fine. The
distributed scheduler additionally uses the rule as a placement hint: when
choosing where to load a new model, it prefers nodes that don’t already host a
same-group model, falling back to eviction only if every candidate has a
conflict.
pinned: true also holds cluster-wide: the distributed scheduler’s LRU
eviction (used to free capacity for a new model) and the replica reconciler’s
idle scale-down both exclude pinned models, matching what the per-node
watchdog already guarantees. Deliberate teardown - an admin unload, deleting
the model, draining a node - still applies to pinned models. Note that if
every idle model on the cluster is pinned, a new model’s load waits for
capacity instead of evicting one.
concurrency_groups composes with NodeSelector (which decides which
nodes a model is eligible for) - the two filters apply in sequence. Use
NodeSelector to target hardware classes; use concurrency_groups to keep
specific models from co-residing on whichever node hosts them.
Solution 2: Watchdog Mechanisms
For more flexible memory management, LocalAI provides watchdog mechanisms that automatically unload models based on their activity state. This allows multiple models to be loaded simultaneously, but automatically frees memory when models become inactive or stuck.
Note: Watchdog settings can be configured via the Runtime Settings web interface, which allows you to adjust settings without restarting the application.
Idle Watchdog
The idle watchdog monitors models that haven’t been used for a specified period and automatically unloads them to free VRAM.
Via web UI: Navigate to Settings → Watchdog Settings and enable “Watchdog Idle Enabled” with your desired timeout.
Busy Watchdog
The busy watchdog monitors models that have been processing requests for an unusually long time and terminates them if they exceed a threshold. This is useful for detecting and recovering from stuck or hung backends.
For parallel backends, the timeout is measured from the start of the oldest
request that is still in flight. Sustained overlapping traffic does not by
itself make a backend stale: when the oldest request completes, the watchdog
continues from the start time of the next-oldest request.
Via web UI: Navigate to Settings → Watchdog Settings and enable “Watchdog Busy Enabled” with your desired timeout.
Backend shutdown behavior
Administrative and API-triggered model shutdown is graceful by default. It
waits up to 30 seconds for in-flight requests to finish and returns a
model is still busy error if the deadline expires. This bounded wait keeps a
busy backend from blocking lifecycle operations for other models.
Set LOCALAI_FORCE_BACKEND_SHUTDOWN=true when starting LocalAI to escalate a
timed-out graceful shutdown to forced process termination. Forced shutdown can
interrupt active requests and skips the backend Free() RPC; terminating the
process releases its resources instead.
Combined Configuration
You can enable both watchdogs simultaneously for comprehensive memory management:
Timeouts can be specified using Go’s duration format:
15m - 15 minutes
1h - 1 hour
30s - 30 seconds
2h30m - 2 hours and 30 minutes
Combining LRU and Watchdog
You can combine Max Active Backends (LRU eviction) with the watchdog mechanisms for comprehensive memory management:
# Allow up to 3 active backends with idle watchdogLOCALAI_MAX_ACTIVE_BACKENDS=3\
LOCALAI_WATCHDOG_IDLE=true\
LOCALAI_WATCHDOG_IDLE_TIMEOUT=15m \
./local-ai
Ensures no more than 3 models are loaded at once (LRU eviction kicks in when exceeded)
Automatically unloads any model that hasn’t been used for 15 minutes
Provides both hard limits and time-based cleanup
Example with Retry Settings
You can also configure retry behavior when models are busy:
# Allow up to 2 active backends with custom retry settingsLOCALAI_MAX_ACTIVE_BACKENDS=2\
LOCALAI_LRU_EVICTION_MAX_RETRIES=50\
LOCALAI_LRU_EVICTION_RETRY_INTERVAL=2s \
./local-ai
Will retry eviction up to 50 times if models are busy
Waits 2 seconds between retry attempts
Ensures busy models have time to complete their requests before eviction
VRAM Budget (Allocation Ceiling)
By default LocalAI treats all detected GPU memory as available for model allocation. On a shared machine (a desktop you also game on, a box that runs other GPU workloads, or a multi-tenant server) you often want to reserve some headroom and let LocalAI use only part of the card. The VRAM budget sets a hard ceiling on how much VRAM LocalAI will consider allocatable.
Configuration
Set the budget with a CLI flag or environment variable:
# Percentage of detected VRAM./local-ai --vram-budget=80%
# Absolute amount (GB, GiB, MB, or raw bytes)./local-ai --vram-budget=12GB
# Using environment variablesLOCALAI_VRAM_BUDGET=80% ./local-ai
LOCALAI_VRAM_BUDGET=12GB ./local-ai
Accepted formats:
A percentage such as 80% (or the decimal 0.8).
An absolute amount such as 12GB, 12GiB, 12000MB, or a raw byte count.
Leaving it empty or unset (the default) uses all detected VRAM, which is the historical behavior.
Semantics
The budget is a hard ceiling, never a floor:
Everywhere LocalAI reads VRAM to decide model allocation (hardware defaults for batch size and parallelism, context auto-fit, GGUF fit warnings, and the watchdog), it uses min(detected VRAM, budget).
The budget can only lower usable VRAM, never raise it above what the hardware physically has. An absolute value larger than physical VRAM is clamped to physical.
A percentage above 100% is rejected as invalid.
Overriding the detected total
The budget is a share of the VRAM LocalAI detects. When detection itself is wrong, set the total with LOCALAI_VRAM_TOTAL / --vram-total instead:
# Two 20 GB cardsLOCALAI_VRAM_TOTAL=40GB ./local-ai
It takes an absolute amount only (40GB, 48GiB, 40000MB, or raw bytes), replaces the detected total everywhere LocalAI reads VRAM, and works the same for local-ai run and local-ai worker. A budget then applies to this total. Per-GPU decisions (batch size, parallel slots) split the total evenly over the GPUs LocalAI finds. A value that does not parse is logged and ignored.
Editing from the UI
The budget is exposed in the Settings page under the Performance section as VRAM Budget, so you can change it without editing flags or restarting from scratch. It is live-editable and persists to the runtime settings.
Distributed mode
The same LOCALAI_VRAM_BUDGET / --vram-budget applies to distributed worker nodes (local-ai worker ...), where it caps the VRAM the scheduler will use for per-node placement. Admins can also set a per-node budget live from the node UI (or the admin API); see Distributed Mode.
Limitations and Considerations
VRAM Usage Estimation
LocalAI cannot reliably estimate VRAM usage of new models to load across different backends (llama.cpp, vLLM, diffusers, etc.) because:
Different backends report memory usage differently
VRAM requirements vary based on model architecture, quantization, and configuration
Some backends may not expose memory usage information before loading the model
Manual Management
If automatic management doesn’t meet your needs, you can manually stop models using the LocalAI management API:
To stop all models, you’ll need to call the endpoint for each loaded model individually, or use the web UI to stop all models at once.
Conversely, you can pre-load a model into memory ahead of its first request with POST /backend/load (the inverse of shutdown) - see Backend Monitor.
Best Practices
Monitor VRAM usage: Use nvidia-smi (for NVIDIA GPUs) or similar tools to monitor actual VRAM usage
Set an appropriate backend limit: For single-GPU systems, --max-active-backends=1 is often the simplest solution. For systems with more VRAM, you can increase the limit to keep more models loaded
Combine LRU with watchdog: Use --max-active-backends to limit the number of loaded models, and enable idle watchdog to unload models that haven’t been used recently
Tune watchdog timeouts: Adjust timeouts based on your usage patterns - shorter timeouts free memory faster but may cause more frequent reloads
Consider model size: Ensure your VRAM can accommodate at least one of your largest models
Use quantization: Smaller quantized models use less VRAM and allow more flexibility
VRAM estimates in the model gallery
The model gallery shows an estimated VRAM footprint per model, at several
context lengths, so you can see whether something will run before installing it.
Working that out means reading the metadata of a model’s weight files, which for
a model you have not installed is a request to the host that serves them. It
takes a second or two the first time, and the gallery needs one per row. LocalAI
caches successful remote probes for 24 hours under the LocalAI data directory,
and warms that cache in the background at startup so the gallery reads instantly
rather than filling in its own numbers while you watch. The on-disk cache is
reused after a restart, so frequent restarts do not download the same metadata
again. Local model files are always inspected directly. The cache keeps at most
4,096 entries and removes the oldest entries when it reaches that limit.
Failed probes, including canceled or timed-out requests, are not cached in
memory or on disk, so a later estimate can retry the lookup.
Disable Persist remote VRAM estimates under Settings > Galleries, or set
LOCALAI_VRAM_PERSISTENT_CACHE=false, to keep estimates in memory only. Setting
LOCALAI_AUTOLOAD_GALLERIES=false also disables the startup warmer and the
persistent cache.
The same warm-up also describes each entry’s variants - the alternative
builds of the same weights that the picker offers - because that costs the same
kind of probe and lands in the same cache. Without it, the first model you open
pays for it again.
The warm-up is bounded, and covers the entries at the top of the gallery: the
ones you see first. Anything past it is estimated on first view and cached from
then on.
Variable
Default
Meaning
LOCALAI_VRAM_WARM_LIMIT
300
How many gallery entries to warm at startup, estimates and variants alike. Set to 0 to disable the warm-up entirely.
LOCALAI_VRAM_WARM_CONCURRENCY
4
How many estimates to run at once.
The provided Docker Compose configurations set LOCALAI_VRAM_WARM_LIMIT=0
as a defensive default, so container startup does not probe remote GGUF files.
Remove that override or set it to a positive number to opt into background
warming.
# Air-gapped, or you would rather not make the requests at allLOCALAI_VRAM_WARM_LIMIT=0 local-ai run
# A slow or metered link: warm the same entries, more gentlyLOCALAI_VRAM_WARM_CONCURRENCY=1 local-ai run
The warm-up never blocks startup, and never fails it: an entry whose weight
files cannot be reached is left cold and estimated later, if anyone asks.
See Backend flags for all available backend configuration options
Disk Prompt Cache
The llama-cpp backend keeps the KV state of earlier prompts in RAM (the server-side prompt cache). That cache is lost when the model unloads. The disk prompt cache keeps the state of long prompts on disk too. After a reload, a swap or a restart, a request with the same start reads the state from disk and does not compute it again.
The disk prompt cache is on by default. It needs a directory on a local disk: --prompt-cache-path (LOCALAI_PROMPT_CACHE_PATH), or the data path (--data-path, LOCALAI_DATA_PATH). With LOCALAI_DATA_PATH=- and no --prompt-cache-path, it is off.
What is stored
Each entry holds:
the prompt tokens, in clear. They can be read back as text;
the KV state of the model for those tokens;
for a hybrid model (Qwen3.5, LFM2, Granite-H), up to 3 checkpoints of the recurrent state.
Treat these files like stored chats. They contain what the users wrote, and the system prompts and tool results of their chats.
--prompt-cache-path, else <data path>/prompt-cache, else <models path>/../data/prompt-cache when it is on a local disk. See Worker setup.
The root must be on a local disk that the node can write. At start, each node checks its root:
On a network filesystem (NFS, SMB/CIFS, a remote FUSE filesystem such as sshfs, s3fs or rclone, Ceph, 9p, AFS and similar), the cache is off on that node. A FUSE mount of a local disk (virtiofs, fuseblk, the file sharing of Docker Desktop) counts as local.
When the node cannot create the root or write a file in it, the cache is off on that node.
In both cases the node logs one warning with the path, and Settings shows the reason for that node, for example “Off: network disk”. To fix it, set --prompt-cache-path or LOCALAI_PROMPT_CACHE_PATH to a directory on a local disk. On Windows and on platforms other than Linux and macOS, the type of the filesystem is not known, and only the write check applies.
Under the root, the backend writes one directory per model: llama-cpp/<build>-<model>/, mode 0700. The <build> part changes with the llama.cpp build, so an update starts a new directory and the old one expires. The directory also holds a manifest.json that describes the model and the cache format, and two small files, .lock and .speed.
Sizes
The KV state is large:
A dense 8B model with an f16 KV cache uses about 128 KiB per token. An entry of 8,000 tokens is about 1 GiB.
A hybrid model adds about 63 MiB per recurrent checkpoint. An entry keeps at most 3 checkpoints.
A quantized KV cache (cache_type_k, cache_type_v) makes the entries smaller.
When an entry is written and read
The backend writes an entry only when all these are true:
the prompt has at least 1,024 tokens (prompt_cache_disk_min_tokens). A shorter prompt is faster to compute again;
the start of the prompt was seen in at least two requests: a conversation with several turns, or a system prompt or tool list that requests share. A one-shot prompt is never written;
The backend reads an entry only when reading it is faster than computing it again. At start, LocalAI measures how fast the cache disk delivers data that is not in memory (64 MiB, read once per root, in the background). The backend compares the time to transfer the entry with the time to compute its tokens. A backend that starts before the measurement ends gets no speed and decides without it.
Isolation per user
Each user has a separate cache. LocalAI derives a namespace from the account that sends the request:
Request
Namespace
Web session or user API key
the user
Key of a paired device (client key)
that device
Legacy API key from the environment
one namespace for all such keys
Authentication off
one local namespace
LocalAI sends the backend a salt that it derives from the namespace. The salt is part of the key of every entry and of its file name. A request never reads an entry of another namespace. The namespace comes only from the authenticated account, never from request fields.
Shared cache
With prompt_cache_disk_shared on (the server setting, or the model option), all users read and write one cache. A long system prompt is then computed once for everybody. Turn it on only when every user may see the prompts of the other users: an entry holds the prompt text.
Incognito and zero-retention requests
A request of a zero-retention incognito chat is never written to disk. The backend keeps its state in RAM only, under a private key, and drops it when the request ends.
Turning it off
For the whole server: set Keep long prompts on disk off in Settings > Models in memory, or start with --prompt-cache-disk=false (LOCALAI_PROMPT_CACHE_DISK=false). Backends get the change when they next start.
For one model: add prompt_cache_disk:false to its options:.
options:- prompt_cache_disk:false
For one worker: start the worker with LOCALAI_PROMPT_CACHE_DISK=false. This only turns the tier off on that worker; the other settings of a worker come from the cluster (see Distributed mode).
Settings
The server settings are in Settings > Models in memory > Disk prompt cache, and in runtime_settings.json. A model option of the same name wins for that model.
Setting
Model option
Default
Meaning
prompt_cache_disk
prompt_cache_disk
true
Keep long prompts on disk.
prompt_cache_disk_ttl
prompt_cache_disk_ttl_hours
168h (7 days)
Time to keep an entry after its last use.
prompt_cache_disk_max_size_mib
prompt_cache_disk_max_size_mib
0: automatic
Size cap. The server cap is for the whole node; the model option is for one model.
prompt_cache_disk_user_quota_mib
prompt_cache_disk_quota_mib
0: automatic
Most disk one user may use.
prompt_cache_disk_min_tokens
prompt_cache_disk_min_tokens
1024
Shortest prompt that is written.
prompt_cache_disk_shared
prompt_cache_disk_shared
false
One cache for all users.
prompt_cache_disk_low_free_mib
prompt_cache_disk_low_free_mib
0: max(15% of the disk, 10 GiB)
Low free-space mark.
prompt_cache_disk_critical_free_mib
prompt_cache_disk_critical_free_mib
0: 5% of the disk
Critical free-space mark. Never above the low mark.
The automatic size cap is the smaller of 20 GiB and a tenth of the free disk, measured at start. The automatic quota is an equal share of the cap when authentication is on and has more than one user; otherwise there is no quota. Set the quota to -1 for no quota.
The defaults need no tuning. Change the marks only for a small disk or a test machine.
Low disk
The cache never fills the disk. Every few minutes, and before each write, the cache checks the free space of its disk:
Free space
State
What happens
Above the low mark
On
The cache works. It may grow up to its cap, and never past the free space over the low mark.
Under the low mark: max(15% of the disk, 10 GiB)
Paused, low disk
Nothing new is written. The oldest entries are deleted until the disk has the low mark free again, or the cache is empty. Not more is deleted than needed.
Under the critical mark: 5% of the disk
Disabled, disk almost full
Nothing is written. The oldest entries are deleted as in the paused state. The server logs one warning. The cache comes back only when the free space is above the low mark again.
When the cache and the models are on the same disk, the cache uses the numbers of that disk. So the cache never takes the room that a model download needs.
Settings > Models in memory shows the size of the cache, the free disk, the cap in effect and the state, with a message when the cache is paused or disabled.
Retention
What is kept: the entries described in What is stored, on the disk of the node that ran the model.
How long:
An entry is deleted 7 days after its last use (prompt_cache_disk_ttl, or prompt_cache_disk_ttl_hours of the model). A read counts as a use.
The size cap, the quota of each user and the low-disk rules delete the least recently used entries first.
A partial write older than 1 hour (after a crash) is deleted.
A cleaner on each node applies these rules at start and every 5 minutes. It deletes only the files of the cache layout.
How to clear it:
Who
How
What goes
Administrator
Settings > Models in memory > Clear, or POST /api/prompt-cache/clear
All entries of all users and models
Administrator
POST /api/prompt-cache/clear with {"model": "<name>"}
All entries of one model
A user
Account > Cached prompts > Clear my cached prompts, or DELETE /api/prompt-cache/mine
The entries of the user and of the user’s paired devices
Administrator
Delete a user
The entries of the user and of the user’s paired devices
A user or an administrator
Revoke a paired device (client key)
The entries of that device
Clear my cached prompts and the deletion of a user or a device do not delete the entries of the shared cache: they belong to no user. An administrator clear deletes them.
Deleting a chat does not delete its entries: the cache does not record which chat an entry came from. The entries expire with the time to live. To delete them at once, use Clear my cached prompts.
The administrator view (GET /api/prompt-cache) shows, for each node, the size, the number of entries and of namespaces, the state of the disk and the size of each model. It does not show prompt text or user names. The LocalAI Assistant has the same view and the clear as the get_prompt_cache and clear_prompt_cache tools.
Distributed mode
In distributed mode each worker keeps its own disk prompt cache. The frontends keep the settings and the clears once, for the whole cluster, and bring every worker up to date over the node control channel (the control verbs promptcache.sync and promptcache.usage, on NATS or on the tunnel of the worker).
Worker setup
A worker chooses the root of its cache in this order:
--prompt-cache-path (LOCALAI_PROMPT_CACHE_PATH).
<data path>/prompt-cache, with --data-path (LOCALAI_DATA_PATH).
<models path>/../data/prompt-cache, but only when that directory is on a local disk.
Step 3 keeps older workers working. Do not rely on it in a container. The models often sit on a network share at /models. Then /data is on the ephemeral root filesystem of the container, and the cache is lost when the container is replaced. Give the worker a data path on a local volume instead.
A worker without a usable root runs without the disk cache, logs one warning, and Settings shows it as off with the reason.
With docker run, mount a local directory at the data path:
On Kubernetes, mount an emptyDir with a sizeLimit at the data path. The cache then lives as long as the pod. For a cache that survives a new pod on the same node, use a PVC of a local-path storage class instead.
spec:containers:- name:workerimage:localai/localai:latest-gpu-nvidia-cuda-12args:["worker"]env:- name:LOCALAI_DATA_PATHvalue:/datavolumeMounts:- name:datamountPath:/datavolumes:- name:dataemptyDir:sizeLimit:50Gi# Or a local-path PVC:# persistentVolumeClaim:# claimName: localai-worker-data
Keep the sizeLimit above the cache cap and the low free-space mark. The cache measures the free space of the volume, and the kubelet evicts a pod that goes over the limit.
Who owns what
What
Owner
Where
Files
The worker that runs the backend
The root of the worker (see Worker setup), on the local disk of the worker. Its backends write the files and its own cleaner deletes them. A frontend never reads or writes them. No shared storage is needed or used.
Settings
The cluster
Stored once in the database with the other cluster settings (the memory settings of Settings > Models in memory). Every frontend applies the same values. The workers get them over the control channel, not from their own environment.
Clears and purges
The cluster
Stored in a purge log in the database. The frontend that is asked sends them to every worker at once.
Usage
Each worker
Each worker reports its own size, free disk, cap in effect and state. The frontend asks every worker and adds up the total.
The model option prompt_cache_disk:false and the other model options travel with the model when it loads, as in single mode.
Settings
A change of a setting reaches every worker within seconds: the frontends store it in the database, and one frontend sends it to each worker. A worker gets the settings again when it restarts (the frontends see its new process) and at least every 30 seconds while it is behind. A worker that has not received the settings yet, for example just after it starts, runs the defaults.
The automatic per-user quota is a share of the cap of each worker: the frontends send the number of users, and each worker computes its quota from its own cap.
LOCALAI_PROMPT_CACHE_DISK=false on a worker turns the tier off on that worker only. It can only turn the tier off: the cluster setting cannot turn it on against it.
Clears and offline workers
A clear (all, one model, Clear my cached prompts, the deletion of a user or a device) is written to the purge log first, then sent to every worker that is online. The clear succeeds once it is in the log. A worker that is offline, or that does not answer, applies the clears it missed when it is back: one frontend at a time checks every 30 seconds which workers are behind and sends them what they missed, oldest first.
A clear of all entries or of one model deletes only the entries last used before the clear was asked for. A clear that arrives late, or twice (two frontends may send it at once), never deletes entries written after it.
A clear of a user or a device deletes every entry of that namespace, whenever it arrives.
The purge log keeps a clear for 30 days. A worker that was away longer than that, and missed a clear that the log dropped, deletes all entries last used before that clear when it is back. So a worker never keeps an entry that a clear should have deleted.
The database records, for each worker, the last clear it applied and the settings it runs. The record of a worker that leaves the cluster is deleted.
Deleting a chat does not delete its entries, as in single mode.
Several frontends
Settings: one copy in the database, shared by every frontend (shared state, see the cluster settings).
Purge log and the record of each worker: one copy in the database. Any frontend can record a clear and send it.
The pass that brings workers up to date runs on one frontend at a time (an advisory lock). A worker skips a clear that it already applied, so a clear that two frontends send at once is applied once.
Each frontend may also have a cache root under its own data path. It holds nothing in distributed mode: the backends run on the workers.
Usage
GET /api/prompt-cache and Settings > Models in memory list every worker: its size, entries, free disk, cap in effect and state (on, paused, disabled, or off on that worker). A worker that is off says why in off_reason: no_path (no root), switched_off (the setting or the switch of the worker), network_disk or not_writable. A worker that is offline or does not answer is listed with the reason. The total adds up the workers that answered.
A cache that several workers share (for example on network storage), and routing a request to the worker that has its prompt on disk, are planned, not available now.
Measured
One GPU host with a local NVMe disk, llama.cpp, an 8B dense model at 4-bit and a 35B-A3B hybrid model at 8-bit. Two turns share a prompt, the model unloads, a new process loads it, and a third turn shares the prompt.
Model
Prompt
First token, cold
First token after a reload
35B-A3B hybrid
8k tokens
5.1 s
0.4 s
35B-A3B hybrid
32k tokens
19.2 s
0.8 s
8B dense
8k tokens
2.5 s
0.9 s
8B dense
32k tokens
14.3 s
3.3 s
Entries are written in the background while the server is idle, so an unload rarely has much left to save. An unload right after the last request (a model swap) still found the 32k-token entry of the earlier turn on disk.
Decoding streams do not slow down: with ten 1 GiB entries written during a decode stream, its largest gap and its 99th-percentile gap were no larger than with the tier off.
On a network share at 117 MB/s, the read-speed gate wrote nothing: reading the entry would be slower than computing the prompt on that GPU.
An entry of a dense model with a long prompt is large: about 4.5 GiB for 32k tokens of an 8B model with f16 KV. A KV cache at q8_0 halves it.
Two requests that branch off the same long prompt (two answers to one question, a regenerated reply) keep two files, each with the whole shared prompt. A multi-turn chat keeps one: each turn’s file replaces the one before. The per-user quota, the cap and the TTL bound the total (issue #13543 tracks keeping one file).
API
Method and path
Who
Body
Answer
GET /api/prompt-cache
Administrator
{enabled, shared, nodes: [{node, enabled, off_reason, error, bytes, files, namespaces, status, models}], total: {bytes, files, cap_bytes, nodes, unreachable}}. status.state is on, paused_low_disk, disabled_disk_full or unknown. error is set for a node that gave no usage.
POST /api/prompt-cache/clear
Administrator
{"model": "<name>"}, or empty for all
{files, bytes}
DELETE /api/prompt-cache/mine
Any user
{files, bytes}
Model compatibility table
Besides llama based models, LocalAI is compatible also with other architectures. The table below lists all the backends, compatible models families and the associated repository.
Note
LocalAI will attempt to automatically load models which are not explicitly configured for a specific backend. You can specify the backend to use by configuring a model with a YAML file. See the advanced section for more details.
All backends listed here can be installed on demand from the Backend Gallery. The exact set of acceleration variants published for each backend is defined in the backend library, gallery/backends/index.yaml. backend/index.yaml is generated from it.
From-scratch C++20 port of vLLM by the LocalAI team: paged KV cache, continuous batching, prefix caching, safetensors + GGUF, engine-enforced structured output, no Python at inference
GPT, Functions
no
yes
CPU, CUDA 13 (Ampere through Blackwell), Vulkan, Metal, Jetson L4T (Orin, Thor, GB10)
NVIDIA C++/GGML runtime for Nemotron Speech: offline, streaming and live transcription, Sortformer diarization, MagpieTTS synthesis and Riva-Translate translation from one backend. See NeMo-Speech.cpp backend
Any-to-any audio models (for example LFM3-Audio, experimental) served through the Realtime API, with tool calls and transcripts. See Speech-to-speech models
CPU, CUDA 12/13, ROCm, Intel SYCL, Vulkan, Metal, Jetson L4T
Multi-family GGML audio engine: voice activity detection (bundled silero_vad and marblenet_vad, no download), source separation into named stems, and voice conversion. See audio.cpp backend
LocalAI supports fine-tuning LLMs directly through the API and Web UI. Fine-tuning is powered by pluggable backends that implement a generic gRPC interface, allowing support for different training frameworks and model types.
LocalAI supports model quantization directly through the API and Web UI. Quantization converts HuggingFace models to GGUF format and compresses them to smaller sizes for efficient inference with llama.cpp.
Note This feature is experimental and may change in future releases.
Subsections of Train and quantize
Fine-tune a model
LocalAI supports fine-tuning LLMs directly through the API and Web UI. Fine-tuning is powered by pluggable backends that implement a generic gRPC interface, allowing support for different training frameworks and model types.
Supported Backends
Backend
Domain
GPU Required
Training Methods
Adapter Types
trl
LLM fine-tuning
No (CPU or GPU)
SFT, DPO, GRPO, RLOO, Reward, KTO, ORPO
LoRA, Full
The trl backend is built for CPU, NVIDIA (CUDA 12 and 13), Apple Silicon (Metal) and AMD (ROCm 10.1). LocalAI picks the build that matches the host. The ROCm build uses AMD’s PyTorch for ROCm 10.1 and has been tested on gfx1151 (Strix Halo); 4-bit loading (load_in_4bit) needs bitsandbytes, which the ROCm build does not include.
Availability
The fine-tuning API and the training backends are part of LocalAI. The Fine-Tune page and the chat tools are in the fine-tuning add-on (see Fine-tuning is an add-on). With --addons-enabled=false every path under /api/fine-tuning answers 503. When authentication is enabled, fine-tuning is a per-user feature (default OFF). Admins can enable it for specific users via the user management API.
Note
This feature is experimental and may change in future releases.
Whether model exports are allowed on this instance ({"model_exports": bool})
POST
/api/fine-tuning/jobs
Start a fine-tuning job
GET
/api/fine-tuning/jobs
List all jobs
GET
/api/fine-tuning/jobs/:id
Get job details
DELETE
/api/fine-tuning/jobs/:id
Stop a running job
GET
/api/fine-tuning/jobs/:id/progress
SSE progress stream
GET
/api/fine-tuning/jobs/:id/checkpoints
List checkpoints
POST
/api/fine-tuning/jobs/:id/export
Export model
POST
/api/fine-tuning/datasets
Upload dataset file
GET /api/fine-tuning/status and GET /api/quantization/status return {"model_exports": true|false}. The value is false only when this instance does not see the models path of the add-on owner; it is the same value as the model_exports key of GET /api/features. The Web UI disables the export controls while it is false. Both routes need an authenticated user and answer 503 when add-ons are off.
Job Request Fields
Field
Type
Description
model
string
HuggingFace model ID or local path (required)
backend
string
Backend name (default: trl)
training_method
string
sft, dpo, grpo, rloo, reward, kto, orpo
training_type
string
lora or full
dataset_source
string
HuggingFace dataset ID or local file path (required)
adapter_rank
int
LoRA rank (default: 16)
adapter_alpha
int
LoRA alpha (default: 16)
num_epochs
int
Number of training epochs (default: 3)
batch_size
int
Per-device batch size (default: 2)
learning_rate
float
Learning rate (default: 2e-4)
gradient_accumulation_steps
int
Gradient accumulation (default: 4)
warmup_steps
int
Warmup steps (default: 5)
optimizer
string
adamw_torch, adamw_8bit, sgd, adafactor, prodigy
extra_options
map
Backend-specific options (see below)
Backend-Specific Options (extra_options)
TRL
Key
Description
Default
max_seq_length
Maximum sequence length
512
packing
Enable sequence packing
false
trust_remote_code
Trust remote code in model
false
load_in_4bit
Enable 4-bit quantization (CUDA GPU only; the ROCm build has no bitsandbytes, so a job with it fails there)
false
DPO-specific (training_method=dpo)
Key
Description
Default
beta
KL penalty coefficient
0.1
loss_type
Loss type: sigmoid, hinge, ipo
sigmoid
max_length
Maximum sequence length
512
GRPO-specific (training_method=grpo)
Key
Description
Default
num_generations
Number of generations per prompt
4
max_completion_length
Max completion token length
256
GRPO Reward Functions
GRPO training requires reward functions to evaluate model completions. Specify them via the reward_functions field (a typed array) or via extra_options["reward_funcs"] (a JSON string).
Built-in Reward Functions
Name
Description
Parameters
format_reward
Checks <think>...</think> then answer format (1.0/0.0)
-
reasoning_accuracy_reward
Extracts <answer> content, compares to dataset’s answer column
-
length_reward
Score based on proximity to target length [0, 1]
target_length (default: 200)
xml_tag_reward
Scores properly opened/closed <think> and <answer> tags
You can provide custom reward function code as a Python function body. The function receives completions (list of strings) and **kwargs, and must return list[float].
Warning
Inline reward code executes arbitrary Python and is disabled by default.
Inline code is compiled and run in the backend process. The restricted-builtins allowlist is not a security sandbox: trivial expressions can escape it to reach the host (arbitrary code execution). Because the fine-tuning endpoint is unauthenticated by default, inline reward functions are refused unless the operator explicitly opts in by setting LOCALAI_TRL_ALLOW_INLINE_REWARD=true on the backend.
Only enable it on a trusted, access-controlled instance where every caller of the fine-tuning API is authorized to run code on the host. Otherwise use the builtin reward functions above.
The function is given the reduced builtin set (len, int, float, str, list, dict, range, enumerate, zip, map, filter, sorted, min, max, sum, abs, round, any, all, isinstance, print) plus the re, math, json, and string modules, and is compiled and validated at job start (fail-fast on syntax errors). Treat these as ergonomics, not as an isolation boundary.
Example API Request
curl -X POST http://localhost:8080/api/fine-tuning/jobs \
-H "Content-Type: application/json"\
-d '{
"model": "Qwen/Qwen2.5-1.5B-Instruct",
"backend": "trl",
"training_method": "grpo",
"training_type": "lora",
"dataset_source": "my-reasoning-dataset",
"num_epochs": 1,
"batch_size": 2,
"learning_rate": 5e-6,
"reward_functions": [
{"type": "builtin", "name": "reasoning_accuracy_reward"},
{"type": "builtin", "name": "format_reward"},
{"type": "builtin", "name": "length_reward", "params": {"target_length": "200"}},
{"type": "inline", "name": "think_presence", "code": "return [1.0 if \"<think>\" in c else 0.0 for c in completions]"}
],
"extra_options": {
"num_generations": "4",
"max_completion_length": "256"
}
}'
Note
In a split deployment (--addons-role=owner and --addons-role=frontend), the export writes into the models path. That path must be the shared models storage. See The models path.
Export Formats
Format
Description
Notes
lora
LoRA adapter files
Smallest, requires base model
merged_16bit
Full model in 16-bit
Large but standalone
merged_4bit
Full model in 4-bit
Smaller, standalone
gguf
GGUF format
For llama.cpp, requires quantization_method
GGUF Quantization Methods
q4_k_m, q5_k_m, q8_0, f16, q4_0, q5_0
Web UI
The Fine-Tune page is one page that follows the job from set-up to result. A line at the top shows where you are: set up, check, run, result.
Set up - Choose the base model, the dataset (a Hugging Face id or an uploaded file), the kind of training (an adapter, or the full model) and the epochs, batch size and learning rate. Method, backend, adapter settings, optimizer, evaluation, reward functions (GRPO) and extra options are under More options.
Check before you start - A list of what is known before the job starts, redrawn as you change the form: whether the model and dataset are set, whether a fine-tuning backend is installed, how much GPU memory (or RAM, when there is no GPU) is free, how much space is free on the models disk, and whether a token is set. LocalAI does not estimate how much memory a job needs or how long it takes, because the server cannot know that before the job starts, so the page says so. A missing model or dataset blocks the start. A warning, such as a missing backend or no GPU, does not.
Run - Percent, step, epoch, the server’s time estimate and tokens per second, the stages the job passes through, a chart of loss (with the evaluation loss as hollow dots), learning rate and gradient norm, and a log of what the job reported since the page opened. Stop asks whether to keep a checkpoint.
Result - A failed job shows the server’s message. When the message says memory ran out, the page offers two changes (a batch size of 1 and gradient checkpointing) that are applied to a copy of the setup and start nothing until you press Start. A finished job lists its checkpoints and exports the result as a model, then links to a chat with it and to Models.
Earlier jobs are listed below the form. Reuse puts a job’s setup back in the form.
A user needs the fine-tuning permission. Without it, the page says the account cannot fine-tune and who can change that.
Fine-tuning is an add-on
The Fine-Tune page is the fine-tuning add-on. It does not ship with LocalAI. An administrator installs it from Find add-ons with Install, then turns it on in My add-ons. Once it is on, it opens from My add-ons at /app/addons/fine-tuning/jobs and can be shown in the sidebar.
Open the canonical add-on page from My add-ons. Historical standalone links are not registered.
The API does not change. The page calls /api/fine-tuning/* with the signed-in user’s own session, and the server checks the fine-tuning permission on every call, so the add-on never widens what a user may do.
With --addons-enabled=false this feature is off, like every add-on. The UI shows no entry for it, /app/addons/fine-tuning/jobs leads back to /app, and every path under /api/fine-tuning answers 503. See The addons feature gate.
The add-on also offers tools to the chat: list jobs, propose a job, store a small dataset, read the status and the checkpoints of a job, stop a job and export a checkpoint as a model. A tool can only control a job that a tool started. A job started in the page is listed, but a tool cannot stop or export it. In the chats, and in an agent or a trigger whose agent names the add-on, a tool call that starts a job runs at once, because you turned the add-on on; a trigger with no agent gets no such tool; the result says what an undo does (see below). On the OpenAI-compatible API and other surfaces, a tool only proposes the action and a person confirms it in an approval card. A model or a dataset given as a local path is refused. The tools call the engine through the host operations (see Host operations), which the host setting LOCALAI_ADDON_HOST_OPS grants to this add-on by the finetune. prefix, and they run with the permissions of the person in the chat.
Undo is the safety net for a job a chat started. Starting a job keeps a change set in the add-on, and the chat shows an Undo button on it. An undo stops the job while it still runs; it does not save a checkpoint. If the job already finished, was stopped, or was exported, the answer is cannot_undo: a finished job cannot be un-run, and the engine offers no operation that removes its output, so nothing is deleted. A change set can be undone for 7 days and only once. Stopping a job, exporting a checkpoint and storing a dataset cannot be undone, and their results say so with the reason. The undo is the person’s own action from a browser tab; no model, agent or API key can call it. The change set lives in the add-on’s own data, with the rest of its journal, so it travels with the add-on’s backups and goes with its data when that is purged. In a cluster the undo goes through the add-on’s owner like every other call.
Dataset Formats
Datasets should follow standard HuggingFace formats:
SFT: Alpaca format (instruction, input, output fields) or ChatML/ShareGPT
Fine-tuning uses the same gRPC backend architecture as inference:
Proto layer: FineTuneRequest, FineTuneProgress (streaming), StopFineTune, ListCheckpoints, ExportModel
Python backends: Each backend implements the gRPC interface with its specific training framework
Go service: Manages job lifecycle, routes API requests to backends
REST API: HTTP endpoints with SSE progress streaming
React UI: Configuration form, real-time training monitor, export panel
Quantize a model
LocalAI supports model quantization directly through the API and Web UI. Quantization converts HuggingFace models to GGUF format and compresses them to smaller sizes for efficient inference with llama.cpp.
Note
This feature is experimental and may change in future releases.
Supported Backends
Backend
Description
Quantization Types
Platforms
llama-cpp-quantization
Downloads HF models, converts to GGUF, and quantizes using llama.cpp
Whether model imports are allowed on this instance
GET /api/fine-tuning/status and GET /api/quantization/status return {"model_exports": true|false}. The value is false only when this instance does not see the models path of the add-on owner; it is the same value as the model_exports key of GET /api/features. The Web UI disables the import controls while it is false. Both routes need an authenticated user and answer 503 when add-ons are off.
Job Request Fields
Field
Type
Description
model
string
HuggingFace model ID or local path (required)
backend
string
Backend name (default: llama-cpp-quantization)
quantization_type
string
Quantization format (default: q4_k_m)
extra_options
map
Backend-specific options (see below)
Extra Options
Key
Description
hf_token
HuggingFace token for gated models
Note
In a split deployment (--addons-role=owner and --addons-role=frontend), the export writes into the models path. That path must be the shared models storage. See The models path.
Import Request Fields
Field
Type
Description
name
string
Model name for LocalAI (auto-generated if empty)
Job Status Values
Status
Description
queued
Job created, waiting to start
downloading
Downloading model from HuggingFace
converting
Converting model to f16 GGUF
quantizing
Running quantization
completed
Quantization finished successfully
failed
Job failed (check message for details)
stopped
Job stopped by user
Progress Stream
The GET /api/quantization/jobs/:id/progress endpoint returns Server-Sent Events (SSE) with JSON payloads:
When the job completes, output_file contains the path to the quantized GGUF file and extra_metrics includes file_size_mb.
Quantization Types
Type
Size
Quality
Description
q2_k
Smallest
Lowest
2-bit quantization
q3_k_s
Very small
Low
3-bit small
q3_k_m
Very small
Low
3-bit medium
q3_k_l
Small
Low-medium
3-bit large
q4_0
Small
Medium
4-bit legacy
q4_k_s
Small
Medium
4-bit small
q4_k_m
Small
Good
4-bit medium (recommended)
q5_0
Medium
Good
5-bit legacy
q5_k_s
Medium
Good
5-bit small
q5_k_m
Medium
Very good
5-bit medium
q6_k
Large
Excellent
6-bit
q8_0
Large
Near-lossless
8-bit
f16
Largest
Lossless
16-bit (no quantization, GGUF conversion only)
The UI also supports entering a custom quantization type string for any format supported by llama-quantize.
Web UI
The Quantize page uses the same page pattern as fine-tuning: set up, check, run, result.
Set up - Choose the model and the quantization type (a preset, or a custom type). The backend and the Hugging Face token are under More options.
Check before you start - Whether a model and type are set, whether a quantization backend is installed, the free RAM and the free space on the models disk. The server reports no model size before the job starts, so the page does not estimate one.
Run - Percent, the stage (downloading, converting, quantizing), and a log of what the job reported since the page opened. Stop ends the job.
Result - A failed job shows the server’s message. A finished job shows the output file, downloads it, or imports it into LocalAI under a name you choose, then links to a chat with it and to Models.
Earlier jobs are listed below the form, with Reuse and Delete (after a confirmation).
A user needs the quantization permission. Without it, the page says the account cannot quantize.
Quantization is an add-on
The Quantize page is the quantization add-on. It does not ship with LocalAI. An administrator installs it from Find add-ons with Install, then turns it on in My add-ons. Once it is on, it opens from My add-ons at /app/addons/quantization/jobs and can be shown in the sidebar.
Open the canonical add-on page from My add-ons. Historical standalone links are not registered.
The API does not change. The page calls /api/quantization/* with the signed-in user’s own session, and the server checks the quantization permission on every call.
With --addons-enabled=false this feature is off, like every add-on. The UI shows no entry for it, /app/addons/quantization/jobs leads back to /app, and every path under /api/quantization answers 503. See The addons feature gate.
The add-on also offers tools to the chat: list jobs, propose a job, read the status of a job, stop a job and import the result as a model. A tool can only control a job that a tool started. A job started in the page is listed, but a tool cannot stop or import it. In the chats, an agent and a trigger, a tool call that starts a job runs at once, because you turned the add-on on for that chat; the result says what an undo does (see below). On the OpenAI-compatible API and other surfaces, a tool only proposes the action and a person confirms it in an approval card. A model given as a local path is refused. The tools call the engine through the host operations (see Host operations), which the host setting LOCALAI_ADDON_HOST_OPS grants to this add-on by the quantize. prefix, and they run with the permissions of the person in the chat.
Undo is the safety net for a job a chat started. Starting a job keeps a change set in the add-on, and the chat shows an Undo button on it. An undo stops the job while it still runs. If the job already finished, was stopped, or was imported, the answer is cannot_undo: a finished job cannot be un-run, and the engine offers no operation that removes its files, so nothing is deleted. A change set can be undone for 7 days and only once. Stopping a job and importing the result cannot be undone, and their results say so with the reason. The undo is the person’s own action from a browser tab; no model, agent or API key can call it. The change set lives in the add-on’s own data, with the rest of its journal, so it travels with the add-on’s backups and goes with its data when that is purged. In a cluster the undo goes through the add-on’s owner like every other call.
Architecture
Quantization uses the same gRPC backend architecture as fine-tuning:
Proto layer: QuantizationRequest, QuantizationProgress (streaming), StopQuantization
Python backend: Downloads model, runs convert_hf_to_gguf.py and llama-quantize
Go service: Manages job lifecycle, state persistence, async import
REST API: HTTP endpoints with SSE progress streaming