frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Show HN: A modern C++20 AI SDK (GPT‑4o, Claude 3.5, tool‑calling)

50•cauchyk•3d ago
Hi all,

I’m hacking on new features for the ClickHouse native client and wanted the same “just call the model” ergonomics JavaScript and Python now enjoy. It didn’t exist for modern C++, so I wrote one.

ai‑sdk‑cpp (Apache‑2.0) gives you:

- Unified calls to OpenAI (GPT‑4o) and Anthropic (Claude 3.5) with a single C++20 API. - Streaming, multi‑turn chat, error handling—all std::optional/std::variant, no macros. - Tool calling (function‑calling) so the model can hit real APIs; sync or async, runs in parallel.

The tricky bit: C++ still lacks real reflection, so mapping plain functions → JSON schemas isn’t as automatic as, say, TypeScript decorators. I’d love fresh eyes on that part. Try the examples and tell me where it feels clunky. This is inspired by Vercel's AI SDK [1], and litellm [2].

Repo live here: https://github.com/ClickHouse/ai-sdk-cpp, feedback welcome!

[1] https://github.com/vercel/ai [2] https://github.com/BerriAI/litellm

Comments

rubymamis•17h ago
Very nice! I might get inspire for my own Qt C++ LLM client[1]. Do you plan to add streaming Markdown parsing? It's a challenging problem that was very fun implementing for Vox -> it allows parsing code blocks and other such advance/custom blocks (I created a custom 'tool' block) without re-rendering. My implementation is currently tied to Qt's C++ but I might make it more generic and open source it.

[1] https://www.get-vox.com/

pjmlp•16h ago
While you will need C++26 for real reflection, you could use some of the libraries that make do with what is already possible via concepts, if constexpr and type traits.

For example,

- https://www.boost.org/doc/libs/latest/doc/html/boost_pfr.htm...

- https://github.com/getml/reflect-cpp

And kudos for using modern C++.

sylware•15h ago
I was wondering, has anybody tried to use AI to port c++ to C?
bergesenha•13h ago
The json library 'glaze' has working compile time reflection for MSVC, Clang and GCC using some tricks with aggregate initializable structs. In addition to being a performant json library, it comes with the functions glz::apply and glz::to_tie which I used for general tool calling straight from deserialized json.
fsloth•12h ago
“mapping plain functions → JSON schemas”

In general I’ve found it’s much better in C++ to be verbose and plain rather than succinct and elegant.

Javascript and python lack typing so being pithy&clever in those languages has entirely different implications than in C++.

“How can I express this in the most basic, unsurprising and plainspoken C++” is usually the right question to ask. “How can I make this more elegant” is a question better suited for other languages imho.

The best C++ API when in doubt is a C style API.

N_Lens•12h ago
Agreed! C++ is a powerful language but full of footguns.

What to build instead of AI agents

https://decodingml.substack.com/p/stop-building-ai-agents
31•giuliomagnifico•1h ago•18 comments

Exploiting the IKKO Activebuds "AI powered" earbuds

https://blog.mgdproductions.com/ikko-activebuds/
435•ajdude•11h ago•158 comments

ASCIIMoon: The moon's phase live in ASCII art

https://asciimoon.com/
125•zayat•1d ago•49 comments

Don’t use “click here” as link text (2001)

https://www.w3.org/QA/Tips/noClickHere
428•theandrewbailey•13h ago•310 comments

Show HN: CSS generator for a high-def glass effect

https://glass3d.dev/
205•kris-kay•9h ago•70 comments

Couchers is officially out of beta

https://couchers.org/blog/2025/07/01/releasing-couchers-v1
146•laurentlb•7h ago•62 comments

Physicists Start to Pin Down How Stars Forge Heavy Atoms

https://www.quantamagazine.org/physicists-start-to-pin-down-how-stars-forge-heavy-atoms-20250702/
30•jnord•3h ago•2 comments

That XOR Trick (2020)

