Skip to main content

Local AI inference made easy - LLM, Vision, TTS, STT, and Image Generation

Project description

ezlocalai

GitHub Dockerhub

ezlocalai is an easy set up artificial intelligence server that allows you to easily run multimodal artificial intelligence from your computer. It is designed to be as easy as possible to get started with running local models. It automatically handles downloading the model of your choice and configuring the server based on your CPU, RAM, and GPU specifications. It also includes OpenAI Style endpoints for easy integration with other applications using ezlocalai as an OpenAI API proxy with any model. Additional functionality is built in for voice cloning text to speech and a voice to text for easy voice communication as well as image generation entirely offline after the initial setup.

Prerequisites

Note: If using the CLI (pip install ezlocalai), prerequisites are auto-installed on Linux. Skip to Quick Start.

Additional Linux Prerequisites

Quick Start (Recommended)

Install the CLI and start ezlocalai with a single command:

pip install ezlocalai
ezlocalai start

That's it! The CLI will:

  • Auto-detect your GPU (NVIDIA) or fall back to CPU mode
  • Install Docker if not present (Linux only)
  • Install NVIDIA Container Toolkit if needed (Linux only)
  • Pull and start the appropriate container
  • Download models automatically on first run

CLI Commands

# Start with defaults (auto-detects GPU, uses Qwen3-VL-4B)
ezlocalai start

# Start with a specific model
ezlocalai start --model unsloth/gemma-3-4b-it-GGUF

# Start with custom options
ezlocalai start --model unsloth/Qwen3-VL-4B-Instruct-GGUF \
                --uri http://localhost:8091 \
                --api-key my-secret-key \
                --ngrok <your-ngrok-token>

# Other commands
ezlocalai stop      # Stop the container
ezlocalai restart   # Restart the container
ezlocalai status    # Check if running and show configuration
ezlocalai logs      # Show container logs (use -f to follow)
ezlocalai update    # Pull/rebuild latest images

Data Persistence

All data is stored in ~/.ezlocalai/:

Directory Contents
~/.ezlocalai/data/models/ Downloaded GGUF model files
~/.ezlocalai/data/hf/ HuggingFace cache
~/.ezlocalai/data/voices/ Voice cloning samples
~/.ezlocalai/data/outputs/ Generated images/audio
~/.ezlocalai/.env Your configuration

Models persist across container updates - you won't re-download them when updating the CLI or rebuilding the CUDA image.

CLI Options

Option Default Description
--model, -m unsloth/Qwen3-VL-4B-Instruct-GGUF HuggingFace GGUF model(s), comma-separated
--uri http://localhost:8091 Server URL
--api-key None API key for authentication
--ngrok None ngrok token for public URL

For additional options (Whisper, image model, etc.), edit ~/.ezlocalai/.env:

# Example .env configuration
DEFAULT_MODEL="unsloth/Qwen3-VL-4B-Instruct-GGUF"
WHISPER_MODEL="base"           # Speech-to-text (empty to disable)
IMG_MODEL=""                   # Image generation (empty to disable)
EZLOCALAI_API_KEY=""           # API authentication

Manual Installation

If you prefer manual setup or need more control:

git clone https://github.com/DevXT-LLC/ezlocalai
cd ezlocalai

Environment Setup

Expand Environment Setup if you would like to modify the default environment variables, otherwise skip to Usage. All environment variables are optional and have useful defaults. Change the default model that starts with ezlocalai in your .env file.

Environment Setup (Optional)

None of the values need modified in order to run the server. If you are using an NVIDIA GPU, I would recommend setting the GPU_LAYERS and MAIN_GPU environment variables. If you have multiple GPUs, especially different ones, you should set TENSOR_SPLIT to reflect the desired load balance (comma separated decimals totalling 1). If you plan to expose the server to the internet, I would recommend setting the EZLOCALAI_API_KEY environment variable for security. THREADS is set to your CPU thread count minus 2 by default, if this causes significant performance issues, consider setting the THREADS environment variable manually to a lower number.

Modify the .env file to your desired settings. Assumptions will be made on all of these values if you choose to accept the defaults.

Replace the environment variables with your desired settings. Assumptions will be made on all of these values if you choose to accept the defaults.

  • EZLOCALAI_URL - The URL to use for the server. Default is http://localhost:8091.
  • EZLOCALAI_API_KEY - The API key to use for the server. If not set, the server will not require an API key when accepting requests.
  • NGROK_TOKEN - The ngrok token to use for the server. If not set, ngrok will not be used. Using ngrok will allow you to expose your ezlocalai server to the public with as simple as an API key. Get your free NGROK_TOKEN here.
  • DEFAULT_MODEL - The default model(s) to load. Comma-separated list of HuggingFace model paths. First model loads at startup, others swap on demand. Default is unsloth/Qwen3-VL-4B-Instruct-GGUF.
  • WHISPER_MODEL - The model to use for speech-to-text. Default is base.en.
  • AUTO_UPDATE - Whether or not to automatically update ezlocalai. Default is true.
  • THREADS - The number of CPU threads ezlocalai is allowed to use. Default is 4.
  • MAIN_GPU (Only applicable to NVIDIA GPU) - The GPU to use for the language model. Default is 0.
  • TENSOR_SPLIT (Only applicable with multiple CUDA GPUs) - The allocation to each device in CSV format.
  • IMG_MODEL - The image generation model to use. Leave empty to disable image generation. Example: ByteDance/SDXL-Lightning.

