Subsections of References

Shell Completion

LocalAI provides shell completion support for bash, zsh, and fish shells. Once installed, tab completion works for all CLI commands, subcommands, and flags.

Generating Completion Scripts

Use the completion subcommand to generate a completion script for your shell:

local-ai completion bash
local-ai completion zsh
local-ai completion fish

Installation

Bash

Add the following to your ~/.bashrc:

source <(local-ai completion bash)

Or install it system-wide:

local-ai completion bash > /etc/bash_completion.d/local-ai

Zsh

Add the following to your ~/.zshrc:

source <(local-ai completion zsh)

Or install it to a completions directory:

local-ai completion zsh > "${fpath[1]}/_local-ai"

If shell completions are not already enabled in your zsh environment, add the following to the beginning of your ~/.zshrc:

autoload -Uz compinit
compinit

Fish

local-ai completion fish | source

Or install it permanently:

local-ai completion fish > ~/.config/fish/completions/local-ai.fish

Usage

After installation, restart your shell or source your shell configuration file. Then type local-ai followed by a tab to see available commands:

$ local-ai <TAB>
run              backends         completion       explorer         models
federated        sound-generation transcript       tts              util

Tab completion also works for subcommands and flags:

$ local-ai models <TAB>
install  list

$ local-ai run --<TAB>
--address          --backends-path    --context-size     --debug            ...

System Info and Version

LocalAI provides endpoints to inspect the running instance, including available backends, loaded models, and version information.

System Information

  • Method: GET
  • Endpoint: /system

Returns available backends and currently loaded models.

Response

FieldTypeDescription
backendsarrayList of available backend names (strings)
loaded_modelsarrayList of currently loaded models
loaded_models[].idstringModel identifier

Usage

curl http://localhost:8080/system

Example response

{
  "backends": [
    "llama-cpp",
    "huggingface",
    "diffusers",
    "whisper"
  ],
  "loaded_models": [
    {
      "id": "my-llama-model"
    },
    {
      "id": "whisper-1"
    }
  ]
}

Version

  • Method: GET
  • Endpoint: /version

Returns the LocalAI version and build commit.

Response

FieldTypeDescription
versionstringVersion string in the format version (commit)

Usage

curl http://localhost:8080/version

Example response

{
  "version": "2.26.0 (a1b2c3d4)"
}

Error Responses

Status CodeDescription
500Internal server error

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.

Text Generation & Language Models

Backend and BindingsCompatible modelsCompletion/Chat endpointCapabilityEmbeddings supportToken stream supportAcceleration
llama.cppLLama, Mamba, RWKV, Falcon, Starcoder, GPT-2, and many othersyesGPT and FunctionsyesyesCUDA 12/13, ROCm, Intel SYCL, Vulkan, Metal, CPU
vLLMVarious GPTs and quantization formatsyesGPTnonoCUDA 12/13, ROCm, Intel
transformersVarious GPTs and quantization formatsyesGPT, embeddings, Audio generationyesyes*CUDA 12/13, ROCm, Intel, CPU
MLXVarious LLMsyesGPTnonoMetal (Apple Silicon)
MLX-VLMVision-Language ModelsyesMultimodal GPTnonoMetal (Apple Silicon)
vllm-omnivLLM Omni multimodalyesMultimodal GPTnonoCUDA 12/13, ROCm, Intel
langchain-huggingfaceAny text generators available on HuggingFace through APIyesGPTnonoN/A

Audio & Speech Processing

