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.** [![build](https://github.com/Agarwalrishu13/nanollama.c/actions/workflows/ci.yml/badge.svg)](https://github.com/Agarwalrishu13/nanollama.c/actions/workflows/ci.yml) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![language](https://img.shields.io/badge/language-C11-58a6ff.svg)]() [![no deps](https://img.shields.io/badge/dependencies-0-f0883e.svg)]() [![AVX2 speedup](https://img.shields.io/badge/AVX2%20SIMD%20387%20tok/s-58a6ff.svg)]() nanollama.c v2 text generation
--- ## 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