Auto-configured (no env vars needed):

  • VRAM Budget - Automatically detected from GPU
  • GPU Layers - Auto-calibrated based on VRAM budget
  • Context Size - Dynamic, rounds up to nearest 32k based on prompt size
  • Image Device - Auto-detects CUDA availability
  • Vision - Handled by main LLM if it has mmproj (e.g., Qwen3-VL models)

Usage

NVIDIA GPU

docker-compose -f docker-compose-cuda.yml down
docker-compose -f docker-compose-cuda.yml build
docker-compose -f docker-compose-cuda.yml up

CPU

docker-compose down
docker-compose build
docker-compose up

Benchmarks

Performance tested on Intel i9-12900KS + RTX 4090 (24GB):

Model Size Speed Notes
Qwen3-VL-4B 4B ~210 tok/s Vision-capable, great for chat
Qwen3-Coder-30B 30B (MoE) ~65 tok/s Coding model, hot-swappable

Both models pre-calibrate at startup and hot-swap in ~1 second.

OpenAI Style Endpoint Usage

OpenAI Style endpoints available at http://<YOUR LOCAL IP ADDRESS>:8091/v1/ by default. Documentation can be accessed at that http://localhost:8091 when the server is running.

For examples on how to use the server to communicate with the models, see the Examples Jupyter Notebook once the server is running. We also have an example to use in Google Colab.

Demo UI

You can access the basic demo UI at http://localhost:8502, or your local IP address with port 8502.

Workflow

graph TD
   A[app.py] --> B[FASTAPI]
   B --> C[Pipes]
   C --> D[LLM]
   C --> E[STT]
   C --> F[CTTS]
   C --> G[IMG]
   D --> H[llama_cpp]
   D --> I[tiktoken]
   D --> J[torch]
   E --> K[faster_whisper]
   E --> L[pyaudio]
   E --> M[webrtcvad]
   E --> N[pydub]
   F --> O[TTS]
   F --> P[torchaudio]
   G --> Q[diffusers]
   Q --> J
   A --> R[Uvicorn]
   R --> S[ASGI Server]
   A --> T[API Endpoint: /v1/completions]
   T --> U[Pipes.get_response]
   U --> V{completion_type}
   V -->|completion| W[LLM.completion]
   V -->|chat| X[LLM.chat]
   X --> Y[LLM.generate]
   W --> Y
   Y --> Z[LLM.create_completion]
   Z --> AA[Return response]
   AA --> AB{stream}
   AB -->|True| AC[StreamingResponse]
   AB -->|False| AD[JSON response]
   U --> AE[Audio transcription]
   AE --> AF{audio_format}
   AF -->|Exists| AG[Transcribe audio]
   AG --> E
   AF -->|None| AH[Skip transcription]
   U --> AI[Audio generation]
   AI --> AJ{voice}
   AJ -->|Exists| AK[Generate audio]
   AK --> F
   AK --> AL{stream}
   AL -->|True| AM[StreamingResponse]
   AL -->|False| AN[JSON response with audio URL]
   AJ -->|None| AO[Skip audio generation]
   U --> AP[Image generation]
   AP --> AQ{IMG enabled}
   AQ -->|True| AR[Generate image]
   AR --> G
   AR --> AS[Append image URL to response]
   AQ -->|False| AT[Skip image generation]
   A --> AU[API Endpoint: /v1/chat/completions]
   AU --> U
   A --> AV[API Endpoint: /v1/embeddings]
   AV --> AW[LLM.embedding]
   AW --> AX[LLM.create_embedding]
   AX --> AY[Return embedding]
   A --> AZ[API Endpoint: /v1/audio/transcriptions]
   AZ --> BA[STT.transcribe_audio]
   BA --> BB[Return transcription]
   A --> BC[API Endpoint: /v1/audio/generation]
   BC --> BD[CTTS.generate]
   BD --> BE[Return audio URL or base64 audio]
   A --> BF[API Endpoint: /v1/models]
   BF --> BG[LLM.models]
   BG --> BH[Return available models]
   A --> BI[CORS Middleware]
   BJ[.env] --> BK[Environment Variables]
   BK --> A
   BL[setup.py] --> BM[ezlocalai package]
   BM --> BN[LLM]
   BM --> BO[STT]
   BM --> BP[CTTS]
   BM --> BQ[IMG]
   A --> BR[API Key Verification]
   BR --> BS[verify_api_key]
   A --> BT[Static Files]
   BT --> BU[API Endpoint: /outputs]
   A --> BV[Ngrok]
   BV --> BW[Public URL]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezlocalai-1.0.0.tar.gz (190.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezlocalai-1.0.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file ezlocalai-1.0.0.tar.gz.

File metadata

  • Download URL: ezlocalai-1.0.0.tar.gz
  • Upload date:
  • Size: 190.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ezlocalai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ab0777f61d12298fc4b16cf900131952a9ece48c1c8b1ff721b5be0e788f2213
MD5 d93ee44692630534ce0848f5d88158b4
BLAKE2b-256 5c41bbedd78e926e0a23f8b9a0134cebcf357534f09113725796ef9e59bc1794

See more details on using hashes here.

File details

Details for the file ezlocalai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ezlocalai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ezlocalai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49843720cf45b53eae5f4992026f919ca9a25e9a28dae3668360fdebdab854cc
MD5 75948e74d1f7130d3d94607f3f0cf111
BLAKE2b-256 b16b0688de38c5de6804f8fd9c32de929eb86e63608de67d7cc832d026586cbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page