Network ML

REST APIs and LLM chat,
as one-liners in C++.

A small, modern C++ library for HTTP requests and large language model chat (local via Ollama or cloud providers), built on libcurl.

// One HTTP request, with a rich response
ML::Requests req;
ML::Response r = req.get("https://api.example.com/data");
if (r.ok()) std::cout << r.status << "\n" << r.body;

// Talk to an LLM (swap the Provider for Groq, OpenAI, etc.)
ML::Chat chat(ML::Provider::Ollama, "llama3.2:1b");
std::cout << chat.ask("Explain RAII in one sentence.");

What it does

Full HTTP client

GET, POST, PUT, PATCH, DELETE, HEAD with status, body, and response headers. Auth helpers, URL encoding, downloads, uploads, and retries.

Multi-provider chat

One API for Ollama, Groq, OpenRouter, DeepSeek, OpenAI, and Anthropic. Switch providers by changing a single argument.

Streaming & reasoning

Stream replies token-by-token, with separate reasoning-token support for reasoning models. Conversation memory and save/load history.

File utilities

Cross-platform file and folder helpers built on std::filesystem: read/write (text and binary), copy, move, list, and more.

One self-contained lib

libcurl and zlib are merged in and system libraries auto-link, so on Windows you link only one file: networkml.lib.

Modern and portable

C++17, HTTPS out of the box (Schannel on Windows), and a CMake + vcpkg build that works on Windows, macOS, and Linux.

Get started

Build from source with CMake, or grab the prebuilt Windows binaries from the releases page. Full instructions and the complete API reference live in the wiki.