Ai Sdk Cpp banner
ClickHouse ClickHouse

Ai Sdk Cpp

AI community

Description

The AI Toolkit for Modern C++. From the engineers at ClickHouse, ai-sdk-cpp is a free, open‑source library for building AI‑powered applications and agents.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

AI SDK CPP

The AI SDK CPP is a modern C++ toolkit designed to help you build AI-powered applications with popular model providers like OpenAI and Anthropic. It provides a unified, easy-to-use API that abstracts away the complexity of different provider implementations.

Motivation

C++ developers have long lacked a first-class, convenient way to interact with modern AI services like OpenAI, Anthropic, and others. AI SDK CPP bridges this gap by providing:

  • Unified API: Work with multiple AI providers through a single, consistent interface
  • Modern C++: Built with C++20 features for clean, expressive code
  • Minimal Dependencies: Minimal external dependencies for easy integration

Installation

You will need a C++20 compatible compiler and CMake 3.16+ installed on your development machine.

Usage

Core API

The AI SDK CPP Core module provides a unified API to interact with model providers like OpenAI and Anthropic.

OpenAI Integration

#include 
#include 
#include 

int main() {
    // Ensure OPENAI_API_KEY environment variable is set
    auto client = ai::openai::create_client();
    
    ai::GenerateOptions options(ai::openai::models::kGpt56,
                                "Why is the sky blue?");
    options.system = "You are a friendly assistant!";
    auto result = client.generate_text(options);
    
    if (result) {
        std::cout << result->text << std::endl;
    }
    
    return 0;
}

Anthropic Integration

#include 
#include 
#include 

int main() {
    // Ensure ANTHROPIC_API_KEY environment variable is set
    auto client = ai::anthropic::create_client();
    ai::GenerateOptions options(ai::anthropic::models::kClaudeSonnet5,
                                "Explain quantum computing in simple terms.");
    options.system = "You are a helpful assistant.";
    auto result = client.generate_text(options);

    if (result) {