# Check it works

> How to confirm your calls reach ai-tally, and what to fix when they do not.

## Where to look

- **Setup**, under **Configure** in the dashboard. It shows **First trace received.** once any call has arrived.
- **Cost Explorer**, under **Analyze**. It lists your calls with their cost.

If Setup still says **Waiting for your first trace…**, go through the checks below.

## First, check these

**Is the right organization selected?** A key only sends data to the organization it was made in. If you belong to more than one, pick the right one in the switcher at the top of the dashboard.

**Does the key have `write` scope?** Scope is what a key is allowed to do. A `read` key can look but cannot send. Check the **Scope** column on the **API Keys** page. If it says `read`, make a new key with `write`.

**Was the key revoked or replaced?** A revoked key stops working. Rotating a key creates a new one and revokes the old one. Use the new key.

**Is the call there, but with a blank cost?** That is expected in two cases:

- the call did not report how many tokens it used
- ai-tally has no price for that model

ai-tally shows a blank when it cannot know a cost. It never shows a made-up $0. See [Prices and blanks](https://ai-tally.com/docs/cost/prices-and-blanks).

## If you use the proxy

Run your request with `curl -i` to see the reply. These replies come from the proxy itself, before your call reaches the AI provider:

| Reply | What it means | What to do |
|---|---|---|
| `400` `missing tenant key` | The `X-Tenant-Key` header is missing. | Add it. Run `echo $TALLY_KEY` to check the key is set. |
| `403` `unknown tenant key` | The key is wrong or revoked, or it is too new. | Check the key. A new key takes about a minute to work. |
| `403` `tenant key lacks write scope` | The key is a `read` key. | Make a `write` key. |
| `403` `the hosted proxy is turned off for this organization` | The proxy switch is off. | An admin turns on **Zero-code proxy** on the **API Keys** page. Wait about a minute. |
| `404` `no route for path` | The URL is wrong. | Start the URL with `https://ingest.ai-tally.com/openai/v1`, `/anthropic` or `/gemini`. |
| `502` `upstream unavailable` | The proxy could not reach the AI provider. | Try again. |

Any other error comes from the AI provider. For example, a `401` from OpenAI means your OpenAI key is wrong.

**Streaming with OpenAI and no cost?** Add `"stream_options": {"include_usage": true}` to your request. Without it, OpenAI does not report token counts on a stream.

## If you use the Python SDK

The SDK never crashes your app. So when something is wrong, it writes a warning to your logs instead of raising an error. Turn logging on to see those warnings:

```python
import logging
logging.basicConfig(level=logging.INFO)
```

Then check:

- **Is `TALLY_KEY` set where the code runs?** A server, a container or a notebook may not see a variable you set in your terminal. Without a key, the SDK logs a warning and records nothing.
- **Did a short script exit too soon?** Records are sent in the background. Call `tally.flush()` at the end.
- **Is the call made with the official `openai` or `anthropic` library?** Only those two are recorded automatically.

## If you use OpenTelemetry

Look at the reply code your trace exporter gets:

- `401` means the key is missing or wrong. The header must be `authorization=Bearer <your key>`.
- `403` means the key is a `read` key.
- `429` means slow down. Wait the number of seconds in the `Retry-After` header.

Also check two settings:

- The URL must end in `/v1/otlp/traces`.
- The format must be `http/json`. ai-tally does not accept the binary protobuf format.

## Next

Still stuck? Open the dashboard and check **Setup** again after each fix. Changes to keys and the proxy switch take about a minute.
