Log Audit

Upload a request log you already have and Nadir replays it through the production router, repricing each request on the model it would have picked.

Upload a request log you already have and Nadir replays it through the same router that runs in production, repricing every request on the model it would have picked. No proxy in front of your traffic, no provider key, no code change.

Warning

Your export must contain the prompt text. The audit re-classifies each prompt, so the prompt is the one field it cannot do without. An OpenRouter activity export, LiteLLM with redact_messages on, and Helicone without body logging all carry model names and token counts but no prompt, and every row of them is skipped as no_prompt_or_messages. If that is your situation, turn body logging on for a day and export that day instead. Nothing else on this page will rescue a prompt-free export.

The format

Newline-delimited JSON: one object per line, no wrapping array. Send it to POST /v1/audit/replay as application/x-ndjson, or drop the file on /dashboard/audit.

requests.jsonl
{"prompt":"Convert this timestamp to ISO 8601: 1712345678","model":"gpt-4o","prompt_tokens":40,"completion_tokens":25,"end_user":"acct_alpha"}
{"messages":[{"role":"system","content":"You are a build assistant."},{"role":"user","content":"Why is my webpack build emitting two copies of react?"}],"model_used":"claude-opus-4-6","input_tokens":900,"output_tokens":700,"user":"acct_alpha"}

Fields

Each field accepts more than one spelling, because every gateway names them differently. The first one present wins.

  • The prompt. prompt as a string, or messages as an OpenAI-shaped array. User turns are joined and the last system message is kept. Required.
  • The model you ran. model_used or model. Without it there is nothing to compare against, and the row is counted but not priced.
  • Input tokens. prompt_tokens or input_tokens. Missing, they are estimated from the prompt text and the row is held out of the headline.
  • Output tokens. completion_tokens or output_tokens. A recorded 0 is believed, because empty completions are real.
  • Cache tokens, optional. cache_read_input_tokens and cache_creation_input_tokens, at the top level or under metadata. Send them if you have them: on cache-heavy traffic they move the answer a lot.
  • Identity, optional. end_user or the OpenAI-compatible user. An opaque label, stored verbatim and never parsed, so send an internal id rather than an email address.

Turning your export into this

Every mapping below is a starting point. Field names in these products move between versions, so open one line of your own export first and check the names against it.

LiteLLM

The SpendLogs table carries request and response bodies when body logging is on. Export it as JSON and pull the prompt out of the request body.

LiteLLM SpendLogs
jq -c '{
  messages: (.request_body.messages // []),
  model: .model,
  prompt_tokens: .prompt_tokens,
  completion_tokens: .completion_tokens,
  end_user: .end_user
} | select(.messages | length > 0)' spendlogs.json > requests.jsonl

Helicone

POST /v1/request/query returns request and response bodies only when body logging is enabled on the key.

Helicone request query
jq -c '.data[] | {
  messages: (.request_body.messages // []),
  model: .request_body.model,
  prompt_tokens: .prompt_tokens,
  completion_tokens: .completion_tokens
} | select(.messages | length > 0)' helicone.json > requests.jsonl

OpenRouter

The activity export carries model, token counts and cost, and no prompt. It cannot be audited. Use your own application log, or proxy a day of traffic through a gateway that records bodies.

Nadir usage logs

If you already send traffic through Nadir, your own usage_logs rows need no mapping. The reader accepts the column names that table uses, model_name, tokens_in and tokens_out, alongside the gateway spellings, and it reads end_user out of the metadata object where we write it. Export the rows as one JSON object per line and upload them as they are. This holds so long as privacy.store_prompts was on when they were written. With it off, the prompt column holds a sha256: digest instead of the text. Those rows are skipped as prompt_hashed and left out of every figure, because a digest is not a prompt and anything classified from one would be a number about nothing.

Calling it directly

POST /v1/audit/replay
curl -X POST "https://api.getnadir.com/v1/audit/replay?source=july-sample" \
  -H "Authorization: Bearer $SUPABASE_JWT" \
  -H "Content-Type: application/x-ndjson" \
  --data-binary @requests.jsonl

Auth is your dashboard session token, not an API key: an audit runs before you have a key. Limits per run are 1,000 lines and 8 MB. Each server process allows 3 runs a minute and 20 a day per account, runs one audit at a time, and holds a daily budget of total replay time, so a busy window can return a 429 that is about the server rather than about you. Oversize uploads are refused rather than truncated, because the first N lines of a log are one time window and one workload, not a smaller sample of the whole.

Reading the result

The report is a COST COUNTERFACTUAL and labels itself one. No model was called, so it makes no quality, accuracy or catastrophic-route claim, and its dollars are never billed.

  • totals_measured is the headline. Rows whose token counts had to be estimated are reported separately in totals_estimated and kept out of it.
  • headline_withheld is a sentence when the run may not publish a savings number, and null when it may. It fires when a model Nadir routes to has no published price, when fewer than half your comparable requests priced on both sides, or when fewer than 20 of them priced at all. Which rows drop out is decided by which model ids have a price, not at random, so the survivors are not a fair sample and their average is not your average. And a percentage over a handful of requests is one workload at one length, not a rate, so a very small log gets its per-request rows and no headline.
  • When it fires, the four aggregate dollar keys are physically removed from the report, and every row carries do_not_aggregate. The per-request costs stay: they are the audit trail that lets you check the refusal.
  • Both floors, the 20 priced requests and the 50% priced share, apply to every saved_pct in the report, not only the headline one. A per-identity block in by_end_user that misses either one reports its dollars and null for its rate. The share matters most per identity: unpriced model ids cluster by team, so one group on an in-house model can be 5% priced while the run as a whole clears the floor.
  • Every block also carries its own rows_tokens_estimated, so an identity whose dollars came from assumed completion lengths says so in its own dict, not only in the run totals.
  • unpriced_models names the ids we could not price. That list is the fix: map an in-house name to the model it actually is and re-run.
  • up_routes lists every request where Nadir would have spent MORE, with the extra cost of each. It is never hidden and never netted away silently.

Info

What the audit does not do. It never calls a model, never calls a provider, and never sends your prompts anywhere: the classifier that reads them runs in the same process that received the upload. The stored report keeps model names, token counts and costs, and has no field for prompt or response text.

Pages on this site

Machine-readable summaries of this site: llms.txt and llms-full.txt.