Skip to content

Getting Started

Get AgentCost running in under 60 seconds.

Installation

pip install agentcostin
pip install agentcostin[server]
git clone https://github.com/agentcostin/agentcost.git
cd agentcost
docker compose -f docker-compose.dev.yml up
git clone https://github.com/agentcostin/agentcost.git
cd agentcost
pip install -e ".[dev,server]"

First Trace

Wrap your OpenAI client with trace():

from agentcost.sdk import trace
from openai import OpenAI

client = trace(OpenAI(), project="my-app")

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}]
)

Every call through client is now tracked automatically.

Launch the Dashboard

agentcost dashboard

Open http://localhost:8500 to see your cost data.

Seed demo data

To see the dashboard with data immediately:

curl -X POST http://localhost:8500/api/seed \
  -H "Content-Type: application/json" \
  -d '{"days": 14, "clear": true}'

Configuration

AgentCost is configured via environment variables:

Variable Default Description
AGENTCOST_PORT 8500 Server port
AGENTCOST_EDITION auto community, enterprise, or auto
AGENTCOST_DB_URL SQLite PostgreSQL URL for enterprise
AGENTCOST_AUTH_ENABLED false Enable SSO (enterprise only)

Check Your Edition

agentcost info
🧮 AgentCost v1.0.0
   Edition: 🌐 Community

   Core Features (MIT):
     ✅ tracing
     ✅ dashboard
     ✅ forecasting
     ✅ optimizer
     ✅ analytics
     ✅ estimator
     ✅ plugins
     ✅ cli
     ✅ otel_export

Next Steps