Apache Casbin Gateway
4. Governance

4.2 LLM Records

Every request an agent relayed through Gateway: the full system prompt, every message and tool call, the schema of every tool the model was offered, plus tokens and cost.

LLM Records

This is the page that answers "what did the agent actually send", which a token count never does.

Read this before you route an agent

Every relayed request is recorded in full from the first one, prompt included. None of it leaves this machine — but a prompt carries whatever was pasted into it, so if that is not what you want, change it first.

The picker at the top of the page has three positions, and so does Settings → LLM records:

ModeKept
Recording off (off)Nothing
Record metadata (metadata)Who called which model, with which outcome
Record metadata and bodies (full, the default)The above, plus the request body — prompts, messages and tool schemas

A change takes effect from the next request.

The limits around it

Seeded from conf/app.conf, changed on the Settings page:

llmRecordMode = "full"
llmRecordRetentionDays = 30
llmRecordMaxRecords = 10000
llmRecordMaxPayloadBytes = 1048576

What is not stored

  • Request headers never reach a record at all, which is where the inbound API key is.
  • Bodies are sanitized before they are stored: anything that looks like a credential is replaced, and the number of replacements is shown with the record.
  • A body over llmRecordMaxPayloadBytes keeps its structure and loses only its longest strings, so a large conversation is still listed message by message.

When the model asked for was not the model served

A request can be answered by a model other than the one the client named: a routing rule, or the downgrade taken when the model above it could not answer. The record of such a request carries Routed to, the name that actually went on the wire, and Routed by, the rule that chose it. Neither appears when nothing was routed.

Every attempt the request failed over from is listed with the provider, the model it asked for and why it did not answer, so a turn served by a lesser model says what was tried above it.

The cost column

Worked out from list prices, which vendors change and resellers do not follow, and priced against the model that was actually billed rather than the one the client asked for. Two ways to correct it:

  • Edit the price on the Model pricing page (4.3).
  • Point llmPricingFile at a JSON file of your own rates.

Records against the other two pages

PageCoversSource
LLM RecordsRequests Gateway relayedThe proxy
Agent RecordsTool calls a monitored agent madeThe monitoring hook
Agent SessionsWhole conversations, routed or notThe agent's own transcripts

Next: 4.3 Usage and model pricing.

Edit on GitHub
Apache Incubator

Apache Casbin (Incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Copyright © 2026 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.

Apache, Apache Casbin, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. All other marks mentioned may be trademarks or registered trademarks of their respective owners.

On this page