# Zexl > Zexl helps teams cut their AI bill by showing what went wrong: how much OpenAI and Anthropic spend did useful work, what was wasted (retries, agent loops, abandoned responses, answers cut off and redone, prompt caching not used), and the change that fixes each. It records call metadata only; prompts never leave the customer's process. Python SDK: `pip install zexl`. MCP server: `uvx zexl-mcp`. ## About - [What is Zexl](https://tryzexl.xyz/what-is-zexl): what Zexl does, how it works, the five kinds of waste and the key facts - [Zexl for AI assistants](https://tryzexl.xyz/ai): facts, when Zexl fits and when it does not, and sources - [Pricing](https://tryzexl.xyz/pricing): free during early access, every feature, no card ## Get started - [What Zexl is](https://tryzexl.xyz/docs/introduction.md): Zexl shows how much of your AI model spend did useful work, and how much was wasted. It names the waste in plain words, puts a dollar figure on each kind, and shows you the runs behind it. - [Quickstart: Python SDK](https://tryzexl.xyz/docs/quickstart.md): About 5 minutes. You need a Python app that calls OpenAI or Anthropic with their official Python packages. - [Connect with your AI agent](https://tryzexl.xyz/docs/connect-with-ai.md): Let Claude Code, Cursor or another coding agent add Zexl to your project. You approve one link; the agent does the rest. The key never passes through the chat. - [Track Claude Code](https://tryzexl.xyz/docs/claude-code.md): Claude Code can export its usage with OpenTelemetry. Point it at Zexl to see what your coding sessions cost, by model and by repository. No SDK and no code change. ## Concepts - [Environments and keys](https://tryzexl.xyz/docs/environments.md): A workspace is one team or product. Inside it, every call carries an environment label: production, staging, development, or a short label of your own. - [Features, runs and customers](https://tryzexl.xyz/docs/labels.md): Labels turn "we spent $4,000" into "the report builder spent $1,900, and $600 of it was loops". - [Waste patterns explained](https://tryzexl.xyz/docs/patterns.md): Every call gets exactly one category: useful, or one of five waste patterns. Waste is charged to the call that produced nothing, not to the call that later worked. A figure marked ≈ includes an estimate. - [Forecast and budget](https://tryzexl.xyz/docs/forecast.md): Set one monthly budget for the workspace on the Budget page. It counts every environment, because every environment is on your provider bill. The overview shows what is left. Zexl never blocks a call. ## Using Zexl - [Using the dashboard](https://tryzexl.xyz/docs/dashboard.md): The left sidebar has every page. Under the workspace picker is the environment switch (Production, Staging, All). Most pages also have a period (7, 30 or 90 days). Both are kept in the URL, so you can share a view. - [MCP server](https://tryzexl.xyz/docs/mcp.md): zexl-mcp lets AI assistants read your Zexl figures and set up new projects. It runs on your machine and talks to the Zexl API with a read key: it cannot send data or change anything. ## Reference - [What leaves your process](https://tryzexl.xyz/docs/privacy.md): The SDK builds every record from a fixed allowlist. This is the complete list of what is sent: - [Gateway and guardrails](https://tryzexl.xyz/docs/gateway.md): The Zexl gateway is for teams that cannot add the SDK, use a language other than Python, call providers other than OpenAI and Anthropic, or want rules that stop a call: a step limit for agents, a cost limit per run, a list of allowed models, or a hard stop at the month budget. - [Troubleshooting](https://tryzexl.xyz/docs/troubleshooting.md): 1. Make sure the app made a model call through the openai or anthropic Python package. 2. Check import zexl.auto runs before the client is created. 3. Check ZEXL_API_KEY is set in that process, with the part after the dot. 4. Print zexl.status() in the app. It shows whether capture is on, which hooks are active, and how many records were sent or dropped. 5. Look for a warning on the zexl logger. 6. Check the dashboard's environment switch: a development key's calls are not in Production. Try All. ## Guides - [Best way to track wasted spend on OpenAI API calls](https://tryzexl.xyz/guides/track-wasted-openai-spend.md): How to track wasted spend on OpenAI API calls: what the Usage Dashboard shows, where it stops, and how to find retries, loops and unused caching. - [Token cost calculation](https://tryzexl.xyz/guides/token-cost-calculation.md): Token cost calculation is working out what an LLM API call costs from its input and output tokens and the model's price per million tokens. - [Langfuse alternatives and when to switch](https://tryzexl.xyz/guides/langfuse-alternatives.md): Langfuse alternatives compared on license, self-hosting, SSO, retention and price: LangSmith, Braintrust and Zexl, and when Langfuse is still the right pick. - [Best LLM cost monitoring tools, grouped by the job they do](https://tryzexl.xyz/guides/best-llm-cost-monitoring-tools.md): The best LLM cost monitoring tools by job: tracing platforms, gateways, cloud cost tools and waste finders, with what each one is built for and what it costs. - [LLM cost monitoring ROI: metrics that show value](https://tryzexl.xyz/guides/llm-cost-monitoring-roi-metrics.md): How to measure the ROI of LLM and AI agent spend: the cost metrics to track, the value metrics to pair them with, and how long results take. - [How to reduce your LLM API costs](https://tryzexl.xyz/guides/reduce-llm-api-costs.md): A practical checklist to cut OpenAI and Anthropic API costs: find the waste first, then fix caching, loops, retries, output limits and model choice. - [Prompt caching with OpenAI and Anthropic](https://tryzexl.xyz/guides/prompt-caching.md): How prompt caching works on OpenAI and Anthropic, how to structure prompts so the cache hits, and how to check from token counts that it is working. - [AI agent loops: how to find and stop them](https://tryzexl.xyz/guides/ai-agent-loops.md): Why AI agents get stuck repeating the same step, what it costs, how to detect a loop from call data, and the guards that stop it. - [Retries and cut-off answers](https://tryzexl.xyz/guides/retries-and-cut-off-answers.md): What LLM retries and answers cut off at max_tokens really cost, how to spot them from finish_reason and status codes, and how to fix both. - [Claude Code cost tracking](https://tryzexl.xyz/guides/claude-code-cost-tracking.md): Track Claude Code usage and cost per developer, model and repository with its built-in OpenTelemetry export. Setup in five environment variables. - [LLM cost monitoring: what to measure](https://tryzexl.xyz/guides/llm-cost-monitoring.md): What to measure to control LLM costs, the three ways to collect it (provider dashboards, a proxy, an SDK), and how to do it without storing prompts. ## Optional - [All docs and guides in one file](https://tryzexl.xyz/llms-full.txt)