Skip to content

Latest commit

ย 

History

56 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

LocalAI+ ๐Ÿš€

OpenAI-Compatible API for Local LLMs

LocalAI+ is a comprehensive platform that wraps local LLMs with missing capabilities found in cloud APIs. It provides an OpenAI-compatible interface with advanced features like function calling, embeddings, code interpretation, and a plugin system.

Screenshot 2025-06-21 230553 Screenshot 2025-06-30 212433

โœจ Features

  • ๐Ÿ”„ OpenAI-Compatible API - Drop-in replacement for OpenAI's API
  • ๐Ÿ› ๏ธ Function Calling - Structured tool use with JSON schemas
  • ๐Ÿ” Embeddings & RAG - Vector search with Qdrant integration
  • ๐Ÿ Code Interpreter - Secure Python execution sandbox
  • ๐Ÿ”Œ Plugin System - Extensible architecture for custom tools
  • ๐Ÿ”’ Enterprise Security - API keys, rate limiting, input sanitization
  • ๐Ÿ“Š Comprehensive Logging - Structured logging with metrics
  • ๐ŸŽฏ Developer Experience - Interactive playground, full documentation
  • ๐Ÿ–ฅ๏ธ Web Interface - Modern React frontend with dashboard and management tools

๐Ÿš€ Quick Start

Prerequisites

  • Docker and Docker Compose
  • Ollama installed and running
  • A local model (e.g., ollama pull mistral:latest)

Installation

  1. Clone the repository

    git clone https://github.com/Eamateli/LocalAI-Plus/tree/main
    cd localai-plus
  2. Start with Docker Compose

    docker-compose up -d
  3. Test the API

    curl -X POST "http://localhost:8000/v1/chat/completions" \
      -H "Authorization: Bearer test-key-12345" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "mistral:latest",
        "messages": [
          {"role": "user", "content": "Hello!"}
        ]
      }'
  4. Access the Web Interface

๐ŸŽฏ Web Interface Features

๐Ÿ  Dashboard

  • Real-time system metrics (CPU, memory, disk usage)
  • API request statistics and activity monitoring
  • Service health status and uptime tracking
  • Recent activity feed with detailed logs

๐Ÿค– Model Manager

  • View and manage installed models
  • Start/stop models with one click
  • Download new models from Ollama registry
  • Monitor model status and resource usage
  • Model performance metrics

๐Ÿ”Œ Plugin Manager

  • Install and manage plugins
  • Enable/disable plugins dynamically
  • Browse available plugins from registry
  • Create custom plugins with built-in editor
  • Plugin function testing and debugging

๐ŸŽฎ API Playground

  • Interactive testing of all API endpoints
  • Real-time request/response visualization
  • Syntax highlighting for JSON
  • Copy requests as cURL commands
  • Support for all LocalAI+ features (chat, embeddings, tools, code execution)

๐Ÿ“š Documentation

  • Complete API reference with examples
  • Step-by-step setup guides
  • Plugin development tutorials
  • Configuration options reference

๐Ÿ“– API Reference

Chat Completions

POST /v1/chat/completions

OpenAI-compatible chat completions with support for:

  • Multi-turn conversations
  • Function calling with tools
  • Streaming responses
  • Temperature and token control

Embeddings

POST /v1/embeddings

Generate vector embeddings for text input:

{
  "input": ["Hello world", "LocalAI+ is awesome"],
  "model": "nomic-embed-text"
}

Function Calling

Enable your models to use tools:

{
  "model": "mistral:latest",
  "messages": [{"role": "user", "content": "What's 2+2 and the weather in NYC?"}],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "calculator",
        "description": "Perform calculations",
        "parameters": {
          "type": "object",
          "properties": {
            "expression": {"type": "string"}
          }
        }
      }
    }
  ]
}

Code Interpreter

POST /v1/code/execute

Execute Python code securely:

{
  "code": "print('Hello from Python!')\nresult = 2 + 2\nprint(f'2 + 2 = {result}')",
  "language": "python"
}

๐Ÿ”ง Configuration

Configure LocalAI+ using environment variables:

# Ollama Configuration
OLLAMA_BASE_URL=http://localhost:11434
DEFAULT_MODEL=mistral:latest

# Security
API_KEYS=your-api-key-1,your-api-key-2
SECRET_KEY=your-secret-key

# Vector Store
QDRANT_HOST=localhost
QDRANT_PORT=6333

# Code Interpreter
ENABLE_CODE_EXECUTION=true
CODE_TIMEOUT=30
CODE_MEMORY_LIMIT=128

# Database
DATABASE_URL=sqlite:///./localai.db

๐Ÿ”Œ Plugin Development

Create custom tools by developing plugins:

# plugins/weather_plugin.py
PLUGIN_INFO = {
    "name": "weather",
    "version": "1.0.0",
    "description": "Get weather information",
    "functions": [
        {
            "name": "get_weather",
            "description": "Get current weather for a location",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {"type": "string"}
                },
                "required": ["location"]
            }
        }
    ]
}

async def get_weather(arguments):
    location = arguments.get("location")
    # Your weather API integration here
    return {"location": location, "temperature": "22ยฐC"}

๐Ÿ”’ Security Features

  • API Key Authentication - Secure your endpoints
  • Code Sandboxing - Isolated Python execution
  • Input Sanitization - Prevent injection attacks
  • Resource Limits - CPU, memory, and timeout controls
  • Rate Limiting - Prevent abuse
  • Comprehensive Logging - Track all operations

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Frontend      โ”‚    โ”‚   LocalAI+      โ”‚    โ”‚     Ollama      โ”‚
โ”‚   (React)       โ”‚โ—„โ”€โ”€โ–บโ”‚   (FastAPI)     โ”‚โ—„โ”€โ”€โ–บโ”‚   (LLM Host)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
                                โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚     Qdrant      โ”‚
                       โ”‚ (Vector Store)  โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงช Development

Backend Development

cd backend
pip install -r requirements.txt
python -m uvicorn main:app --reload

Frontend Development

npm install
npm run dev

Running Tests

cd backend
pytest

๐Ÿ“Š Monitoring

LocalAI+ includes comprehensive monitoring:

  • Health Checks - /health endpoint
  • Metrics - Prometheus-compatible metrics
  • Structured Logging - JSON logs with correlation IDs
  • Usage Tracking - API usage statistics
  • Real-time Dashboard - Web-based monitoring interface

๐Ÿ› ๏ธ Built-in Tools

LocalAI+ comes with several built-in tools:

  • Calculator - Mathematical expressions and calculations
  • Weather - Weather information (mock implementation)
  • Web Search - Search functionality (mock implementation)
  • Code Interpreter - Secure Python code execution

๐ŸŒ Frontend Technology Stack

  • React 18 - Modern React with hooks
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Framer Motion - Smooth animations
  • React Router - Client-side routing
  • React Hot Toast - Beautiful notifications
  • Syntax Highlighter - Code highlighting
  • Lucide React - Beautiful icons

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

๐Ÿ“„ License

LocalAI+ is open source software licensed under the MIT License.

๐Ÿ™ Acknowledgments

  • Ollama - Local LLM runtime
  • Qdrant - Vector database
  • FastAPI - Modern Python web framework
  • React - Frontend framework
  • OpenAI - API design inspiration

๐Ÿ†˜ Support


Made with โค๏ธ for the AI community

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages