Home Explore Blog CI



ragit

1st chunk of `docs/commands/audit.txt`
14eef986f5abbb4d4972a932a1ac7d774321b4b85ee7c8aa00000001000004f9
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" and "summary_chunks".

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 Documentation
Summary
The rag-audit command displays the total spend on LLMs, with options to filter by category, output format, and time period, providing detailed usage and cost information, including total tokens, input tokens, output tokens, total cost, input cost, and output cost, with support for JSON output and various categories such as create_chunk_from, describe_image, and answer_query_with_chunks.