Backend and BindingsCompatible modelsCompletion/Chat endpointCapabilityEmbeddings supportToken stream supportAcceleration
whisper.cppwhispernoAudio transcriptionnonoCUDA 12/13, ROCm, Intel SYCL, Vulkan, CPU
faster-whisperwhispernoAudio transcriptionnonoCUDA 12/13, ROCm, Intel, CPU
piper (binding)Any piper onnx modelnoText to voicenonoCPU
coquiCoqui TTSnoAudio generation and Voice cloningnonoCUDA 12/13, ROCm, Intel, CPU
kokoroKokoro TTSnoText-to-speechnonoCUDA 12/13, ROCm, Intel, CPU
chatterboxChatterbox TTSnoText-to-speechnonoCUDA 12/13, CPU
kitten-ttsKitten TTSnoText-to-speechnonoCPU
silero-vad with Golang bindingsSilero VADnoVoice Activity DetectionnonoCPU
neuttsNeuTTSAirnoText-to-speech with voice cloningnonoCUDA 12/13, ROCm, CPU
vibevoiceVibeVoice-RealtimenoReal-time text-to-speech with voice cloningnonoCUDA 12/13, ROCm, Intel, CPU
pocket-ttsPocket TTSnoLightweight CPU-based text-to-speech with voice cloningnonoCUDA 12/13, ROCm, Intel, CPU
mlx-audioMLXnoText-tospeechnonoMetal (Apple Silicon)
nemoNeMo speech modelsnoSpeech modelsnonoCUDA 12/13, ROCm, Intel, CPU
outettsOuteTTSnoText-to-speech with voice cloningnonoCUDA 12/13, CPU
faster-qwen3-ttsFaster Qwen3 TTSnoFast text-to-speechnonoCUDA 12/13, ROCm, Intel, CPU
qwen-asrQwen ASRnoAutomatic speech recognitionnonoCUDA 12/13, ROCm, Intel, CPU
voxcpmVoxCPMnoSpeech understandingnonoCUDA 12/13, Metal, CPU
whisperxWhisperXnoEnhanced transcriptionnonoCUDA 12/13, ROCm, Intel, CPU

Image & Video Generation

Backend and BindingsCompatible modelsCompletion/Chat endpointCapabilityEmbeddings supportToken stream supportAcceleration
stablediffusion.cppstablediffusion-1, stablediffusion-2, stablediffusion-3, flux, PhotoMakernoImagenonoCUDA 12/13, Intel SYCL, Vulkan, CPU
diffusersSD, various diffusion models,…noImage/Video generationnonoCUDA 12/13, ROCm, Intel, Metal, CPU
transformers-musicgenMusicGennoAudio generationnonoCUDA, CPU

Specialized AI Tasks

Backend and BindingsCompatible modelsCompletion/Chat endpointCapabilityEmbeddings supportToken stream supportAcceleration
rfdetrRF-DETRnoObject DetectionnonoCUDA 12/13, Intel, CPU
rerankersReranking APInoRerankingnonoCUDA 12/13, ROCm, Intel, CPU
local-storeVector databasenoVector storageyesnoCPU
huggingfaceHuggingFace API modelsyesVarious AI tasksyesyesAPI-based

Acceleration Support Summary

GPU Acceleration

  • NVIDIA CUDA: CUDA 12.0, CUDA 13.0 support across most backends
  • AMD ROCm: HIP-based acceleration for AMD GPUs
  • Intel oneAPI: SYCL-based acceleration for Intel GPUs (F16/F32 precision)
  • Vulkan: Cross-platform GPU acceleration
  • Metal: Apple Silicon GPU acceleration (M1/M2/M3+)

Specialized Hardware

  • NVIDIA Jetson (L4T CUDA 12): ARM64 support for embedded AI (AGX Orin, Jetson Nano, Jetson Xavier NX, Jetson AGX Xavier)
  • NVIDIA Jetson (L4T CUDA 13): ARM64 support for embedded AI (DGX Spark)
  • Apple Silicon: Native Metal acceleration for Mac M1/M2/M3+
  • Darwin x86: Intel Mac support

CPU Optimization

  • AVX/AVX2/AVX512: Advanced vector extensions for x86
  • Quantization: 4-bit, 5-bit, 8-bit integer quantization support
  • Mixed Precision: F16/F32 mixed precision support

Note: any backend name listed above can be used in the backend field of the model configuration file (See the advanced section).

  • * Only for CUDA and OpenVINO CPU/XPU acceleration.

Architecture

LocalAI is an API written in Go that serves as an OpenAI shim, enabling software already developed with OpenAI SDKs to seamlessly integrate with LocalAI. It can be effortlessly implemented as a substitute, even on consumer-grade hardware. This capability is achieved by employing various C++ backends, including ggml, to perform inference on LLMs using both CPU and, if desired, GPU. Internally LocalAI backends are just gRPC server, indeed you can specify and build your own gRPC server and extend LocalAI in runtime as well. It is possible to specify external gRPC server and/or binaries that LocalAI will manage internally.

LocalAI uses a mixture of backends written in various languages (C++, Golang, Python, …). You can check the model compatibility table to learn about all the components of LocalAI.

localai localai

Backstory

