一个C语言库,用于在任何完全支持原生工具调用和MCP的编程语言或应用中嵌入Apple Intelligence的设备基础模型。
概览
适用于任何编程语言的苹果智能 一个C库,提供访问苹果智能设备基础模型的访问,适用于任何编程语言或应用。 libai 通过 C 接口桥接苹果的 FoundationModels 框架,使开发者能够将 Apple Intelligence 功能集成到 C、C++、Python、Rust、Go 或任何支持 C 绑定的语言中编写的应用程序中。 该库提供直接访问设备内AI模型,无需网络连接或外部API调用。所有处理均在用户设备本地完成。 该库提供直接访问设备内 AI 模型,无需网络连接或外部 API 调用。所有处理均在用户设备本地完成。支持英特尔 Mac、苹果硅芯片设备(包括 MacBook、iPhone 和 iPad)以及 Apple Vision Pro。支持平台: - iOS 26.0+ - iPadOS 26.0+ - Mac Catalyst 26.0+ - macOS 26.0+(英特尔和苹果硅片)- visionOS 26。
概述(AI 翻译)
适用于任何编程语言的苹果智能
一个C库,提供访问苹果智能设备基础模型的访问,适用于任何编程语言或应用。
概述
libai 通过 C 接口桥接苹果的 FoundationModels 框架,使开发者能够将 Apple Intelligence 功能集成到 C、C++、Python、Rust、Go 或任何支持 C 绑定的语言中编写的应用程序中。
该库提供直接访问设备内AI模型,无需网络连接或外部API调用。所有处理均在用户设备本地完成。
该库提供直接访问设备内AI模型,无需网络连接或外部API调用。所有处理均在用户设备本地完成。支持Intel Mac、苹果硅芯片设备(包括MacBook、iPhone和iPad)以及Apple Vision Pro。 支持的平台:
- iOS 26.0+
- iPadOS 26.0+
- Mac 催化剂 26.0+
- macOS 26.0+(Intel 和 Apple Silicon)
- visionOS 26.0+
特色
该库围绕会话管理展开。应用程序创建具有独立配置的独立AI会话。
本页由 AI 翻译,技术细节请以原文为准。
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
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →