Status: [UNTESTED]
Endpoints found:
http://127.0.0.1:8080/v1/chat/completions
Source: https://github.com/Agarwalrishu13/nanollama.c
# nanollama.c v2 🚀
**The offline LLM inference engine & OpenAI-compatible API server.**
[](https://github.com/Agarwalrishu13/nanollama.c/actions/workflows/ci.yml)
[](LICENSE)
[]()
[]()
[]()
---
## What's New in v2
| Feature | Description |
|---|---|
| **Foundation Model Support** | Llama / SmolLM / Qwen2.5 — `rope_theta`, `norm_eps`, and QKV bias metadata baked into the `.bin` header |
| **SIMD AVX2 Accelerated** | 387+ tok/s Int8 on modern CPUs — kernels in `src/transformer.c` |
| **OpenAI API Server** | Pure C HTTP (`POST /v1/chat/completions`, `GET /health`) — run locally without any framework |
| **HuggingFace Converter** | `python scripts/export_hf.py --model --out models/.bin --tokenizer models/tokenizer.bin` |
### Build
```bash
# On Linux / macOS / Git Bash
make avx2 # O3 + -mavx2 -mfma
# One-click on Windows
.\build.bat
```
---
## Quickstart
### 1. Generate
```bash
./nanollama generate -m models/stories15M.bin -p "Once upon a time" -n 128 -t 0.8
```
### 2. Local API Server
```bash
./nanollama serve -m models/stories15M.bin -z models/tokenizer.bin --port 8080
# then
curl http://127.0.0.1:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"nanollama-v2","messages":[{"role":"user","content":"Hello!"}]}'
```
### 3. Convert a HuggingFace model
```bash
python scripts/export_hf.py --model HuggingFaceTB/SmolLM2-135M-Instruct --out models/smollm2.bin --tokenizer models/tokenizer.bin
```
---
## Architecture
| File | Lines | Wha