As much as typical open source projects starts, I, mudler, was fiddling around with llama.cpp over my long nights and wanted to have a way to call it from go, as I am a Golang developer and use it extensively. So I’ve created LocalAI (or what was initially known as llama-cli) and added an API to it.

But guess what? The more I dived into this rabbit hole, the more I realized that I had stumbled upon something big. With all the fantastic C++ projects floating around the community, it dawned on me that I could piece them together to create a full-fledged OpenAI replacement. So, ta-da! LocalAI was born, and it quickly overshadowed its humble origins.

Now, why did I choose to go with C++ bindings, you ask? Well, I wanted to keep LocalAI snappy and lightweight, allowing it to run like a champ on any system and avoid any Golang penalties of the GC, and, most importantly built on shoulders of giants like llama.cpp. Go is good at backends and API and is easy to maintain. And hey, don’t forget that I’m all about sharing the love. That’s why I made LocalAI MIT licensed, so everyone can hop on board and benefit from it.

As if that wasn’t exciting enough, as the project gained traction, mkellerman and Aisuko jumped in to lend a hand. mkellerman helped set up some killer examples, while Aisuko is becoming our community maestro. The community now is growing even more with new contributors and users, and I couldn’t be happier about it!

Oh, and let’s not forget the real MVP hereβ€”llama.cpp. Without this extraordinary piece of software, LocalAI wouldn’t even exist. So, a big shoutout to the community for making this magic happen!

CLI Reference

Complete reference for all LocalAI command-line interface (CLI) parameters and environment variables.

Note: All CLI flags can also be set via environment variables. Environment variables take precedence over CLI flags. See .env files for configuration file support.

Global Flags

ParameterDefaultDescriptionEnvironment Variable
-h, --helpShow context-sensitive help
--log-levelinfoSet the level of logs to output [error,warn,info,debug,trace]$LOCALAI_LOG_LEVEL
--debugfalseDEPRECATED - Use --log-level=debug instead. Enable debug logging$LOCALAI_DEBUG, $DEBUG

Storage Flags

ParameterDefaultDescriptionEnvironment Variable
--models-pathBASEPATH/modelsPath containing models used for inferencing$LOCALAI_MODELS_PATH, $MODELS_PATH
--data-pathBASEPATH/dataPath for persistent data (collectiondb, agent state, tasks, jobs). Separates mutable data from configuration$LOCALAI_DATA_PATH
--generated-content-path/tmp/generated/contentLocation for assets generated by backends (e.g. stablediffusion, images, audio, videos)$LOCALAI_GENERATED_CONTENT_PATH, $GENERATED_CONTENT_PATH
--upload-path/tmp/localai/uploadPath to store uploads from files API$LOCALAI_UPLOAD_PATH, $UPLOAD_PATH
--localai-config-dirBASEPATH/configurationDirectory for dynamic loading of certain configuration files (currently runtime_settings.json, api_keys.json, and external_backends.json). See Runtime Settings for web-based configuration.$LOCALAI_CONFIG_DIR
--localai-config-dir-poll-intervalTime duration to poll the LocalAI Config Dir if your system has broken fsnotify events (example: 1m)$LOCALAI_CONFIG_DIR_POLL_INTERVAL
--models-config-fileYAML file containing a list of model backend configs (alias: --config-file)$LOCALAI_MODELS_CONFIG_FILE, $CONFIG_FILE

Backend Flags

