Get started

Introduction

AgentCost is cost observability for LLM agents.

To get started with AgentCost, you'll need:

  1. A free account with a project — an API key is created for you at sign-up
  2. 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.

python
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.

typescript
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.

Packages and source