Our website uses necessary cookies to enable basic functions and optional cookies to help us to enhance your user experience. Learn more about our cookie policy by clicking "Learn More".
Accept All Only Necessary Cookies
NEWSREVIEWSHOWTO

How to Track AI Costs with OpenRouter Activity Dashboard and Analytics API

Dorothy Morgan

Learn how to use the OpenRouter Activity dashboard and beta Analytics API to track AI cost per agent, monitor model spending, and drill into individual requests.

Catelog

    Every company that deployed AI agents in the last two years is now asking the same question: what are these agents costing us, and which ones are worth the spend? OpenRouter's Activity dashboard and beta Analytics API give you that answer per agent, per model, and per request.

    This tutorial walks you through the complete workflow: reading the overview, building custom views in Explore, drilling into individual requests, and querying the same data through the Analytics API. If you manage an OpenRouter account for your team or yourself, you'll know exactly where your money goes by the end.

    How to Track AI Costs with OpenRouter Activity Dashboard and Analytics API

    How To

    How to Track AI Costs with OpenRouter Activity Dashboard and Analytics API

    Learn how to use the OpenRouter Activity dashboard and beta Analytics API to track AI cost per agent, monitor model spending, and drill into individual requests.

    Learn More

    Prerequisites: What You Need Before Starting

    You don't need much to get started, but a few things are required.

    1. An OpenRouter account. If you don't have one yet, sign up at openrouter.ai. The Activity dashboard is available to all account types, including personal accounts.
    2. An API key. You'll need at least one API key to access OpenRouter usage. For the Analytics API, you need a management key, not a regular inference key. Regular inference keys get a 403 error when you try to query analytics endpoints.
    3. Some usage history. Activity pulls from your existing request data, so you need at least a few API calls on your account for the dashboard to show anything meaningful.

    That's it. No special software, no local setup. Everything runs in your browser at openrouter.ai/activity, or through the API from your terminal.

    1. Reading the Activity Dashboard Overview

    The Overview tab is your starting point. Open it and you get five metrics at the top: total spend, requests, token volume, cache hit rate, and blended cost per million tokens. Each one comes with a sparkline and a comparison against the previous period, so you can tell at a glance whether things are trending up or down.

    Below those headline numbers, you'll find several panels:

    • Top users and apps: who's driving the most usage. In an organization, this ranks your top users and apps. In a personal account, it ranks your top API keys and apps.
    • Spend by model: which models are costing you the most. Model spending concentrated on one expensive model is a red flag worth investigating. Helpful for spotting when a single expensive model dominates your bill.
    • OpenRouter credits vs BYOK spend: how much you're spending through OpenRouter credits versus bring-your-own-key arrangements.
    • Request volume by model: how many requests each model handles, which is different from spend because cheap models can have high volume.
    • Prompt and completion token breakdown: where your tokens are going. A model that generates long completions costs more than one that answers in a few words.
    • Prompt caching: how much you're saving through cached prefixes.

    Spend a few minutes here before jumping into Explore. The Overview tells you what's happening at a high level. If something looks off, that's your signal to dig deeper.

    2. Building Custom Views with Activity Explore

    Every card on the Overview tab links into Explore, where you build the view yourself. This is where the OpenRouter Activity dashboard gets powerful for AI cost tracking.

    Choosing Your Metric

    Pick what you want to measure. The options go beyond simple spend:

    • Total usage (spend in dollars)
    • Request count
    • Tokens, broken down by prompt, completion, reasoning, or cached
    • Cache hit rate
    • Blended cost per million tokens
    • BYOK versus credit spend
    • Latency and throughput at P50, P90, and P99 percentiles

    If you're tracking AI agent costs, start with total usage grouped by app or API key. That tells you which agent is burning through your budget. For team leads, monitoring agent spending by API key is the fastest way to find a runaway pipeline before it drains your credits.

    Grouping Your Traffic

    Choose up to two dimensions to break the metric down. The available dimensions include model, variant, provider, API key, app, user, workspace, origin, country, data region, finish reason, context length, session, generation, custom user IDs, and any classifier dimension you've defined.

    Two dimensions mean you can cross-reference. Group by model AND app to see which app uses which model. Group by country AND model to see geographic patterns. The combinations depend on what questions you're asking.

    Setting Rollup and Chart Type

    Roll the data up by minute, hour, day, week, or month for a time series. Or drop the time axis entirely for a ranked table, which is useful when you want a simple list of top spenders.

    Chart types: bar, line, or dot plot. Pick whichever makes your data readable. Bar charts work well for ranked comparisons. Line charts show trends over time. Dot plots help when you have many data points with outliers.

    Saving Your Custom Charts

    Once you've built a view you want to revisit, save it. Open the options menu in the Explore controls, choose Save current chart, and give it a name. In an organization, you also choose visibility: Only me or Everyone in my organization. Saved charts keep the metric, dimensions, filters, chart type, rollup, ranking, and date range.

    You can also download any chart's data as CSV or PDF. Handy for sharing with someone who doesn't have OpenRouter access, or for pasting into a spreadsheet.

    3. Drilling from Charts to Individual Requests

    Aggregates tell you something got expensive. The next question is which requests caused it.

    Every chart and ranked table in Activity links through to your logs. Click a bar in a chart, a stacked segment, or a row in a ranked table. You land in the logs filtered to those specific requests, with the grouping and time bucket carried over from what you clicked.

    Open any row in the logs for the Generation detail view. Here's what you get:

    • Cost: upstream inference, caching, web search, and file processing charges, plus discounts and cache savings applied.
    • Performance: provider latency, throughput, and time to first token.
    • Routing: which provider served the request, whether it fell back to another provider, and the finish reason.
    • Attribution: the app, API key, and workspace behind the request, plus session and request IDs and data region.
    • Context: guardrail events, classifier tags, and raw metadata.

    The Prompt detail view renders the full messages array and a flamegraph of estimated tokens per message, colored by role: system, user, assistant, and tool. A conversation that costs three times what you expected usually shows it here as a wide band of tool calls or a heavy system prompt. The cached prefix is shaded, so you can see how far into the prompt the cache held and which message broke it.

    One important catch: prompt and completion content only exists if private input/output logging was enabled when the request ran. You can enable it in your workspace under Observability. Turning it on later doesn't recover content for past requests. If you need to inspect prompts, make sure logging is on before you need it.

    OpenRouter Web Search Benchmark Review: Is It a Practical Search Engine for AI Agents?

    Reviews

    OpenRouter Web Search Benchmark Review: Is It a Practical Search Engine for AI Agents?

    OpenRouter web search benchmark review testing AI web search depth, model routing, agent research quality, and search cost.

    Learn More

    4. Querying the OpenRouter Analytics API

    Everything available in Explore is also available through the beta Analytics API. This is where OpenRouter usage tracking becomes programmable. Point your agent at the data, get a quick answer in your terminal, or pull numbers into your own dashboards.

    Two Endpoints

    The Analytics API has two endpoints:

    GET /api/v1/analytics/meta returns the currently supported metrics, dimensions, filter operators, and granularities. Call this first to see what's available. OpenRouter is always adding new metrics and dimensions, so the metadata endpoint is your source of truth for what you can query.

    POST /api/v1/analytics/query runs the query and returns the same aggregates the Explore charts are drawn from.

    Making Your First Query

    Here's a basic example that pulls total spend, token volume, and cache hit rate grouped by model over a one-month window:

    
    curl -X POST https://openrouter.ai/api/v1/analytics/query \
      -H "Authorization: Bearer $OPENROUTER_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "metrics": ["total_usage", "tokens_total", "cache_hit_rate"],
        "dimensions": ["model"],
        "granularity": "day",
        "time_range": {"start": "2026-07-01T00:00:00Z", "end": "2026-08-01T00:00:00Z"},
        "limit": 20
      }'
    

    Replace $OPENROUTER_API_KEY with your management key. A regular inference key will return a 403 error.

    Working with the Results

    The response contains the same aggregated data that powers the Explore charts. Each row corresponds to a group defined by your dimensions, with the metrics you requested. Use the granularity parameter to control time bucketing (minute, hour, day, week, month), or drop it for a ranked table.

    For automated monitoring, you can script this. Run a daily cron job that queries yesterday's spend grouped by model, compare it to a threshold, and alert your team if something spikes. The API returns JSON, so it drops straight into any data pipeline.

    5. Automating Cost Analysis with AI Agents

    OpenRouter published a cost control cookbook that puts your AI agent in charge of spend analysis. Give your coding agent a management key and the openrouter-analytics skill, and it runs a cost review on your account.

    What the Cookbook Does

    The agent finds models costing a multiple of your blended rate per million tokens, traces them back to the keys and pipelines responsible, and returns ranked recommendations. It's not just reporting numbers. It's doing the investigative work of figuring out where the waste is.

    A Real Example from OpenRouter

    OpenRouter ran this internally and found a preview model burning roughly $6,200 per month at about 25x the organization's blended rate. One drill-down query later, 98% of that spend traced to a single batch-pipeline key running a task that never needed a frontier model. The fix was a one-line model swap.

    That's the kind of finding that's easy to miss when you only look at aggregate numbers. A single expensive model in a batch pipeline doesn't show up as unusual in a monthly total. It shows up when you group by model AND API key and compare to your blended rate. The cookbook walks through the exact query recipes and agent prompts to replicate this kind of audit.

    6. Monitoring Guardrails and Sensitive Data

    The Guardrails tab shows what your prompt injection and sensitive-information rules blocked, redacted, or flagged. If you're running agents that process user input, this is where you check whether your safety rules are actually working.

    The tab shows which rules are doing the work, the rate of sensitive data entering your prompts, and which rules and data types are catching it. Filter by workspace or classifier to narrow in on where issues are coming from.

    Expand any card for a full breakdown of which combinations of detected patterns drove each block, redaction, and flag. This level of detail matters because a rule that fires often but catches nothing real is noise. A rule that fires rarely but catches something serious is worth keeping.

    7. Common Issues and Edge Cases

    No Prompt Data in Generation Detail

    If you open a generation and the prompt content is missing, input/output logging wasn't enabled when the request ran. Turn it on under Workspace, then Observability. This only applies to future requests. Past requests without logging stay opaque.

    In an organization, members may not have permission to read another workspace's prompts. If you can see cost and routing data but not prompt content, check your workspace permissions.

    Analytics API Returns 403

    This means you're using a regular inference key instead of a management key. Generate a management key from your OpenRouter settings and use that for analytics queries. The Analytics API requires management-level access.

    Data Range Limitations

    Most queries go back about 365 days. Some metrics read from raw generation records instead of pre-aggregated data, and those have a shorter window:

    • Latency, throughput, generation ID, data region, and classifier filters: roughly 31 days
    • Hour rollups: 31 days max
    • Minute rollups: 3-hour window

    Activity tells you when it clamps your range. If you query six months of latency data and only get the last month, that's why. For long-term latency trends, aggregate daily data yourself rather than querying minute-level granularity over a wide range.

    Organization vs Personal Account Differences

    Organization accounts rank top users and apps. Personal accounts rank top API keys and apps. If you're on a personal account and don't see user-level breakdowns, that's expected. The dimension options also differ slightly depending on account type.

    Trends Tab Shows Unexpected Movement

    The Trends tab sorts by movement instead of size. A model with low total spend but a sharp week-over-week increase will show up high here. That's not a bug. It's the point. Trends catches things that Overview misses because Overview shows absolute size, not velocity. Check both.

    Conclusion

    The OpenRouter Activity dashboard and Analytics API give you visibility into what your AI agents actually cost. Start with Overview for the big picture, move to Explore for custom questions, click through to logs for individual requests, and use the Analytics API when you want to automate the whole process. The cost control cookbook takes it one step further by letting an AI agent run the audit for you.

    If you're spending more than a few hundred dollars a month on AI inference, the time investment to set up saved charts and a simple monitoring script pays for itself fast. The $6,200 wasted on a single wrong model in OpenRouter's own account is proof that nobody is immune to silent overspend. The tools to catch it are all here.

    Back to top

    Featured lists

    NEWSNEWSREVIEWSREVIEWSHOWTOHOWTO
    Latest
    How to Download easyJet: Travel App APK Latest Version 4.22.107 for Android 2026
    How to Download Dunk Shot APK Latest Version 1.4.28 for Android 2026
    How to Download Дія APK Latest Version  for Android 2026
    How to Download MahsaNG VPN APK Latest Version 18 for Android 2026
    Trending
    How to Download Plants vs Zombies Fusion Edition APK Latest Version 4.0.5 for Android 2026
    How to Download Facebook APK Latest Version  for Android 2026
    How to Download WhatsApp Business APK Latest Version 2.26.39.72 for Android 2026
    How to Download YouTube APK Latest Version 21.40.161 for Android 2026
    How to Download WhatsApp Messenger APK Latest Version 2.26.39.74 for Android 2026
    How to Download Roblox APK Latest Version 2.741.1062 for Android 2026
    How to Download GCash APK Latest Version 6.04.0 for Android 2026
    How to Download TradingView: Track All Markets APK Latest Version  for Android 2026
    Subscribe to APKPure
    Be the first to get access to the early release, news, and guides of the best Android games and apps.
    No thanks
    Sign Up
    Subscribed Successfully!
    You're now subscribed to APKPure.