Documentation
AgentCost tracks what your LLM calls cost and attributes each one to the agent, workflow and project that made it. Start with the SDK if you are instrumenting an application, the REST API if you are integrating directly, or the OpenAPI specification if you are an agent.
Quick start
pip install agentcost import agentcost agentcost.init(api_key="sk_your_project_key")
Install, initialise with two lines, and track every OpenAI, Anthropic, Gemini and LangChain call without changing your code. Covers configuration, agent tagging, workflows, streaming, local mode, event structure and troubleshooting.
Authentication, ingestion, analytics, projects and budgets, endpoint by endpoint — plus the public pricing endpoints that need no credentials and the structured error envelope every failure returns.
agentcost analyze estimates the cost risk in a codebase before it ships: oversized prompts, repeated work inside a run, unbounded loops. Flags, output formats and CI usage.
Every model AgentCost can bill, with live per-1,000-token input, output and cached rates across OpenAI, Anthropic, Google, AWS, Azure and 50+ other providers, plus announced retirement dates.
Field by field: what the SDK transmits, what it never collects, what is hashed, how hosted and local mode differ, how long data is retained, and how to verify all of it yourself.
The complete AgentCost API surface: every operation typed, with a unique operationId and a description. YAML mirror at /api/openapi.yaml.
Model pricing and cost estimation, cached and always awake. No credentials, no sign-up, no rate-limit negotiation.
This site indexed for agents, in the llmstxt.org format, including when-to-use guidance. Every page also answers to Accept: text/markdown.
Every public page concatenated into a single markdown document.