Skip to content
Sign in Create account

Quickstart

Send one model request with Python 3.10 or later. For another language, see Hello world.

1. Create an API key

Sign up, then open Integration → API keys and create a key.

Eligible accounts may receive $2 of trial credit after email verification. The credit works on any priced model until it is used up. Model calls need a positive balance. You can add credit under Billing. For CI or scripts, see how to get a key without a browser.

2. Install the SDK

pip install cloakapi

Pip installs the Python SDK (0.5.1 on PyPI), with the native engine on supported Linux systems. See Engine setup for supported platforms and the separate name-model download.

3. Send one request

In a terminal on your computer or server, replace the placeholder with your key.

export CLOAKAPI_API_KEY="cloak_your_key_here"

Save this as hello.py.

import json
import os
from cloakapi import CloakAPI
def review(body: str, _info: object) -> bool:
print(body)
return input("Send this request? [y/N] ").strip().lower() == "y"
client = CloakAPI(api_key=os.environ["CLOAKAPI_API_KEY"], review=review)
response = client.chat.completions.create(
model="claude-haiku-5-5",
messages=[{"role": "user", "content": "Say hello to jane.doe@example.com in one short sentence."}],
)
print(response.choices[0].message.content)
if response.receipt is not None:
print(json.dumps(response.receipt))
python3 hello.py

Review the request shown in your terminal, then enter y to send it.

4. See what left your device

Here is the email swap from an example request. The SDK restores the original address if the model uses it in the reply.

Your code, on this device

messages=[{"role": "user", "content":
    "Say hello to jane.doe@example.com in one short sentence."}]

Sent through the gateway

"Say hello to robert.thomas@harborline.com in one short sentence."

The marked email was swapped for a stand-in on this device. Unmarked text is sent as written.

A sample request in Balanced mode.

The gateway does not verify that a detector ran. Detector misses can remain in the request.

5. Check the receipt

When the gateway returns a receipt, hello.py prints its JSON after the model reply. Paste the JSON into the receipt verifier and select Verify receipt. Verify a receipt explains the checks and shows how to run them by API or offline.

Test accounts and account routes