https://florian.github.io//xor-trick/
18•hundredwatt•2d ago•9 comments

Vitamin C Boosts Epidermal Growth via DNA Demethylation

https://www.jidonline.org/article/S0022-202X(25)00416-6/fulltext
30•gnabgib•4h ago•12 comments

Evidence of a 12,800-year-old shallow airburst depression in Louisiana

https://www.scienceopen.com/hosted-document?doi=10.14293/ACI.2025.0004
94•keepamovin•1d ago•40 comments

The Zen of Quakerism (2016)

https://www.friendsjournal.org/the-zen-of-quakerism/
87•surprisetalk•3d ago•60 comments

Gene therapy restored hearing in deaf patients

https://news.ki.se/gene-therapy-restored-hearing-in-deaf-patients
286•justacrow•10h ago•71 comments

Sony's Mark Cerny Has Worked on "Big Chunks of RDNA 5" with AMD

https://overclock3d.net/news/gpu-displays/sonys-mark-cerny-has-worked-on-big-chunks-of-rdna-5-with-amd/
61•ZenithExtreme•9h ago•68 comments

The Evolution of Caching Libraries in Go

https://maypok86.github.io/otter/blog/cache-evolution/
68•maypok86•3d ago•18 comments

Features of D That I Love

https://bradley.chatha.dev/blog/dlang-propaganda/features-of-d-that-i-love/
61•vips7L•8h ago•47 comments

Websites hosting major US climate reports taken down

https://apnews.com/article/climate-change-national-assessment-nasa-white-house-057cec699caef90832d8b10f21a6ffe8
186•geox•4h ago•84 comments

A list is a monad

https://alexyorke.github.io//2025/06/29/a-list-is-a-monad/
104•polygot•3d ago•110 comments

AI note takers are flooding Zoom calls as workers opt to skip meetings

https://www.washingtonpost.com/technology/2025/07/02/ai-note-takers-meetings-bots/
51•tysone•7h ago•43 comments

Escher's art and computer science

https://github.com/gritzko/librdx/blob/master/blog/escher.md
32•signa11•1d ago•5 comments

How large are large language models?

https://gist.github.com/rain-1/cf0419958250d15893d8873682492c3e
232•rain1•14h ago•135 comments

MindsDB (YC W20) is hiring an AI solutions engineer

https://job-boards.greenhouse.io/mindsdb/jobs/4770283007
1•adam_carrigan•7h ago

The Unseen Fury of Solar Storms

https://www.noemamag.com/the-unseen-fury-of-solar-storms/
14•NaOH•3d ago•1 comments

Efficient set-membership filters and dictionaries based on SAT

https://github.com/NationalSecurityAgency/XORSATFilter
30•keepamovin•3d ago•6 comments

Private sector lost 33k jobs, badly missing expectations of 100k increase

https://www.cnbc.com/2025/07/02/adp-jobs-report-june-2025.html
369•ceejayoz•11h ago•227 comments

WebAssembly Troubles part 4: Microwasm (2019)

http://troubles.md/microwasm/
28•Bogdanp•3d ago•0 comments

TikTok is being flooded with racist AI videos generated by Google's Veo 3

https://arstechnica.com/ai/2025/07/racist-ai-videos-created-with-google-veo-3-are-proliferating-on-tiktok/
66•kozika•2h ago•35 comments

The "personal computer" model scales better than the "terminal" model

https://utcc.utoronto.ca/~cks/space/blog/tech/ScalingTerminalsVsPCs
6•zdw•1d ago•4 comments

Reuleaux Kinematic Mechanisms Collection

https://digital.library.cornell.edu/collections/kmoddl
17•gyomu•1d ago•3 comments

Cloudflare Introduces Default Blocking of A.I. Data Scrapers

https://www.nytimes.com/2025/07/01/technology/cloudflare-ai-data.html
360•stephendause•11h ago•241 comments

More assorted notes on Liquid Glass

https://morrick.me/archives/10068
99•freediver•16h ago•103 comments