Get started
Introduction
AgentCost is cost observability for LLM agents.
To get started with AgentCost, you'll need:
- A free account with a project — an API key is created for you at sign-up
- The SDK for your language: Python (
pip install agentcost) or TypeScript / JavaScript (npm install @agentcost/sdk)
Then every OpenAI, Anthropic, Gemini and LangChain call is priced and attributed to the agent, workflow and step that made it:
- Track: cost per call, per agent and per run, with token counts and latency
- Guard: monthly budgets, anomaly detection and per-agent tool guardrails
- Predict: price a codebase before it ships with the CLI
Quick start
Python: two lines. Your existing calls are tracked without changes.
pip install agentcost
from agentcost import track_costs
track_costs.init(api_key="sk_your_project_key", project_id="your-project-uuid")TypeScript: initialise once, then wrap each client you want tracked.
npm install @agentcost/sdk
import * as agentcost from "@agentcost/sdk";
agentcost.init({ apiKey: "sk_your_project_key", projectId: "your-project-uuid" });
const client = agentcost.instrumentOpenAI(new OpenAI());Guides
Learn how to get AgentCost set up in your project.
Machine-readable resources
The same surface for agents and tooling.
OpenAPI 3.1 spec
Every operation typed, with a unique operationId. YAML mirror at /api/openapi.yaml.
MCP endpoint
Streamable HTTP. Pricing capabilities as typed MCP tools for any client that speaks the protocol, and your own spend with an API key.
Public API
Model pricing and cost estimation, cached and always awake. No credentials.
llms.txt
This site indexed for agents. Every page also answers to Accept: text/markdown.