ParameterDefaultDescriptionEnvironment Variable
--backends-pathBASEPATH/backendsPath containing backends used for inferencing$LOCALAI_BACKENDS_PATH, $BACKENDS_PATH
--backends-system-path/var/lib/local-ai/backendsPath containing system backends used for inferencing$LOCALAI_BACKENDS_SYSTEM_PATH, $BACKEND_SYSTEM_PATH
--external-backendsA list of external backends to load from gallery on boot$LOCALAI_EXTERNAL_BACKENDS, $EXTERNAL_BACKENDS
--external-grpc-backendsA list of external gRPC backends (format: BACKEND_NAME:URI)$LOCALAI_EXTERNAL_GRPC_BACKENDS, $EXTERNAL_GRPC_BACKENDS
--backend-galleriesJSON list of backend galleries$LOCALAI_BACKEND_GALLERIES, $BACKEND_GALLERIES
--autoload-backend-galleriestrueAutomatically load backend galleries on startup$LOCALAI_AUTOLOAD_BACKEND_GALLERIES, $AUTOLOAD_BACKEND_GALLERIES
--parallel-requestsfalseEnable backends to handle multiple requests in parallel if they support it (e.g.: llama.cpp or vllm)$LOCALAI_PARALLEL_REQUESTS, $PARALLEL_REQUESTS
--max-active-backends0Maximum number of active backends (loaded models). When exceeded, the least recently used model is evicted. Set to 0 for unlimited, 1 for single-backend mode$LOCALAI_MAX_ACTIVE_BACKENDS, $MAX_ACTIVE_BACKENDS
--single-active-backendfalseDEPRECATED - Use --max-active-backends=1 instead. Allow only one backend to be run at a time$LOCALAI_SINGLE_ACTIVE_BACKEND, $SINGLE_ACTIVE_BACKEND
--preload-backend-onlyfalseDo not launch the API services, only the preloaded models/backends are started (useful for multi-node setups)$LOCALAI_PRELOAD_BACKEND_ONLY, $PRELOAD_BACKEND_ONLY
--enable-watchdog-idlefalseEnable watchdog for stopping backends that are idle longer than the watchdog-idle-timeout$LOCALAI_WATCHDOG_IDLE, $WATCHDOG_IDLE
--watchdog-idle-timeout15mThreshold beyond which an idle backend should be stopped$LOCALAI_WATCHDOG_IDLE_TIMEOUT, $WATCHDOG_IDLE_TIMEOUT
--enable-watchdog-busyfalseEnable watchdog for stopping backends that are busy longer than the watchdog-busy-timeout$LOCALAI_WATCHDOG_BUSY, $WATCHDOG_BUSY
--watchdog-busy-timeout5mThreshold beyond which a busy backend should be stopped$LOCALAI_WATCHDOG_BUSY_TIMEOUT, $WATCHDOG_BUSY_TIMEOUT
--watchdog-interval500msInterval between watchdog checks (e.g., 500ms, 5s, 1m)$LOCALAI_WATCHDOG_INTERVAL, $WATCHDOG_INTERVAL
--force-eviction-when-busyfalseForce eviction even when models have active API calls (default: false for safety). Warning: Enabling this can interrupt active requests$LOCALAI_FORCE_EVICTION_WHEN_BUSY, $FORCE_EVICTION_WHEN_BUSY
--lru-eviction-max-retries30Maximum number of retries when waiting for busy models to become idle before eviction$LOCALAI_LRU_EVICTION_MAX_RETRIES, $LRU_EVICTION_MAX_RETRIES
--lru-eviction-retry-interval1sInterval between retries when waiting for busy models to become idle (e.g., 1s, 2s)$LOCALAI_LRU_EVICTION_RETRY_INTERVAL, $LRU_EVICTION_RETRY_INTERVAL

For more information on VRAM management, see VRAM and Memory Management.

Models Flags

ParameterDefaultDescriptionEnvironment Variable
--galleriesJSON list of galleries$LOCALAI_GALLERIES, $GALLERIES
--autoload-galleriestrueAutomatically load galleries on startup$LOCALAI_AUTOLOAD_GALLERIES, $AUTOLOAD_GALLERIES
--preload-modelsA list of models to apply in JSON at start$LOCALAI_PRELOAD_MODELS, $PRELOAD_MODELS
--modelsA list of model configuration URLs to load$LOCALAI_MODELS, $MODELS
--preload-models-configA list of models to apply at startup. Path to a YAML config file$LOCALAI_PRELOAD_MODELS_CONFIG, $PRELOAD_MODELS_CONFIG
--load-to-memoryA list of models to load into memory at startup$LOCALAI_LOAD_TO_MEMORY, $LOAD_TO_MEMORY

Note: You can also pass model configuration URLs as positional arguments: local-ai run MODEL_URL1 MODEL_URL2 ...

Performance Flags

ParameterDefaultDescriptionEnvironment Variable
--f16falseEnable GPU acceleration$LOCALAI_F16, $F16
-t, --threadsNumber of threads used for parallel computation. Usage of the number of physical cores in the system is suggested$LOCALAI_THREADS, $THREADS
--context-sizeDefault context size for models$LOCALAI_CONTEXT_SIZE, $CONTEXT_SIZE

API Flags

