A local, privacy-first AI model runner with gRPC and REST APIs.
- Clone the repository:
git clone https://github.com/Egregore-co/ai-local-plugin.git cd ai-local-plugin
- Run the installer:
install.bat
- Create and activate a virtual environment:
python -m venv .venv .venv\Scripts\activate - Install dependencies:
pip install -r requirements.txt - Start the server:
python -m src.main
If you encounter issues with PowerShell or curl on Windows (such as JSON decode errors), you can use Postman to test the API endpoints easily:
How to test endpoints with Postman:
- Open Postman and click New > HTTP Request.
- Set the request type to POST.
- Enter the URL:
http://localhost:8000/v1/completions - Go to the Headers tab and add:
- Key:
Content-TypeValue:application/json
- Key:
- Go to the Body tab, select raw, and choose JSON from the dropdown.
- Paste the following JSON:
{ "model": "llama2-7b-chat", "prompt": "Hello" } - Click Send.
- You should receive a JSON response with a completion result or a mock response if the model is not running.
- Open Postman and click New > HTTP Request.
- Set the request type to POST.
- Enter the URL:
http://localhost:8000/v1/chat/completions - Go to the Headers tab and add:
- Key:
Content-TypeValue:application/json
- Key:
- Go to the Body tab, select raw, and choose JSON from the dropdown.
- Paste the following JSON:
{ "model": "llama2-7b-chat", "messages": [ {"role": "user", "content": "Hi"} ] } - Click Send.
- You should receive a JSON response with a chat completion result or a mock response if the model is not running.
- Open Postman and click New > HTTP Request.
- Set the request type to GET.
- Enter the URL:
http://localhost:8000/v1/models - Click Send.
- You should receive a JSON response listing all available models.
Note: If you see errors about JSON decoding or content length when using PowerShell, this is a shell quoting issue. Postman avoids these problems.
Invoke-RestMethod -Uri "http://localhost:8000/v1/models" -Method GetInvoke-RestMethod -Uri "http://localhost:8000/v1/chat/completions" -Method Post -ContentType "application/json" -Body '{"model": "llama2-7b-chat", "messages": [{"role": "user", "content": "Hi"}]}'Invoke-RestMethod -Uri "http://localhost:8000/v1/completions" -Method Post -ContentType "application/json" -Body '{"model": "llama2-7b-chat", "prompt": "Hello"}'grpcurl -plaintext -d '{}' localhost:50051 ModelService/ListModelsgrpcurl -plaintext -d '{\"item_id\": \"llama2-7b-chat\", \"version\": \"latest\"}' localhost:50051 install_service.InstallService/Install- Unicode errors: Run PowerShell as Administrator and set
$env:PYTHONIOENCODING="utf-8" - Docker not found: Ensure Docker Desktop is running
- Port in use: Change the port in
src/main.pyor stop the conflicting process - Model not found: Check model name and installation status
- Run tests:
pytest - Lint:
black . && isort . && mypy src/ - Coverage:
pytest --cov=src
MIT# ai-local-plugin