Quickstart
Make your first model request with the Python SDK, receive an answer and close the Room. This is a complete application example; no CLI is required.
Before you start
- Python 3.10 or later in a trusted local or server environment.
- An API account, prepaid credit and an API key created under API keys.
- A live model from Models & controls. An offline model cannot serve requests.
This example uses paid inference. For another integration path, choose Direct API, JavaScript SDK or CLI for an existing tool.
1. Install
python -m pip install https://api.turboprivate.ai/sdk/python.tgz
2. Configure your credentials
Set TURBOPRIVATE_API_KEY to your key and TURBOPRIVATE_MODEL to the live model ID you selected. The example reads both from the environment. Use your shell's environment settings or a secret manager; do not put the key in the source file.
For example, in Bash (the key is entered without echo):
read -rsp 'API key: ' TURBOPRIVATE_API_KEY; echo export TURBOPRIVATE_API_KEY read -rp 'Live model ID: ' TURBOPRIVATE_MODEL export TURBOPRIVATE_MODEL
The tp_live_… API key identifies your account. It is used by all three access methods. The SDK will handle Room credentials and encryption separately.
3. Send a request
Save this as example.py:
import os
from turboprivate import TurboPrivate
with TurboPrivate(
api_key=os.environ["TURBOPRIVATE_API_KEY"],
model=os.environ["TURBOPRIVATE_MODEL"],
) as client:
result = client.chat.completions.create(
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(result["choices"][0]["message"]["content"])
print("Receipt verified:", client.last_receipt_verified)
python example.py
The SDK authenticates, allocates and verifies a Room, encrypts the request and checks the signed response. The with block attempts to close the Room when it exits, including when the request raises an error. A connection failure can leave cleanup unconfirmed; idle expiry is the fallback.
4. Check the result
You should see the model's answer and Receipt verified: True. The exact answer varies. Receipt verification checks the signed response; it does not establish host confidentiality. For an exportable record, continue to Privacy proofs.
If no model is live, stop and retry when capacity is available. For authentication, balance or connection errors, use Troubleshooting. Do not bypass trust checks or send plaintext to the public API host.
Next steps
- SDK — JavaScript and Python, streaming and controls.
- Direct API — implement the same protocol in your own client.
- CLI — connect an existing OpenAI- or Anthropic-compatible tool.
- Pricing & billing — measured tokens and prepaid credit.