> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Struct Nemo Relay Native Host ApiV1

> Versioned host API table passed to native plugin entry symbols.

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`.

<pre />

Versioned host API table passed to native plugin entry symbols.

## Fields

### `abi_version: u32`

ABI version implemented by this table.

### `struct_size: usize`

Size of this struct as seen by the host.

### `relay_version: *const c_char`

Null-terminated host Relay version string.

### `string_new: unsafe extern "C" fn(data: *const u8, len: usize, out: *mut *mut NemoRelayNativeString) -> NemoRelayStatus`

Allocates a host-owned string from UTF-8 bytes.

### `string_data: unsafe extern "C" fn(value: *const NemoRelayNativeString) -> *const u8`

Returns the string data pointer for a host-owned string.

### `string_len: unsafe extern "C" fn(value: *const NemoRelayNativeString) -> usize`

Returns the byte length for a host-owned string.

### `string_free: unsafe extern "C" fn(value: *mut NemoRelayNativeString)`

Frees a host-owned string.

### `last_error_clear: unsafe extern "C" fn()`

Clears the host thread-local native ABI error message.

### `last_error_set: unsafe extern "C" fn(message: *const NemoRelayNativeString)`

Sets the host thread-local native ABI error message.

### `plugin_context_register_subscriber: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, cb: NemoRelayNativeEventSubscriberCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers an event subscriber through the plugin context.

### `plugin_context_register_tool_sanitize_request_guardrail: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeToolJsonCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers a tool sanitize-request guardrail through the plugin context.

### `plugin_context_register_tool_sanitize_response_guardrail: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeToolJsonCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers a tool sanitize-response guardrail through the plugin context.

### `plugin_context_register_tool_conditional_execution_guardrail: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeToolConditionalCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers a tool conditional-execution guardrail through the plugin context.

### `plugin_context_register_tool_request_intercept: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, break_chain: bool, cb: NemoRelayNativeToolJsonCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers a tool request intercept through the plugin context.

### `plugin_context_register_tool_execution_intercept: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeToolExecutionCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers a tool execution intercept through the plugin context.

### `plugin_context_register_llm_sanitize_request_guardrail: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeLlmRequestCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers an LLM sanitize-request guardrail through the plugin context.

### `plugin_context_register_llm_sanitize_response_guardrail: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeJsonCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers an LLM sanitize-response guardrail through the plugin context.

### `plugin_context_register_llm_conditional_execution_guardrail: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeLlmConditionalCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers an LLM conditional-execution guardrail through the plugin context.

### `plugin_context_register_llm_request_intercept: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, break_chain: bool, cb: NemoRelayNativeLlmRequestInterceptCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers an LLM request intercept through the plugin context.

### `plugin_context_register_llm_execution_intercept: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeLlmExecutionCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers an LLM execution intercept through the plugin context.

### `plugin_context_register_llm_stream_execution_intercept: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeLlmStreamExecutionCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus`

Registers an LLM stream execution intercept through the plugin context.

### `scope_handle_free: unsafe extern "C" fn(handle: *mut NemoRelayNativeScopeHandle)`

Frees a host-owned scope handle.

### `scope_get_current: unsafe extern "C" fn(out: *mut *mut NemoRelayNativeScopeHandle) -> NemoRelayStatus`

Retrieves the current scope handle from the active stack.

### `scope_push: unsafe extern "C" fn(name: *const NemoRelayNativeString, scope_type: NemoRelayNativeScopeType, parent: *const NemoRelayNativeScopeHandle, attributes: u32, data_json: *const NemoRelayNativeString, metadata_json: *const NemoRelayNativeString, input_json: *const NemoRelayNativeString, timestamp_unix_micros: *const i64, out: *mut *mut NemoRelayNativeScopeHandle) -> NemoRelayStatus`

Pushes a scope, emits its start event, and returns its handle.

### `scope_pop: unsafe extern "C" fn(handle: *const NemoRelayNativeScopeHandle, output_json: *const NemoRelayNativeString, metadata_json: *const NemoRelayNativeString, timestamp_unix_micros: *const i64) -> NemoRelayStatus`

Pops a scope handle, emits its end event, and clears scope-local registrations.

### `emit_mark: unsafe extern "C" fn(name: *const NemoRelayNativeString, parent: *const NemoRelayNativeScopeHandle, data_json: *const NemoRelayNativeString, metadata_json: *const NemoRelayNativeString, timestamp_unix_micros: *const i64) -> NemoRelayStatus`

Emits a mark event under the current or provided parent scope.

### `scope_stack_create: unsafe extern "C" fn(out: *mut *mut NemoRelayNativeScopeStack) -> NemoRelayStatus`

Creates a new independent scope stack with its own root scope.

### `scope_stack_free: unsafe extern "C" fn(stack: *mut NemoRelayNativeScopeStack)`

Frees a host-owned scope stack handle.

### `scope_stack_set_thread: unsafe extern "C" fn(stack: *const NemoRelayNativeScopeStack) -> NemoRelayStatus`

Binds a scope stack to the current OS thread.

### `scope_stack_capture_thread: unsafe extern "C" fn(out: *mut *mut NemoRelayNativeScopeStackBinding) -> NemoRelayStatus`

Captures the current thread-local scope-stack binding.

### `scope_stack_restore_thread: unsafe extern "C" fn(binding: *mut NemoRelayNativeScopeStackBinding) -> NemoRelayStatus`

Restores and frees a captured thread-local scope-stack binding.

### `scope_stack_binding_free: unsafe extern "C" fn(binding: *mut NemoRelayNativeScopeStackBinding)`

Frees a captured thread-local binding without restoring it.

### `scope_stack_active: unsafe extern "C" fn() -> bool`

Returns whether the current context has an explicitly active scope stack.

### `scope_stack_with_current: unsafe extern "C" fn(stack: *const NemoRelayNativeScopeStack, cb: NemoRelayNativeWithScopeStackCb, user_data: *mut c_void) -> NemoRelayStatus`

Runs a callback with the provided scope stack visible to host runtime APIs.

## Trait Implementations

### `impl Clone for NemoRelayNativeHostApiV1`

<pre />

#### `clone`

<pre />

#### `clone_from`

<pre />

### `impl Copy for NemoRelayNativeHostApiV1`

<pre />

### `impl Send for NemoRelayNativeHostApiV1`

<pre />

### `impl Sync for NemoRelayNativeHostApiV1`

<pre />