# Quickstart

Install the Python SDK, set two environment variables and attribute your first AI calls.

AI Spendbook documentation, Start here. Web page: https://www.aispendbook.com/docs/quickstart

Install the Python SDK, set two environment variables, and wrap AI calls with `track()` to attribute them to a customer and feature. Create the ingestion key in **Integrations**, under **SDK / HTTP ingestion**. The SDK installs from GitHub.

```bash
pip install git+https://github.com/AISpendbook/aispendbook-python
export SPENDBOOK_API_KEY=afk_your_key        # ingestion key, shown once
export SPENDBOOK_ENDPOINT=https://www.aispendbook.com   # AI Spendbook API base URL (your own URL if self-hosted)
# in your app
from spendbook import track
```

- `SPENDBOOK_API_KEY`: the ingestion key. It starts with `afk_` and is shown once.
- `SPENDBOOK_ENDPOINT`: the AI Spendbook API base URL, `https://www.aispendbook.com` on the hosted service. Events go to `https://www.aispendbook.com/api/v1/ingest/batch`.
- Billing data comes from the provider connectors ([Anthropic](https://www.aispendbook.com/docs/anthropic), [OpenAI](https://www.aispendbook.com/docs/openai), [Google Gemini](https://www.aispendbook.com/docs/google-gemini)). The SDK adds who and what each request was for.
- No provider connector has been run against a live account yet. Check the first sync against the provider's own console.

Next: the full [Python SDK](https://www.aispendbook.com/docs/python-sdk) guide, the [Node.js SDK](https://www.aispendbook.com/docs/node-sdk), [framework traces](https://www.aispendbook.com/docs/agent-frameworks), or [the ingestion API](https://www.aispendbook.com/docs/ingestion-api) for other languages.
