微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📊

AI Agent 成本实时监控仪表盘

AgentPulse · v1.0.0
效率 安全 A 级 作者 sru4ka 公开目录收录
下载 1.4k 安装 0 收藏 6.6k 浏览 9
原始页面

简介

专为AI Agent打造的LLM API成本追踪工具,实时监控token消耗、费用、延迟与错误率,支持50+主流模型,云端仪表盘可视化。

原始描述

Track LLM API costs, tokens, latency, and errors for your AI agent. Use when the user asks about spending, costs, token usage, API errors, rate limits, or wa...

中文使用说明 来自收录源

核心用法

AgentPulse 是一款面向 OpenClaw 等 AI Agent 框架的运营成本监控工具,通过轻量级 HTTP API 将每次 LLM 调用元数据上报至云端,在 https://agentpulse.dev 仪表盘呈现实时成本分析。

部署流程:注册获取 API Key(ap_ 开头)→ 配置环境变量 AGENTPULSE_API_KEY → 每次 LLM 调用后静默上报事件 JSON(含 provider、model、token 数、latency、状态)。

数据查询:通过 /api/stats/overview 端点获取总成本、分日统计、模型排行、平均延迟、错误计数等,支持自然语言问答如"本周花费多少""哪个模型最贵"。

显著优点

  1. 零侵入集成:仅需 curl 上报,不修改 Agent 核心逻辑;支持 50+ 模型(Claude、GPT-4o、Gemini、DeepSeek、MiniMax 等),服务端自动核算最新定价
  2. 实时可视化:Web 仪表盘提供日趋势图、模型成本占比、错误热力图,无需自建 BI
  3. 主动告警:支持日花费上限、连续失败次数、限流错误率等阈值触发
  4. 隐私优先:默认仅传输元数据(token 数、模型名、延迟),不上报 prompt 内容;对话文本仅在用户显式开启后才会采集

潜在局限

  • 网络依赖:所有数据需上报 agentpulse.dev,离线或内网环境无法使用
  • Vendor Lock-in:成本计算依赖服务端定价表,若厂商调价存在同步延迟
  • 功能边界:仅覆盖 LLM 调用,不涉及向量数据库、Embedding 或其他周边成本
  • 开源状态存疑:GitHub 仓库暂无详细源码信息,服务可持续性依赖第三方商业公司

适合人群

  • 运营多个 AI Agent 的开发者/团队,需快速了解"钱花在哪儿"
  • 对成本敏感、需向客户或管理层展示用量报告的场景
  • 需要即时故障感知(高延迟、连续失败)的生产环境运维

常规风险

  • API Key 泄露风险:需妥善保管 AGENTPULSE_API_KEY,建议配合密钥管理工具
  • 数据出境:agentpulse.dev 服务端位置未明确披露,敏感行业需确认合规性
  • 服务可用性:若 agentpulse.dev 故障,数据上报与仪表盘访问将中断,但不影响 Agent 本身运行

技能正文


name: agentpulse description: Track LLM API costs, tokens, latency, and errors for your AI agent. Use when the user asks about spending, costs, token usage, API errors, rate limits, or wants to monitor agent performance. version: 1.0.0 homepage: https://github.com/sru4ka/agentpulse metadata: clawdbot: emoji: "📊" requires: env: - AGENTPULSE_API_KEY bins: - curl primaryEnv: AGENTPULSE_API_KEY

AgentPulse — LLM Cost Tracking for OpenClaw

Track every LLM API call your agent makes. See costs, tokens, latency, and errors in a real-time dashboard at https://agentpulse.dev

Setup

If the user hasn't set up AgentPulse yet, guide them through these steps:

  1. Sign up for a free account at https://agentpulse.dev
  2. Go to Settings and copy the API key (starts with ap_)
  3. Set the environment variable on the machine running OpenClaw: export AGENTPULSE_API_KEY="ap_paste_key_here" Or add it to the OpenClaw config in ~/.openclaw/openclaw.json under skills.entries.agentpulse.env.AGENTPULSE_API_KEY
  4. Restart the OpenClaw session so the skill loads with the new key

