Skip to content
agentgateway has joined the Agentic AI FoundationLearn more

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Page as Markdown

Cost dashboard

View LLM spend, tokens, and traffic in the built-in Admin UI, grouped by model, provider, and user.

The Model costs guide prices every request and exposes the result to logs, metrics, and CEL. The built-in Admin UI turns that data into a visual dashboard: spend, tokens, and calls over time, broken down by model, provider, user, group, or user agent. No external Prometheus or Grafana is required.

The dashboard is populated from a local database that agentgateway writes for every request that flows through the proxy. Because the accounting happens in the gateway, your applications need no changes. They point at the proxy, and spend shows up next to tokens automatically.

Requirements

Two pieces of configuration power the dashboard:

  • config.database: the SQLite database where agentgateway records a request_logs row for each request. It is the store behind the dashboard’s time series and breakdowns.
  • config.modelCatalog: the model cost catalog that turns token counts into dollars. Without a catalog, the dashboard still shows token and call volume, but the cost is 0.

Enable the dashboard

  1. Add database and modelCatalog to the config section of your config file. The adminAddr field controls where the Admin UI is served (default localhost:15000).

    # yaml-language-server: $schema=https://agentgateway.dev/schema/config
    config:
      adminAddr: localhost:15000
      database:
        url: "sqlite://./data.db?mode=rwc"
      modelCatalog:
      - file: ./costs/catalog.json
    llm:
      port: 4000
      models:
      - name: "*"
        provider: openAI
        params:
          apiKey: "$OPENAI_API_KEY"
  2. Start agentgateway.

    agentgateway -f config.yaml

    Example output:

    INFO app  serving UI at http://localhost:15000/ui

Open the dashboard

Review the dashboard in the LLM > Analytics page. Open http://localhost:15000/ui/llm/analytics. It shows traffic over time with a running tally of cost, tokens, and calls, plus a breakdown below the chart.

agentgateway Analytics dashboard showing token traffic over time, with group-by and measure controls
agentgateway Analytics dashboard showing token traffic over time, with group-by and measure controls

The separate LLM > Costs page (http://localhost:15000/ui/llm/costs) is where you manage the cost catalog (import or override pricing), not where you view spend. See Model costs for catalog setup.

Group by and measure

Use the Group by control to break the same traffic down by:

  • Model: which models drive spend (gen_ai_request_model / gen_ai_response_model).
  • Provider: spend per backend, such as OpenAI, Anthropic, Google, or Bedrock (gen_ai_provider_name).
  • User: per-person accounting, ideal for finding who drives spend (agentgateway_user).
  • Group: spend per team or group (agentgateway_group).
  • User agent: spend per client, such as Cursor, Claude Code, or openai-python (user_agent_name).

Toggle Measure between tokens, cost, and requests to view the same breakdown either way. Set it to Cost to see realized spend in dollars.

agentgateway Analytics dashboard measured in dollars, showing realized spend over time
agentgateway Analytics dashboard measured in dollars, showing realized spend over time

Use Export to pull the underlying numbers out for reporting.

Send traffic and watch it get priced

With the gateway running, send a request that matches a model in your catalog:

curl -s http://localhost:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello from agentgateway!"}]}'

Refresh the Analytics page and the request appears: tokens counted, cost calculated against the catalog, and attributed to the model, provider, and (if present) user. Each request is stored as a request_logs row with the realized cost alongside input_tokens, output_tokens, and total_tokens, which is why the same fields you see in logs and metrics also drive the dashboard.

Persistence and scaling

The dashboard reads from the SQLite database at config.database.url. Point it at a persistent path so history survives restarts. For Helm-based deployments, the chart defaults to SQLite on a ReadWriteOnce volume; see Helm deployment for storage options.

Was this page helpful?
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.