CLI
Command-line interface for Tinfoil’s secure AI inference API
CLI
Command-line interface for Tinfoil’s secure AI inference API
GitHub: tinfoil-cli
Overview
The Tinfoil CLI provides a command-line interface for making verified HTTP requests to Tinfoil enclaves and validating attestation documents. It supports all major AI inference operations including chat completions, audio transcription, and text embeddings.
Installation
Pre-built Binaries
Download the latest release for your OS from the Releases page.
Install Script
You can install tinfoil CLI using our install script. This script automatically detects your operating system and architecture, downloads the correct binary, and installs it to /usr/local/bin
.
Note: If you receive permission errors (for example, if you’re not running as root), you may need to run the command with sudo:
Build from Source
- Ensure you have Go installed.
- Clone the repository:
- Build the binary:
Command Reference
Usage Examples
Chat
Chat with AI models using natural language.
Basic Usage
Streaming Example
Specifying a Custom Model
For custom models not included in config.json
, supply the model name along with the -e
and -r
overrides:
If you omit -e
or -r
for a model that isn’t in the configuration, a warning will be displayed prompting you to specify these flags.
Command Options:
-m, --model
: The model name to use for chat. Must be specified.-k, --api-key
: The API key for authentication.-e, --host
: The hostname of the enclave. Optional if defined in the config file.-r, --repo
: The GitHub repository containing code measurements. Optional if defined in the config file.
Audio Transcription
The audio
command allows you to transcribe audio files using Whisper. By default, it uses the whisper-large-v3-turbo
model.
Basic Usage
This command uses the default model whisper-large-v3-turbo
and loads the enclave host and repo values from config.json
.
Specifying a Custom Model
Command Options:
-m, --model
: The model name to use for transcription. Defaults towhisper-large-v3-turbo
.-k, --api-key
: The API key for authentication.-f, --file
: The audio file to transcribe.-e, --host
: The hostname of the enclave. Optional if defined in the config file.-r, --repo
: The GitHub repository containing code measurements. Optional if defined in the config file.
Text-to-Speech
The CLI can generate audio from text using the Kokoro model via the HTTP command:
Available voices include af_sky
, af_bella
, af_heart
, and combinations like af_sky+af_bella
.
Text Embeddings
The embed
command allows you to generate embeddings for text inputs. By default, it uses the nomic-embed-text
model.
With Default Model
This command uses the default model nomic-embed-text
and loads the enclave host and repo values from config.json
.
With Multiple Text Inputs
You can provide multiple text inputs to get embeddings for all of them:
Specifying a Custom Model
Command Options:
-m, --model
: The model name to use for embeddings. Defaults tonomic-embed-text
.-k, --api-key
: The API key for authentication.-e, --host
: The hostname of the enclave. Optional if defined in the config file.-r, --repo
: The GitHub repository containing code measurements. Optional if defined in the config file.
Attestation Verification
Verify Attestation
Use the attestation verify
command to manually verify that an enclave is running the expected code. The output will be a series of INFO logs describing each verification step.
Sample successful output:
Audit Attestation
You can also verify attestations at random and record a machine-readable audit log. Use the attestation audit
command for this purpose.
By default the audit record is printed to stdout as JSON. To write it to a file, use the -l/--log-file
flag:
The audit log record includes the timestamp, enclave host, code and enclave measurement fingerprints, and the verification status.
Proxy
Use tinfoil proxy
to start a local HTTP proxy that verifies connections and forwards them to the specified enclave: