Home Explore Blog Models CI



ragit

1st chunk of `docs/commands/audit.txt`
6771e0ad3fc82ad457412d4c7c9251b31dd8d3141acfc16500000001000004f7
rag-audit(1)
==========

NAME
----
rag-audit - Show how much you spent using LLMs

SYNOPSIS
--------
[verse]
'rag audit' [--this-week] [--only-tokens | --only-costs]
            [--category | -c <category>] [--json | -j]

DESCRIPTION
-----------
This command shows how much you spent using LLMs. It works only if you have
enabled `rag config --set dump_api_usage true`.

With `--category` flag, you can inspect with more details. For example, with
`--category=create_chunk_from`, you can see how much you've spent creating
chunks. If you just want the total amount, use `--category=total`. Available
categories are: "create_chunk_from", "describe_image", "rerank_summary",
"answer_query_with_chunks", "rephrase_multi_turn", "raw_request",
"extract_keywords", "agent" and "pdl".

If `--json` is set, it dumps a valid json to stdout. Its schema is,

- category is not set: `{ category: { "total tokens": int, "input tokens": int, "output tokens": int, "total cost": float, "input cost": float, "output cost": float } }`
- category is set: `{ "category": str, "total tokens": int, "input tokens": int, "output tokens": int, "total cost": float, "input cost": float, "output cost": float }`
- `--only-tokens` and `--only-costs` change the schema, but `--this-week` does not.

Title: Rag-Audit Command
Summary
The rag-audit command displays the amount spent using Large Language Models (LLMs), with options to filter by category, output format, and time period. It provides detailed information on token usage and costs, and can output results in JSON format for further analysis or processing.