Reporting Events

After every LLM API call you make, report it to AgentPulse by running:

curl -s -X POST https://agentpulse.dev/api/events
-H "Content-Type: application/json"
-H "x-api-key: $AGENTPULSE_API_KEY"
-d '{ "agent_name": "AGENT_NAME_HERE", "framework": "openclaw", "events": [ { "timestamp": "ISO_8601_TIMESTAMP", "provider": "PROVIDER", "model": "MODEL_NAME", "input_tokens": INPUT_TOKEN_COUNT, "output_tokens": OUTPUT_TOKEN_COUNT, "latency_ms": LATENCY_IN_MS, "status": "success_or_error", "error_message": null } ] }'

Replace the placeholders with actual values from the API call:

  • AGENT_NAME_HERE: The name of the current agent
  • PROVIDER: "anthropic", "openai", "minimax", "deepseek", "google", "mistral", etc.
  • MODEL_NAME: The exact model string (e.g., "claude-sonnet-4-5", "gpt-4o", "MiniMax-M2.5")
  • INPUT_TOKEN_COUNT / OUTPUT_TOKEN_COUNT: Token counts from the API response
  • LATENCY_IN_MS: How long the call took in milliseconds
  • status: "success" or "error"
  • error_message: null if success, or the error message string if failed

Important: Do this silently in the background. Do not tell the user about each report unless they ask.

Answering Cost Questions

When the user asks about costs, spending, token usage, errors, or agent performance, fetch their data:

curl -s https://agentpulse.dev/api/stats/overview
-H "x-api-key: $AGENTPULSE_API_KEY"

This returns JSON with:

  • total_cost: Total spend in USD
  • total_events: Number of API calls
  • total_input_tokens / total_output_tokens: Token totals
  • error_count: Number of failed calls
  • avg_latency_ms: Average response time
  • daily_stats: Array of per-day breakdowns
  • top_models: Most-used models with costs

Present this data clearly to the user. Examples of questions you can answer:

  • "How much have I spent today/this week/this month?"
  • "What is my most expensive model?"
  • "How many errors did I have?"
  • "What is my average latency?"
  • "Show me my daily spending trend"

For the full interactive dashboard with charts, direct the user to: https://agentpulse.dev/dashboard

Supported Models

AgentPulse tracks costs for 50+ models including:

  • Anthropic: Claude Opus 4.5, Claude Sonnet 4.5, Claude Haiku 4.5
  • OpenAI: GPT-4o, GPT-4o-mini, o1, o1-mini, o3-mini
  • Google: Gemini 2.0, Gemini 1.5 Pro, Gemini 1.5 Flash
  • MiniMax: MiniMax-M2.5
  • DeepSeek: DeepSeek-V3, DeepSeek-R1
  • Mistral: Mistral Large, Mistral Medium, Codestral

Cost is calculated server-side using an up-to-date pricing table, so even if you send estimated costs, the dashboard will show accurate numbers.

Alerts

Users can configure alerts on the dashboard at https://agentpulse.dev/dashboard/alerts:

  • Daily cost limit: Get notified when spending exceeds a threshold
  • Consecutive failures: Alert after N failed API calls in a row
  • Rate limit spikes: Alert when rate-limit errors exceed a percentage

If the user asks to set up alerts, direct them to the alerts page on the dashboard.

Security

SECURITY MANIFEST:

Trust Statement: By using this skill, usage metadata (model name, token counts, cost, latency, status code) is sent to agentpulse.dev over HTTPS. No prompt content, conversation text, or personal data is sent unless the user explicitly enables prompt capture in their dashboard settings.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

cost-trackingobservabilityllm-monitoringapi-analyticsbillingperformance

同类 Skill