ParameterDefaultDescriptionEnvironment Variable
--address:8080Bind address for the API server$LOCALAI_ADDRESS, $ADDRESS
--corsfalseEnable CORS (Cross-Origin Resource Sharing)$LOCALAI_CORS, $CORS
--cors-allow-originsComma-separated list of allowed CORS origins$LOCALAI_CORS_ALLOW_ORIGINS, $CORS_ALLOW_ORIGINS
--csrffalseEnable Fiber CSRF middleware$LOCALAI_CSRF
--upload-limit15Default upload-limit in MB$LOCALAI_UPLOAD_LIMIT, $UPLOAD_LIMIT
--api-keysList of API Keys to enable API authentication. When this is set, all requests must be authenticated with one of these API keys$LOCALAI_API_KEY, $API_KEY
--disable-webuifalseDisables the web user interface. When set to true, the server will only expose API endpoints without serving the web interface$LOCALAI_DISABLE_WEBUI, $DISABLE_WEBUI
--disable-runtime-settingsfalseDisables the runtime settings feature. When set to true, the server will not load runtime settings from the runtime_settings.json file and the settings web interface will be disabled$LOCALAI_DISABLE_RUNTIME_SETTINGS, $DISABLE_RUNTIME_SETTINGS
--disable-gallery-endpointfalseDisable the gallery endpoints$LOCALAI_DISABLE_GALLERY_ENDPOINT, $DISABLE_GALLERY_ENDPOINT
--disable-metrics-endpointfalseDisable the /metrics endpoint$LOCALAI_DISABLE_METRICS_ENDPOINT, $DISABLE_METRICS_ENDPOINT
--machine-tagIf not empty, add that string to Machine-Tag header in each response. Useful to track response from different machines using multiple P2P federated nodes$LOCALAI_MACHINE_TAG, $MACHINE_TAG

Hardening Flags

ParameterDefaultDescriptionEnvironment Variable
--disable-predownload-scanfalseIf true, disables the best-effort security scanner before downloading any files$LOCALAI_DISABLE_PREDOWNLOAD_SCAN
--opaque-errorsfalseIf true, all error responses are replaced with blank 500 errors. This is intended only for hardening against information leaks and is normally not recommended$LOCALAI_OPAQUE_ERRORS
--use-subtle-key-comparisonfalseIf true, API Key validation comparisons will be performed using constant-time comparisons rather than simple equality. This trades off performance on each request for resilience against timing attacks$LOCALAI_SUBTLE_KEY_COMPARISON
--disable-api-key-requirement-for-http-getfalseIf true, a valid API key is not required to issue GET requests to portions of the web UI. This should only be enabled in secure testing environments$LOCALAI_DISABLE_API_KEY_REQUIREMENT_FOR_HTTP_GET
--http-get-exempted-endpoints^/$,^/browse/?$,^/talk/?$,^/p2p/?$,^/chat/?$,^/image/?$,^/text2image/?$,^/tts/?$,^/static/.*$,^/swagger.*$If --disable-api-key-requirement-for-http-get is overridden to true, this is the list of endpoints to exempt. Only adjust this in case of a security incident or as a result of a personal security posture review$LOCALAI_HTTP_GET_EXEMPTED_ENDPOINTS

P2P Flags

ParameterDefaultDescriptionEnvironment Variable
--p2pfalseEnable P2P mode$LOCALAI_P2P, $P2P
--p2p-dht-interval360Interval for DHT refresh (used during token generation)$LOCALAI_P2P_DHT_INTERVAL, $P2P_DHT_INTERVAL
--p2p-otp-interval9000Interval for OTP refresh (used during token generation)$LOCALAI_P2P_OTP_INTERVAL, $P2P_OTP_INTERVAL
--p2ptokenToken for P2P mode (optional)$LOCALAI_P2P_TOKEN, $P2P_TOKEN, $TOKEN
--p2p-network-idNetwork ID for P2P mode, can be set arbitrarily by the user for grouping a set of instances$LOCALAI_P2P_NETWORK_ID, $P2P_NETWORK_ID
--federatedfalseEnable federated instance$LOCALAI_FEDERATED, $FEDERATED

Other Commands

