Swift SDK
Swift SDK for Tinfoil’s secure AI inference API
GitHub: tinfoil-swift
GitHub: 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 12.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.create()
returns a standard 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
DeepSeek R1 - deepseek-r1-0528
DeepSeek R1 - deepseek-r1-0528
Mistral Small 3.1 24B - mistral-small-3-1-24b
Mistral Small 3.1 24B - mistral-small-3-1-24b
Llama 3.3 70B - llama3-3-70b
Llama 3.3 70B - llama3-3-70b
Qwen 2.5 72B - qwen2-5-72b
Qwen 2.5 72B - qwen2-5-72b
Audio Models
Whisper Large V3 Turbo - whisper-large-v3-turbo
Whisper Large V3 Turbo - whisper-large-v3-turbo
Kokoro - kokoro
Kokoro - kokoro
Embedding Models
Nomic Embed Text - nomic-embed-text
Nomic Embed Text - nomic-embed-text