6L

6over3/libai

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

34 stars 6 forks Качество 43 Тренд 12MIT

A C library for embedding Apple Intelligence on-device Foundation models in any programming language or application with full support for native tool calling and MCP.

Обзор

Apple Intelligence for any programming language A C library that provides access to Apple Intelligence on-device Foundation models for any programming language or application. libai bridges Apple's FoundationModels framework through a C interface, enabling developers to integrate Apple Intelligence capabilities into applications written in C, C++, Python, Rust, Go, or any language that supports C bindings. The library provides direct access to on-device AI models without requiring network connectivity or external API calls. All processing occurs locally on the user's device. The library provides direct access to on-device AI models without requiring network connectivity or external API calls. All processing occurs locally on the user's device. It supports Intel Macs, Apple Silicon devices including MacBooks, iPhones, and iPads, as well as Apple Vision Pro. Supported platforms: - iOS 26.0+ - iPadOS 26.0+ - Mac Catalyst 26.0+ - macOS 26.0+ (Intel and Apple Silicon) - visionOS 26.

README

Показан фрагмент оригинального README. Открыть оригинал.

Apple Intelligence for any programming language


A C library that provides access to Apple Intelligence on-device Foundation models for any programming language or application.

Overview

libai bridges Apple’s FoundationModels framework through a C interface, enabling developers to integrate Apple Intelligence capabilities into applications written in C, C++, Python, Rust, Go, or any language that supports C bindings.

The library provides direct access to on-device AI models without requiring network connectivity or external API calls. All processing occurs locally on the user’s device.

The library provides direct access to on-device AI models without requiring network connectivity or external API calls. All processing occurs locally on the user’s device. It supports Intel Macs, Apple Silicon devices including MacBooks, iPhones, and iPads, as well as Apple Vision Pro. Supported platforms:

  • iOS 26.0+
  • iPadOS 26.0+
  • Mac Catalyst 26.0+
  • macOS 26.0+ (Intel and Apple Silicon)
  • visionOS 26.0+

Features

The library centers around session management. Applications create isolated AI sessions with independent configurations. Text generation operates in both synchronous and asynchronous modes with streaming callbacks available for real-time interfaces.

Structured response generation ensures AI output conforms to predefined JSON schemas. The library validates responses and provides both text and structured object representations.

Tool integration enables AI models to execute functions and interact with external systems. Applications can register native C callback functions as compile-time tools or utilize external MCP servers for runtime tool integration.

Tool definitions use JSON schemas following the Claude tool format for parameter validation and documentation.

System Requirements: macOS 26.0 or later with Apple Intelligence enabled.

Installation

# Download latest release
curl -L https://github.com/6over3/libai/releases/latest/download/libai.tar.gz | tar xz

# Build from source
git clone https://github.com/6over3/libai.git
cd libai
make

Quick Start

#include "ai.h"

// Initialize library
ai_init();

// Create context and session
ai_context_t *ctx = ai_context_create();
ai_session_id_t session = ai_create_session(ctx, NULL);

// Generate response
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →