For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
  • About NVIDIA NeMo Relay
    • Overview
    • Architecture
    • Ecosystem
    • Concepts
    • Release Notes
  • Getting Started
    • Agent Runtime Primer
    • Prerequisites
    • Installation
    • Configuration / Setup
    • Quick Start
  • NVIDIA NeMo Relay CLI
    • About
    • Basic Usage
    • Claude Code
    • Codex
    • Cursor
    • Hermes Agent
  • Supported Integrations
    • About
    • OpenClaw Plugin Guide
    • LangChain Integration Guide
    • LangGraph Integration Guide
    • Deep Agents Integration Guide
  • Instrument Applications
    • About
    • Adding Scopes and Marks
    • Instrument a Tool Call
    • Instrument an LLM Call
    • Add Middleware
    • Code Examples
  • Observability Plugin
    • About
    • Configuration
    • Agent Trajectory Interchange Format (ATIF)
    • Agent Trajectory Observability Format (ATOF)
    • OpenTelemetry
    • OpenInference
  • Adaptive Plugin
    • About
    • Configuration
    • Adaptive Cache Governor (ACG)
    • Adaptive Hints
  • NeMo Guardrails Plugin
    • About
    • Configuration
  • Integrate into Frameworks
    • About
    • Adding Scopes
    • Wrap Tool Calls
    • Wrap LLM Calls
    • Handle Non-Serializable Data
    • Using Codecs
    • Provider Codecs
    • Provider Response Codecs
    • Code Examples
  • Build Plugins
    • About
    • Define a Plugin
    • Validate Plugin Configuration
    • Plugin Configuration Files
    • Register Plugin Behavior
    • Design Plugin Configuration
    • NeMo Guardrails Example Plugin
    • Code Examples
  • Contribute
    • About
    • Development Setup
    • Workflow and Reviews
    • Testing and Documentation
  • Reference
    • APIs
      • Python Library Reference
        • nemo_relay
        • adaptive
        • codecs
        • guardrails
        • integrations
        • intercepts
        • llm
        • observability
        • plugin
        • scope
        • scope_local
        • subscribers
        • tools
        • typed
        • utils
      • Node.js Library Reference
      • Rust Library Reference
    • Performance
  • Resources
    • Support and FAQs
    • Glossary
    • Troubleshooting Guide
    • Community
    • Legal
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Your Privacy Choices | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogo
On this page
  • Classes
  • LlmCodec(Protocol)
  • Methods
  • decode
  • encode
  • LlmResponseCodec(Protocol)
  • Methods
  • decode_response
  • OpenAIChatCodec
  • Methods
  • OpenAIChatCodec
  • decode
  • encode
  • decode_response
  • OpenAIResponsesCodec
  • Methods
  • OpenAIResponsesCodec
  • decode
  • encode
  • decode_response
  • AnthropicMessagesCodec
  • Methods
  • AnthropicMessagesCodec
  • decode
  • encode
  • decode_response
ReferenceAPIsPython Library Reference

nemo_relay.codecs

||View as Markdown|
Previous

nemo_relay.adaptive

Next

nemo_relay.guardrails

Generated from python/nemo_relay/codecs.pyi.

Module nemo_relay.codecs.

Protocol definitions for request and response codecs used by nemo_relay.llm.

Classes

LlmCodec(Protocol)

Protocol for request codecs used by annotated LLM intercepts.

Methods

decode
1def decode(request: LLMRequest) -> AnnotatedLLMRequest

Decode a raw provider request into AnnotatedLLMRequest.

encode
1def encode(annotated: AnnotatedLLMRequest, original: LLMRequest) -> LLMRequest

Merge annotated edits back into the original raw request.

LlmResponseCodec(Protocol)

Protocol for codecs that normalize raw LLM responses.

Methods

decode_response
1def decode_response(response: Json) -> AnnotatedLLMResponse

Decode a raw provider response into AnnotatedLLMResponse.

OpenAIChatCodec

Built-in codec for OpenAI Chat Completions requests and responses.

Methods

OpenAIChatCodec
1def OpenAIChatCodec() -> None

Create an instance.

decode
1def decode(request: LLMRequest) -> AnnotatedLLMRequest

Decode an OpenAI Chat Completions request.

encode
1def encode(annotated: AnnotatedLLMRequest, original: LLMRequest) -> LLMRequest

Encode a normalized request back into Chat Completions format.

decode_response
1def decode_response(response: Json) -> AnnotatedLLMResponse

Decode an OpenAI Chat Completions response.

OpenAIResponsesCodec

Built-in codec for OpenAI Responses requests and responses.

Methods

OpenAIResponsesCodec
1def OpenAIResponsesCodec() -> None

Create an instance.

decode
1def decode(request: LLMRequest) -> AnnotatedLLMRequest

Decode an OpenAI Responses request.

encode
1def encode(annotated: AnnotatedLLMRequest, original: LLMRequest) -> LLMRequest

Encode a normalized request back into Responses format.

decode_response
1def decode_response(response: Json) -> AnnotatedLLMResponse

Decode an OpenAI Responses response.

AnthropicMessagesCodec

Built-in codec for Anthropic Messages requests and responses.

Methods

AnthropicMessagesCodec
1def AnthropicMessagesCodec() -> None

Create an instance.

decode
1def decode(request: LLMRequest) -> AnnotatedLLMRequest

Decode an Anthropic Messages request.

encode
1def encode(annotated: AnnotatedLLMRequest, original: LLMRequest) -> LLMRequest

Encode a normalized request back into Messages format.

decode_response
1def decode_response(response: Json) -> AnnotatedLLMResponse

Decode an Anthropic Messages response.