Apple Intelligence & PCC
Relevant source files
The following files were used as context for generating this wiki page:
Conduit provides native integration with Apple's Foundation Models framework, enabling access to on-device and private cloud-based large language models. This system allows iOS users to talk directly to Apple Intelligence models without requiring external API keys.
The integration consists of two primary providers: Apple On-Device, which operates offline on eligible iOS 26+ devices using the SystemLanguageModel, and Apple Private Cloud Compute (PCC), which utilizes Apple's private cloud infrastructure on iOS 27+ devices for more complex tasks including multimodal input.
Sources: README.md:58-81, ios/Runner/PccBridge.swift:340-362, ios/Runner/PccBridge.swift:505-555
System Architecture
The Apple Intelligence integration uses a bridge pattern to communicate between the Flutter UI and native iOS frameworks. PccBridge implements the PccHostApi to handle requests for both on-device and PCC models.
Integration Components
| Component | Description |
|---|---|
PccBridge | The central Swift class managing native lifecycle, task execution, and event emission. |
SystemLanguageModel | Apple's local framework component for on-device inference. |
PrivateCloudComputeLanguageModel | framework component for secure cloud-based inference. |
PccFlutterApi | The generated Pigeon interface used to send stream events back to Dart. |
GenerationSchema | Native structure for enforcing JSON-schema responses. |
Sources: ios/Runner/PccBridge.swift:233-255, ios/Runner/PccBridge.swift:340-350, ios/Runner/ConduitPlatformApis.g.swift:1450-1465
Data Flow Overview
The following diagram illustrates how a completion request moves from the Flutter application through the native bridge to Apple's model frameworks.
The bridge serializes messages into a Transcript and manages streaming responses as snapshots or schema-validated JSON.
Sources: ios/Runner/PccBridge.swift:279-317, ios/Runner/PccBridge.swift:425-455
Apple On-Device Model
The On-Device provider utilizes the SystemLanguageModel to perform local inference. It is designed for privacy and offline availability.
Technical Specifications
- Requirements: iOS 26.0+, Apple Intelligence supported hardware.
- Context Window: Supports a 4K context window.
- Capabilities: Streaming, sampling controls (Temperature, TopP, TopK, Seed), and JSON-schema responses.
- Constraints: No image input, reasoning controls, or tool calling.
Sources: README.md:65-71, ios/Runner/PccBridge.swift:353-370, ios/Runner/PccBridge.swift:458-465
On-Device Status Management
PccBridge checks for device eligibility, whether Apple Intelligence is enabled, and if the local model has finished downloading.
Apple Private Cloud Compute (PCC)
Apple PCC uses the FoundationModels framework to stream responses through a secure cloud path. It offers higher reasoning capabilities than on-device models.
Technical Specifications
- Requirements: iOS 27.0+, Apple's managed PCC entitlement.
- Capabilities: Multimodal image input (up to 4 images/20MB total), reasoning levels (light, moderate, deep), and live quota monitoring.
- On-Device Fallback: Supports an optional fallback to local models if the PCC network connection fails.
Sources: README.md:73-81, ios/Runner/PccBridge.swift:557-610, ios/Runner/PccBridge.swift:657-675
Quota and Usage
PCC requests are subject to daily usage limits. PccBridge monitors quotaUsage and can trigger a system suggestion for the user to increase their quota limit.
| Status Field | Description |
|---|---|
quotaStatus | Indicates if the user is belowLimit, approachingLimit, or limitReached. |
canIncreaseQuota | Boolean indicating if the system supports a quota increase request. |
quotaResetAtMilliseconds | The timestamp when the daily limit will reset. |
Sources: ios/Runner/PccBridge.swift:505-525, ios/Runner/ConduitPlatformApis.g.swift:1255-1270
Request Handling and Validation
PccBridge performs strict validation on incoming PlatformPccCompletionRequest objects to ensure compatibility with native frameworks.
Generation Options Mapping
Native parameters are mapped from the Pigeon request to the GenerationOptions structure. The bridge enforces that only one sampling mode (Greedy, TopP, or TopK) is active at a time.
// ios/Runner/PccBridge.swift:85-117
func pccGenerationOptions(_ request: PlatformPccCompletionRequest) throws -> GenerationOptions {
// Temperature validation
if let temperature = request.temperature, !(0 ... 1).contains(temperature) {
throw PccBridgeError.invalidRequest
}
// Sampling mode selection
let selectedModes = [
request.greedySampling == true,
request.topP != nil,
request.topK != nil,
].filter { $0 }.count
guard selectedModes <= 1 else { throw PccBridgeError.invalidRequest }
// ... logic for samplingMode assignment
}
Sources: ios/Runner/PccBridge.swift:85-117
Image Processing (PCC Only)
Images must be under 20MB and utilize specific metadata constraints to be considered safe for processing. PccBridge validates image dimensions (max 8192px) and pixel depth before decoding.
Sources: ios/Runner/PccBridge.swift:23-53, ios/Runner/PccBridge.swift:612-655, ios/RunnerTests/RunnerTests.swift:165-195
Structured Output (JSON Schema)
Both On-Device and PCC models support structured JSON responses. PccBridge parses a JSON schema provided by Flutter and converts it into a native GenerationSchema using a recursive builder.
Schema Constraints
- Max JSON size: 64 KB.
- Max depth: 12 levels.
- Max properties per object: 128.
- Total properties: 256.
Sources: ios/Runner/PccBridge.swift:120-222, ios/RunnerTests/RunnerTests.swift:218-285
Summary
The Apple Intelligence and PCC implementation in Conduit provides a high-performance, private-first method for mobile AI interaction. By leveraging the FoundationModels framework, the project enables streaming AI chat that supports modern LLM features like reasoning, multimodal input, and structured output while maintaining strict compliance with Apple's platform security and entitlement requirements.