LocalAI supports several subcommands beyond run:

  • local-ai models - Manage LocalAI models and definitions
  • local-ai backends - Manage LocalAI backends and definitions
  • local-ai tts - Convert text to speech
  • local-ai sound-generation - Generate audio files from text or audio
  • local-ai transcript - Convert audio to text
  • local-ai worker - Run workers to distribute workload (llama.cpp-only)
  • local-ai util - Utility commands
  • local-ai explorer - Run P2P explorer
  • local-ai federated - Run LocalAI in federated mode

Use local-ai <command> --help for more information on each command.

Examples

Basic Usage

./local-ai run

./local-ai run --models-path /path/to/models --address :9090

./local-ai run --f16

Environment Variables

export LOCALAI_MODELS_PATH=/path/to/models
export LOCALAI_ADDRESS=:9090
export LOCALAI_F16=true
./local-ai run

Advanced Configuration

./local-ai run \
  --models model1.yaml model2.yaml \
  --enable-watchdog-idle \
  --watchdog-idle-timeout=10m \
  --p2p \
  --federated

API Error Reference

This page documents the error responses returned by the LocalAI API. LocalAI supports multiple API formats (OpenAI, Anthropic, Open Responses), each with its own error structure.

Error Response Formats

OpenAI-Compatible Format

Most endpoints return errors using the OpenAI-compatible format:

{
  "error": {
    "code": 400,
    "message": "A human-readable description of the error",
    "type": "invalid_request_error",
    "param": null
  }
}
FieldTypeDescription
codeinteger|stringHTTP status code or error code string
messagestringHuman-readable error description
typestringError category (e.g., invalid_request_error)
paramstring|nullThe parameter that caused the error, if applicable

This format is used by: /v1/chat/completions, /v1/completions, /v1/embeddings, /v1/images/generations, /v1/audio/transcriptions, /models, and other OpenAI-compatible endpoints.

Anthropic Format

The /v1/messages endpoint returns errors in Anthropic’s format:

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "A human-readable description of the error"
  }
}
FieldTypeDescription
typestringAlways "error" for error responses
error.typestringinvalid_request_error or api_error
error.messagestringHuman-readable error description

Open Responses Format

The /v1/responses endpoint returns errors with this structure:

{
  "error": {
    "type": "invalid_request",
    "message": "A human-readable description of the error",
    "code": "",
    "param": "parameter_name"
  }
}
FieldTypeDescription
typestringOne of: invalid_request, not_found, server_error, model_error, invalid_request_error
messagestringHuman-readable error description
codestringOptional error code
paramstringThe parameter that caused the error, if applicable

HTTP Status Codes

CodeMeaningWhen It Occurs
400Bad RequestInvalid input, missing required fields, malformed JSON
401UnauthorizedMissing or invalid API key
404Not FoundModel or resource does not exist
409ConflictResource already exists (e.g., duplicate token)
422Unprocessable EntityValidation failed (e.g., invalid parameter range)
500Internal Server ErrorBackend inference failure, unexpected server errors

Global Error Handling

Authentication Errors (401)

When API keys are configured (via LOCALAI_API_KEY or --api-keys), all requests must include a valid key. Keys can be provided through:

  • Authorization: Bearer <key> header
  • x-api-key: <key> header
  • xi-api-key: <key> header
  • token cookie

Example request without a key:

curl http://localhost:8080/v1/models \
  -H "Content-Type: application/json"

Error response:

{
  "error": {
    "code": 401,
    "message": "An authentication key is required",
    "type": "invalid_request_error"
  }
}

The response also includes the header WWW-Authenticate: Bearer.

Request Parsing Errors (400)

All endpoints return a 400 error if the request body cannot be parsed:

{
  "error": {
    "code": 400,
    "message": "failed parsing request body: <details>",
    "type": ""
  }
}

Not Found (404)

Requests to undefined routes return:

{
  "error": {
    "code": 404,
    "message": "Resource not found"
  }
}

Opaque Errors Mode

When LOCALAI_OPAQUE_ERRORS=true is set, all error responses return an empty body with only the HTTP status code. This is a security hardening option that prevents information leaks.

Per-Endpoint Error Scenarios

Chat Completions β€” POST /v1/chat/completions

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error
# Missing model field
curl http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "hello"}]}'

See also: Text Generation

Completions β€” POST /v1/completions

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
500Backend inference failureInternal Server Error

Embeddings β€” POST /v1/embeddings

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error

See also: Embeddings

Image Generation β€” POST /v1/images/generations

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error

See also: Image Generation

Image Editing (Inpainting) β€” POST /v1/images/edits

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Missing image filemissing image file
400Missing mask filemissing mask file
500Storage preparation failurefailed to prepare storage

Audio Transcription β€” POST /v1/audio/transcriptions

StatusCauseExample Message
400Missing file field in form dataBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error

See also: Audio to Text

Text to Speech β€” POST /v1/audio/speech, POST /tts

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error

See also: Text to Audio

ElevenLabs TTS β€” POST /v1/text-to-speech/:voice-id

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error

ElevenLabs Sound Generation β€” POST /v1/sound-generation

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error

Reranking β€” POST /v1/rerank, POST /jina/v1/rerank

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
422top_n less than 1top_n - should be greater than or equal to 1
500Backend inference failureInternal Server Error

See also: Reranker

Anthropic Messages β€” POST /v1/messages

StatusCauseError TypeExample Message
400Missing model fieldinvalid_request_errormodel is required
400Model not in configurationinvalid_request_errormodel configuration not found
400Missing or invalid max_tokensinvalid_request_errormax_tokens is required and must be greater than 0
500Backend inference failureapi_errormodel inference failed: <details>
500Prediction failureapi_errorprediction failed: <details>
# Missing model field
curl http://localhost:8080/v1/messages \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "hello"}], "max_tokens": 100}'
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "model is required"
  }
}

Open Responses β€” POST /v1/responses

StatusCauseError TypeExample Message
400Missing model fieldinvalid_requestmodel is required
400Model not in configurationinvalid_requestmodel configuration not found
400Failed to parse inputinvalid_requestfailed to parse input: <details>
400background=true without store=trueinvalid_request_errorbackground=true requires store=true
404Previous response not foundnot_foundprevious response not found: <id>
500Backend inference failuremodel_errormodel inference failed: <details>
500Prediction failuremodel_errorprediction failed: <details>
500Tool execution failuremodel_errorfailed to execute tools: <details>
500MCP configuration errorserver_errorfailed to get MCP config: <details>
500No MCP servers availableserver_errorno working MCP servers found
# Missing model field
curl http://localhost:8080/v1/responses \
  -H "Content-Type: application/json" \
  -d '{"input": "hello"}'
{
  "error": {
    "type": "invalid_request",
    "message": "model is required",
    "code": "",
    "param": ""
  }
}

Open Responses β€” GET /v1/responses/:id

StatusCauseError TypeExample Message
400Missing response IDinvalid_request_errorresponse ID is required
404Response not foundnot_foundresponse not found: <id>

Open Responses Events β€” GET /v1/responses/:id/events

StatusCauseError TypeExample Message
400Missing response IDinvalid_request_errorresponse ID is required
400Response was not created with streaminvalid_request_errorcannot stream a response that was not created with stream=true
400Invalid starting_after valueinvalid_request_errorstarting_after must be an integer
404Response not foundnot_foundresponse not found: <id>
500Failed to retrieve eventsserver_errorfailed to get events: <details>

Object Detection β€” POST /v1/detection

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error

See also: Object Detection

Video Generation β€” POST /v1/video/generations

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error

Voice Activity Detection β€” POST /v1/audio/vad

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request
500Backend inference failureInternal Server Error

Tokenize β€” POST /v1/tokenize

StatusCauseExample Message
400Invalid or malformed request bodyBad Request
400Model not found in configurationBad Request

Models β€” GET /v1/models, GET /models

StatusCauseExample Message
500Failed to list modelsInternal Server Error

See also: Model Gallery

Handling Errors in Client Code

Python (OpenAI SDK)

from openai import OpenAI, APIError

client = OpenAI(base_url="http://localhost:8080/v1", api_key="your-key")

try:
    response = client.chat.completions.create(
        model="my-model",
        messages=[{"role": "user", "content": "hello"}],
    )
except APIError as e:
    print(f"Status: {e.status_code}, Message: {e.message}")

curl

# Check HTTP status code
response=$(curl -s -w "\n%{http_code}" http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "nonexistent", "messages": [{"role": "user", "content": "hi"}]}')

http_code=$(echo "$response" | tail -1)
body=$(echo "$response" | head -1)

if [ "$http_code" -ne 200 ]; then
  echo "Error $http_code: $body"
