# Quickstart

> Send one AI call and see what it cost in ai-tally. About five minutes.

Send one AI call and see what it cost. This takes about five minutes.

## 1. Create your account

Sign up at [app.ai-tally.com](https://app.ai-tally.com/sign-up). When asked, create an organization. An organization is your team's shared space in ai-tally. You are its admin.

## 2. Create an API key

In the dashboard, open **API Keys** under **Organization**. Type a name, leave **Scope** set to `write`, and click **Create key**.

Copy the key right away. It is shown only once. In your terminal, save it:

`export TALLY_KEY="paste-your-key-here"`

## 3. Send one call

Pick one of the three ways below. You only need one.

### Proxy

With the proxy, your app sends its AI requests through ai-tally on their way to the AI provider. ai-tally reads what each call used, then passes the call on unchanged.

1. On the **API Keys** page, turn on **Zero-code proxy**. It starts off for every new organization.
2. Wait about a minute. That is how long a new key and the switch take to reach the proxy.
3. Run the `curl` below, using your own OpenAI key. It is the same example the dashboard shows you when you create a key. Put the key you saved in step 2 where it says `YOUR_TALLY_KEY`.

```bash
# Point the OpenAI SDK at the ai-tally proxy
export OPENAI_BASE_URL="https://ingest.ai-tally.com/openai/v1"

# ai-tally identifies your org by this ingest key, sent as the X-Tenant-Key header:
#   X-Tenant-Key: YOUR_TALLY_KEY
# e.g. a raw request:
curl "https://ingest.ai-tally.com/openai/v1/chat/completions" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "X-Tenant-Key: YOUR_TALLY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'
```

A brand-new key can take a few seconds to attribute while the proxy picks it up. Your provider key is unchanged and never sent to ai-tally.

The only differences from a normal OpenAI call are the URL and the `X-Tenant-Key` header. Your OpenAI key goes to OpenAI as usual. Anthropic and Gemini work the same way.

### Python SDK

The SDK is a small Python library. Once it is set up, it records your OpenAI and Anthropic calls in the background. It never slows them down or causes them to fail.

Save this as `first_call.py`, then run `python first_call.py`. It needs Python 3.10 or later.

```python
# pip install "git+https://github.com/jain-aanchal/ai-tally#subdirectory=sdk/python" openai
import tally
from openai import OpenAI

tally.init()  # reads your key from TALLY_KEY

reply = OpenAI().chat.completions.create(  # reads OPENAI_API_KEY
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Say hi"}],
)
print(reply.choices[0].message.content)
tally.flush()  # sends the record before this short script exits
```

Install the SDK with the `pip install` line shown in the comment. `pip install tally` installs a different, unrelated package.

### OpenTelemetry

OpenTelemetry is a common standard for tracing, which means recording what your app does. If your app already sends traces, ai-tally can read the AI calls in them.

To try it without touching your app, send one sample trace. It describes one `gpt-4o-mini` call that used 12 input tokens and 5 output tokens. Tokens are the units AI providers charge for.

```bash
curl https://ingest.ai-tally.com/v1/otlp/traces \
  -H "Authorization: Bearer $TALLY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resourceSpans":[{"scopeSpans":[{"spans":[{
        "traceId":"5b8efff798038103d269b633813fc60c","spanId":"eee19b7ec3c1b174",
        "name":"chat","startTimeUnixNano":"'"$(date +%s)000000000"'",
        "attributes":[
          {"key":"gen_ai.system","value":{"stringValue":"openai"}},
          {"key":"gen_ai.operation.name","value":{"stringValue":"chat"}},
          {"key":"gen_ai.request.model","value":{"stringValue":"gpt-4o-mini"}},
          {"key":"gen_ai.usage.input_tokens","value":{"intValue":"12"}},
          {"key":"gen_ai.usage.output_tokens","value":{"intValue":"5"}}]}]}]}]}'
```

A reply that includes `"status": "accepted"` means ai-tally stored it.

## 4. See what it cost

In the dashboard, open **Setup** under **Configure**. It shows **First trace received.** Then open **Cost Explorer** under **Analyze**. Your call is listed under **LLM**, with its cost.

## Next

- Nothing showed up? Go to [Check it works](https://ai-tally.com/docs/get-started/check-it-works).
- Worked? Now connect your real app. Everything each option can do is in [Proxy](https://ai-tally.com/docs/connect/proxy), [Python SDK](https://ai-tally.com/docs/connect/python-sdk) and [OpenTelemetry](https://ai-tally.com/docs/connect/opentelemetry).
