LocalAI
Self-hosted OpenAI-compatible API with LocalAI on Clore.ai
Run a self-hosted OpenAI-compatible API with LocalAI.
All examples can be run on GPU servers rented through CLORE.AI Marketplace.
Server Requirements
RAM
8GB
16GB+
VRAM
6GB
8GB+
Network
200Mbps
500Mbps+
Startup Time
5-10 minutes
-
Important: LocalAI takes 5-10 minutes to fully initialize on first startup. HTTP 502 during this time is normal - the service is downloading and loading models.
What is LocalAI?
LocalAI provides:
Drop-in OpenAI API replacement
Support for multiple model formats
Text, image, audio, and embedding generation
No GPU required (but faster with GPU)
Supported Models
LLM
GGUF, GGML
Llama, Mistral, Phi
Embeddings
GGUF
all-MiniLM, BGE
Images
Diffusers
SD 1.5, SDXL
Audio
Whisper
Speech-to-text
TTS
Piper, Bark
Text-to-speech
Quick Deploy
Docker Image:
Ports:
No command needed - server starts automatically.
Verify It's Working
After deployment, find your http_pub URL in My Orders and test:
If you get HTTP 502, wait 5-10 minutes - LocalAI takes longer to initialize than other services.
Pre-Built Models
LocalAI comes with several models available out of the box:
gpt-4
Chat
General-purpose LLM
gpt-4o
Chat
General-purpose LLM
gpt-4o-mini
Chat
Smaller, faster LLM
whisper-1
STT
Speech-to-text
tts-1
TTS
Text-to-speech
text-embedding-ada-002
Embeddings
384-dimensional vectors
jina-reranker-v1-base-en
Reranking
Document reranking
Accessing Your Service
When deployed on CLORE.AI, access LocalAI via the http_pub URL:
Docker Deploy (Alternative)
Download Models
From Model Gallery
LocalAI has a built-in model gallery:
From Hugging Face
Model Configuration
Create YAML config for each model:
models/llama-3.1-8b.yaml:
API Usage
Chat Completions (OpenAI Compatible)
Streaming
Embeddings
Image Generation
cURL Examples
Chat
Embeddings
Response:
Text-to-Speech (TTS)
Available voices: alloy, echo, fable, onyx, nova, shimmer
Speech-to-Text (STT)
Response:
Reranking
Rerank documents by relevance to a query:
Response:
Complete API Reference
Standard Endpoints (OpenAI Compatible)
/v1/models
GET
List available models
/v1/chat/completions
POST
Chat completion
/v1/completions
POST
Text completion
/v1/embeddings
POST
Generate embeddings
/v1/audio/speech
POST
Text-to-speech
/v1/audio/transcriptions
POST
Speech-to-text
/v1/images/generations
POST
Image generation
Additional Endpoints
/readyz
GET
Readiness check
/healthz
GET
Health check
/version
GET
Get LocalAI version
/v1/rerank
POST
Document reranking
/models/available
GET
List gallery models
/models/apply
POST
Install model from gallery
/swagger/
GET
Swagger UI documentation
/metrics
GET
Prometheus metrics
Get Version
Response:
Swagger Documentation
Open in browser for interactive API documentation:
GPU Acceleration
CUDA Backend
Full GPU Offload
Multiple Models
LocalAI can serve multiple models simultaneously:
Access each via model name in API calls.
Performance Tuning
For Speed
For Memory
Benchmarks
Llama 3.1 8B Q4
RTX 3090
~100
Mistral 7B Q4
RTX 3090
~110
Llama 3.1 8B Q4
RTX 4090
~140
Mixtral 8x7B Q4
A100
~60
Benchmarks updated January 2026.
Troubleshooting
HTTP 502 on http_pub URL
LocalAI takes longer to start than other services. Wait 5-10 minutes and retry:
Model Not Loading
Check file path in YAML
Verify GGUF format compatibility
Check available VRAM
Slow Responses
Increase
gpu_layersEnable
use_mmapReduce
context_size
Out of Memory
Reduce
gpu_layersUse smaller quantization (Q4 instead of Q8)
Reduce batch size
Image Generation Issues
Stable Diffusion may have CUDA compatibility issues on some GPU configurations. If you encounter CUDA errors with image generation, consider using a dedicated Stable Diffusion image instead.
Cost Estimate
Typical CLORE.AI marketplace rates:
RTX 3060
12GB
$0.15–0.30
7B models
RTX 3090
24GB
$0.30–1.00
13B models
RTX 4090
24GB
$0.50–2.00
Fast inference
A100
40GB
$1.50–3.00
Large models
Prices in USD/day. Rates vary by provider — check CLORE.AI Marketplace for current rates.
Next Steps
vLLM Inference - Higher throughput
Ollama Guide - Simpler setup
RAG with LangChain - Build applications
Last updated
Was this helpful?