Python SDK
Python SDK for Tinfoil’s secure AI inference API
GitHub: tinfoil-python

Overview
The Tinfoil Python SDK is a wrapper around the OpenAI Python client 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
Migration from OpenAI
Migrating from OpenAI to Tinfoil is straightforward:Model Examples
Below are specific examples for each supported model. Click on any model to see its configuration and usage example.Chat Models
Kimi K2 Thinking
Kimi K2 Thinking
DeepSeek R1
DeepSeek R1
Qwen3-VL 30B
Qwen3-VL 30B
Llama 3.3 70B
Llama 3.3 70B
GPT-OSS 120B
GPT-OSS 120B
Kimi K2.5
Kimi K2.5
Audio Models
Whisper Large V3 Turbo
Whisper Large V3 Turbo
Embedding Models
Nomic Embed Text
Nomic Embed Text
Async Usage
Simply importAsyncTinfoilAI instead of TinfoilAI and use await with each API call:
API Documentation
This library is a drop-in replacement for the official OpenAI Python client that can be used with Tinfoil. All methods and types are identical. See the OpenAI Python client documentation for complete API usage and documentation.Guides
Web Search
Enable AI models to search the web with optional PII protection.
Tool Calling
Learn how to use function calling capabilities with AI models.
Structured Outputs
Use JSON schema validation for reliable data extraction.
Image Processing
Process images with multimodal AI models.
Document Processing
Upload and process documents securely.

