> This page is for NeMo Relay, version v0.8.4.
> For other versions, use one of these documentation indexes:
> - Latest (v0.11.2) (default): https://docs.nvidia.com/nemo/relay/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/relay/dev/llms.txt
> - v0.11.2: https://docs.nvidia.com/nemo/relay/v0.11.2/llms.txt
> - v0.10.4: https://docs.nvidia.com/nemo/relay/v0.10.4/llms.txt
> - v0.9.4: https://docs.nvidia.com/nemo/relay/v0.9.4/llms.txt
> - v0.8.4: https://docs.nvidia.com/nemo/relay/v0.8.4/llms.txt
> - v0.7.3: https://docs.nvidia.com/nemo/relay/v0.7.3/llms.txt

> For clean Markdown of any page, append .md to the page URL. For a task-oriented documentation index, fetch https://docs.nvidia.com/nemo/relay/llms.txt. Use the documentation version matching the installed NeMo Relay package: latest follows the latest stable release, vX.Y.Z identifies a retained release snapshot, and dev documents development changes. Preserve the selected version when following links; do not mix examples or API contracts from different versions. Fetch the relevant section's /llms.txt before individual pages instead of loading a complete version index.

# Module optimization

> Plugin-neutral evidence recording for managed LLM calls. Managed, bounded LLM optimization accounting.

Generated from `cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker`.

Plugin-neutral evidence recording for managed LLM calls. Managed, bounded LLM optimization accounting.

## Structs

* [LlmOptimizationRecorder](/nemo/relay/v0.8.4/reference/api/rust-library-reference/nemo-relay/api/optimization/struct-llmoptimizationrecorder): Cloneable capability for adding evidence to the current managed LLM call.

## Constants

* [MAX_LLM_OPTIMIZATION_CONTRIBUTIONS](/nemo/relay/v0.8.4/reference/api/rust-library-reference/nemo-relay/api/optimization/constant-max-llm-optimization-contributions): Maximum contributions retained for one LLM call.
* [MAX_LLM_OPTIMIZATION_CONTRIBUTION_ATTEMPTS](/nemo/relay/v0.8.4/reference/api/rust-library-reference/nemo-relay/api/optimization/constant-max-llm-optimization-contribution-attempts): Maximum contribution records inspected before the recorder seals itself.
* [MAX_LLM_OPTIMIZATION_CONTRIBUTION_BYTES](/nemo/relay/v0.8.4/reference/api/rust-library-reference/nemo-relay/api/optimization/constant-max-llm-optimization-contribution-bytes): Maximum serialized size of one complete contribution envelope.
* [MAX_LLM_OPTIMIZATION_TOTAL_CONTRIBUTION_BYTES](/nemo/relay/v0.8.4/reference/api/rust-library-reference/nemo-relay/api/optimization/constant-max-llm-optimization-total-contribution-bytes): Maximum aggregate serialized size of all contribution envelopes for one call.

## Functions

* [current_llm_optimization_recorder](/nemo/relay/v0.8.4/reference/api/rust-library-reference/nemo-relay/api/optimization/fn-current-llm-optimization-recorder): Return a recorder for the current execution intercept, if it is managed by Relay.
* [record_llm_optimization_contribution](/nemo/relay/v0.8.4/reference/api/rust-library-reference/nemo-relay/api/optimization/fn-record-llm-optimization-contribution): Best-effort shorthand for recording evidence on the current managed call.