# Security and data handling

> What ai-tally stores, what it never stores, how keys and customer ids are protected, and the proxy tradeoff.

This page says what ai-tally keeps about your AI calls, what it never keeps, and how access works.

## What ai-tally stores

For each AI call, ai-tally stores numbers and names, not content:

- the provider and model
- token counts and the cost
- the feature tag, and the hashed customer id if you sent one
- timing, reply code and request sizes
- trace and session ids

## What ai-tally never stores

- **Prompts, answers and retrieved text.**
  - The proxy reads only the model name and token counts from a response. It never saves the request or the answer.
  - The Python SDK never sends them.
  - For OpenTelemetry, attributes that hold text (names ending in `prompt`, `completion`, `messages`, `content`, `text` or `body`) are dropped before anything is saved.
- **Your AI provider keys.**
  - With the proxy, your OpenAI, Anthropic or Gemini key passes through to the provider untouched and is not recorded.
  - With the SDK or OpenTelemetry, your provider key never reaches ai-tally at all.
- **Your real customer ids.** Only a hashed customer id is stored (see below).
- **Raw personal details.** A span containing an email address, or attributes named like `email`, `user_id` or `phone`, is refused.

## Customer ids are hashed

To see cost per customer, you attach a hashed customer id that cannot be traced back:

- **Each organization has its own secret hashing key.** ai-tally's database stores only a reference to it, never the key itself.
- **Hashing uses HMAC-SHA256.** It turns your customer id into a 64-character code with that key.
- **The same id always gives the same code** within your organization.
- **The code cannot be turned back into the id.** Codes from different organizations never match, so they cannot be joined.
- **The raw id stays with you when you send calls.** The Python SDK hashes inside your app before anything is sent. With the proxy or OpenTelemetry, you hash the id yourself before sending it.
- **Uploaded revenue is hashed on arrival.** If you upload a revenue file, it carries your real customer ids. ai-tally hashes each one as the file is read and does not save or log the real id.

Only a key with `write` or `admin` scope can fetch the hashing key, and only for its own organization.

## API keys

An API key identifies your organization when you send data.

- **Seeing a key.** A key is shown once, when it is created. ai-tally stores only a fingerprint of it (a SHA-256 hash), so it cannot show the key again.
- **Scope.** Scope decides what a key may do. `write` and `admin` keys can send data. A `read` key cannot send data or fetch the hashing key.
- **Who manages keys.** Only organization admins can create, rotate or revoke keys. Other members can see the list of keys, but not the keys themselves. Admins manage members on the **Members** page.
- **Rotate.** **Rotate** creates a new key with the same name and scope, and revokes the old one in the same step.
- **Revoke.** **Revoke** stops a key from working.

How quickly a revoked key stops working:

| Path | Takes effect |
|---|---|
| Python SDK and OpenTelemetry | On the next request. The key is checked every time. |
| Proxy | Within about a minute. The proxy keeps a copy of your keys and updates it about every 45 seconds. |

## The proxy is in your request path

When you use the proxy, every AI call goes through ai-tally on its way to your provider:

- **It adds a little time to every call.** Each call makes one extra network hop.
- **If the proxy is down, calls sent through it fail.** The hosted proxy currently runs as a single instance.
- **The SDK and OpenTelemetry do not have this risk.** They send their records separately from your calls, so an ai-tally outage never stops your AI calls. If your product cannot accept that risk, use one of these instead.

The proxy is off until an organization admin turns it on.

## Cloud credentials

When you connect a cloud bill on the **Connectors** page, you give ai-tally a reference to a credential, such as a cloud role ARN or a secret manager name. You never paste a raw access key. ai-tally rejects values that look like raw keys.

ai-tally does not currently claim any security certification.

## Next

- Choose the way to connect that fits your risk: [Proxy](https://ai-tally.com/docs/connect/proxy), [Python SDK](https://ai-tally.com/docs/connect/python-sdk) or [OpenTelemetry](https://ai-tally.com/docs/connect/opentelemetry).