fi
Environment VariableDescription
LOCALAI_API_KEYComma-separated list of valid API keys
LOCALAI_OPAQUE_ERRORSSet to true to hide error details (returns empty body with status code only)
LOCALAI_SUBTLEKEY_COMPARISONUse constant-time key comparison for timing-attack resistance

LocalAI binaries

LocalAI binaries are available for both Linux and MacOS platforms and can be executed directly from your command line. These binaries are continuously updated and hosted on our GitHub Releases page. This method also supports Windows users via the Windows Subsystem for Linux (WSL).

macOS Download

You can download the DMG and install the application:

Download LocalAI for macOS

Note: the DMGs are not signed by Apple as quarantined. See https://github.com/mudler/LocalAI/issues/6268 for a workaround, fix is tracked here: https://github.com/mudler/LocalAI/issues/6244

Otherwise, use the following one-liner command in your terminal to download and run LocalAI on Linux or MacOS:

curl -Lo local-ai "https://github.com/mudler/LocalAI/releases/download/v3.12.1/local-ai-$(uname -s)-$(uname -m)" && chmod +x local-ai && ./local-ai

Otherwise, here are the links to the binaries:

OSLink
Linux (amd64)Download
Linux (arm64)Download
MacOS (arm64)Download
Details

Binaries do have limited support compared to container images:

  • Python-based backends are not shipped with binaries (e.g. diffusers or transformers)
  • MacOS binaries and Linux-arm64 do not ship TTS nor stablediffusion-cpp backends
  • Linux binaries do not ship stablediffusion-cpp backend

Running on Nvidia ARM64

LocalAI can be run on Nvidia ARM64 devices, such as the Jetson Nano, Jetson Xavier NX, Jetson AGX Orin, and Nvidia DGX Spark. The following instructions will guide you through building and using the LocalAI container for Nvidia ARM64 devices.

Platform Compatibility

  • CUDA 12 L4T images: Compatible with Nvidia AGX Orin and similar platforms (Jetson Nano, Jetson Xavier NX, Jetson AGX Xavier)
  • CUDA 13 L4T images: Compatible with Nvidia DGX Spark

Prerequisites

Pre-built Images

Pre-built images are available on quay.io and dockerhub:

CUDA 12 (for AGX Orin and similar platforms)

docker pull quay.io/go-skynet/local-ai:latest-nvidia-l4t-arm64
# or
docker pull localai/localai:latest-nvidia-l4t-arm64

CUDA 13 (for DGX Spark)

docker pull quay.io/go-skynet/local-ai:latest-nvidia-l4t-arm64-cuda-13
# or
docker pull localai/localai:latest-nvidia-l4t-arm64-cuda-13

Build the container

If you need to build the container yourself, use the following commands:

CUDA 12 (for AGX Orin and similar platforms)

git clone https://github.com/mudler/LocalAI

cd LocalAI

docker build --build-arg SKIP_DRIVERS=true --build-arg BUILD_TYPE=cublas --build-arg BASE_IMAGE=nvcr.io/nvidia/l4t-jetpack:r36.4.0 --build-arg IMAGE_TYPE=core -t quay.io/go-skynet/local-ai:master-nvidia-l4t-arm64-core .

CUDA 13 (for DGX Spark)

git clone https://github.com/mudler/LocalAI

cd LocalAI

docker build --build-arg SKIP_DRIVERS=false --build-arg BUILD_TYPE=cublas --build-arg CUDA_MAJOR_VERSION=13 --build-arg CUDA_MINOR_VERSION=0 --build-arg BASE_IMAGE=ubuntu:24.04 --build-arg IMAGE_TYPE=core -t quay.io/go-skynet/local-ai:master-nvidia-l4t-arm64-cuda-13-core .

Usage

Run the LocalAI container on Nvidia ARM64 devices using the following commands, where /data/models is the directory containing the models:

CUDA 12 (for AGX Orin and similar platforms)

docker run -e DEBUG=true -p 8080:8080 -v /data/models:/models -ti --restart=always --name local-ai --runtime nvidia --gpus all quay.io/go-skynet/local-ai:latest-nvidia-l4t-arm64

CUDA 13 (for DGX Spark)

docker run -e DEBUG=true -p 8080:8080 -v /data/models:/models -ti --restart=always --name local-ai --runtime nvidia --gpus all quay.io/go-skynet/local-ai:latest-nvidia-l4t-arm64-cuda-13

Note: /data/models is the directory containing the models. You can replace it with the directory containing your models.