| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Modern C++23 LLM client built with modules — import and chat, OpenAI-compatible, template-ready
| English - 简体中文 - 繁體中文 |
|---|
| mcpp build tool · package index · Documentation · Issues |
llmapi provides a typed Client<Provider> API for chat, streaming, embeddings, tool calls, and conversation persistence. The default config alias Config maps to OpenAI-style providers, so the common case does not need an explicit openai::OpenAI wrapper.
mcpp new myagent --template llmapi && cd myagent
export OPENAI_API_KEY="sk-..."
mcpp runTemplates ship with the library and version-track it automatically:
mcpp new --list-templates llmapi # list available templates
mcpp new mybot --template llmapi:chat # interactive streaming chat CLI
mcpp new mybot --template llmapi:anthropic # Anthropic provider
mcpp new mybot --template llmapi:deepseek # OpenAI-compatible endpoint (DeepSeek)Or add it to an existing mcpp project:
mcpp add llmapi[dependencies.mcpplibs]
llmapi = "0.2.8"import mcpplibs.llmapi;
import std;
int main() {
using namespace mcpplibs::llmapi;
auto apiKey = std::getenv("OPENAI_API_KEY");
if (!apiKey) {
std::println(stderr, "OPENAI_API_KEY not set");
return 1;
}
auto client = Client(Config{
.apiKey = apiKey,
.model = "gpt-4o-mini",
});
client.system("You are a concise assistant.");
auto resp = client.chat("Explain why C++23 modules are useful in two sentences.");
std::println("{}", resp.text());
return 0;
}| Template | Description |
|---|---|
| openai (default) | Minimal OpenAI chat — one request, one answer |
| chat | Interactive streaming chat CLI (OpenAI) |
| anthropic | Anthropic (Claude) chat |
| deepseek | OpenAI-compatible endpoint via baseUrl (DeepSeek) |
Compatible endpoints can reuse the OpenAI provider:
auto client = Client(Config{
.apiKey = std::getenv("DEEPSEEK_API_KEY"),
.baseUrl = std::string(URL::DeepSeek),
.model = "deepseek-chat",
});git clone https://github.com/mcpplibs/llmapi.git && cd llmapi
mcpp buildApache-2.0 - see LICENSE
| Back | FazBrowse Home | New Git URL |