View on GitHub
tinfoilsh/tinfoil-swift
Overview
The Tinfoil Swift SDK is a wrapper around the MacPaw OpenAI SDK that provides secure communication with Tinfoil enclaves. It has the same API as the OpenAI SDK with additional security features including automatic verification that the endpoint is running in a secure Tinfoil enclave, TLS certificate pinning, and attestation validation.Installation
Swift Package Manager
Add to yourPackage.swift:
Xcode
- Go to File → Add Package Dependencies
- Enter the repository URL:
https://github.com/tinfoilsh/tinfoil-swift.git - Select the version you want to use
- Click “Add Package”
Requirements
- iOS 17.0+ / macOS 14.0+
- Swift 5.9+
- Xcode 15.0+
Migration from OpenAI
Migrating from OpenAI to Tinfoil is straightforward. The client is designed to be compatible with the MacPaw OpenAI Swift client:TinfoilAI provides the same API as the OpenAI client with built-in security features.
Model Examples
Below are specific examples for each supported model. Click on any model to see its configuration and usage example.Chat Models
GLM-5.2
GLM-5.2
Qwen3-VL 30B
Qwen3-VL 30B
Llama 3.3 70B
Llama 3.3 70B
GPT-OSS 120B
GPT-OSS 120B
Audio Models
Embedding Models
Nomic Embed Text
Nomic Embed Text
Error Handling
Verification Document
For advanced security verification, you can provide a callback to receive detailed information about the attestation and verification process:API Documentation
This library is a drop-in replacement for the MacPaw OpenAI Swift client that can be used with Tinfoil. TheTinfoilAI client provides the same API as the OpenAI client. See the MacPaw OpenAI documentation for complete API usage and documentation.
