How NeMo Guardrails connects to NVIDIA NIM endpoints
The supported way to point NeMo Guardrails at NVIDIA-hosted or self-hosted NIM models is the built-in nim engine, which is also reachable under the alias nvidia_ai_endpoints. Its default endpoint is ` so a configuration that only names the engine and model will call the hosted API. The engine supports streaming, tool calls and reasoning models, which matters when the main model is one of those. Confirm the engine name and the endpoint against the NeMo Guardrails supported LLMs page before you write the model block, because the page is the authority for which options each engine accepts.
The first credential path is NVIDIA_API_KEY, generated on build.nvidia.com, which the NeMo Guardrails examples use to call NVIDIA-hosted models. Keep this key in the runtime environment or your secrets manager, never in config.yml, and scope it to the team account that owns the usage. The second path is an NGC_API_KEY that starts with nvapi-. Self-hosted NIM containers do not need an API key for inference, but you still need this key to pull the Docker images and download model artifacts from NGC. Treat these as two separate identities: one key may be valid for hosted calls while the pull still fails, and a team that only creates the build.nvidia.com key will find its local containers cannot start.
Before rollout, decide which models stay hosted and which run in your own network, because that choice determines the data path for every prompt and response. Ask your NVIDIA account contact and your platform team to confirm which NIM images and safety models your entitlement covers, who owns each key, and how keys are rotated. Also check the Python version your environment supports, since NeMo Guardrails 0.25.0 requires Python 3.11, 3.12 or 3.13. The installation guide shows the packages and environment variables the examples expect.
What you need before the first guardrail call
Every path into NeMo Guardrails with NVIDIA-hosted or self-hosted NIM models starts with the same few inputs: a supported Python runtime, the right NVIDIA credentials, and network and hardware readiness. Confirm each item before scheduling the build, because a missing key or blocked endpoint usually shows up as a failed first call rather than a clear error.
Python runtime version
NeMo Guardrails 0.25.0 requires Python 3.11, 3.12 or 3.13. Check the interpreter used by the service account, the container base image and any CI runners, not only a developer laptop. Pin the version in your build so a later default change on a host does not alter the install. Test the install in the same image you plan to run in production.
PyPI packageNVIDIA_API_KEY from build.nvidia.com
The tutorials and example configurations use NVIDIA-hosted models on build.nvidia.com, which require an NVIDIA_API_KEY generated on that site. Decide who owns the key, where it is stored and how it is rotated before any developer pastes it into a config. Keep it in a secrets manager and inject it as an environment variable, never in config.yml.
NGC_API_KEY for local containers
Running NIMs locally needs no API key for inference, but an NGC_API_KEY starting with nvapi- is still required to pull Docker images and download model artifacts. Request it under an account your organization controls, not a personal one. Confirm with NVIDIA which NGC organization and entitlements cover the safety model containers you plan to use.
PII detection docsGPU and Docker host readiness
Self-hosted NIM containers need a Docker host with GPU access configured, and the sizing depends on which safety models run locally. Confirm the supported GPU models, driver and container runtime versions with NVIDIA before procurement, and test on a staging host. Also confirm the license terms for each NIM and model artifact, since these are set by NVIDIA and may differ from the Apache 2.0 license of the library.
Outbound access to the integrate endpoint
The nim engine defaults to ` so application hosts need outbound HTTPS to that endpoint unless you point the engine elsewhere. Ask your network team whether egress proxies, DNS allow lists or data residency rules apply. Decide which workloads may send prompts to a hosted endpoint at all, since those requests leave your infrastructure.
Confirm terms and hardware with NVIDIA
Hardware figures and model licensing are not fixed by the library license, so ask NVIDIA or your account team for current requirements before committing budget. Request written answers on which models your use case may run, whether commercial use is covered, and what support applies. Record those answers with the architecture decision so auditors can trace why each model was approved.
Configuring the nim engine step by step
This sequence takes a team from a clean Python environment to a NeMo Guardrails configuration that calls NVIDIA-hosted models, a separate NemoGuard safety model, and a self-hosted NIM endpoint, with a check at each stage.
Install the nemoguardrails package
The platform engineer creates an isolated Python environment on Python 3.11, 3.12 or 3.13, the versions NeMo Guardrails 0.25.0 supports, and installs the nemoguardrails package from PyPI. The package is licensed under Apache-2.0. Confirm the install by running the nemoguardrails command-line help and checking that it reports version 0.25.0 or the release you have chosen to pin. Record the pinned version in your configuration repository so later runs use the same engine behavior.
Create an NVIDIA API key on build.nvidia.com
Generate an API key on build.nvidia.com with the account that will own the hosted model access, then export it as NVIDIA_API_KEY in the shell or secret store that runs the application. Do not write the key into config.yml or commit it to source control. Confirm the export by running a short command that prints only the length of the variable, so the value itself never reaches the logs. The key is what the nim engine reads when it calls the hosted endpoint.
Define the main model with the nim engine
In config.yml, add a models block with type set to main, engine set to nim, and model set to the NVIDIA-hosted model name you selected from the model catalog. The nim engine is built in and defaults to the NVIDIA endpoint, and nvidia_ai_endpoints is an accepted alias, so either value works. Keep one engine name across the team's configurations to make reviews simpler. Confirm the choice with a single test completion through the Python API, and check the log line that shows the expected model name.
Add a separate NemoGuard safety model entry
Add a second entry to the models block for the safety model used by a rail, such as a NemoGuard content safety or topic control model, with its own type and engine so it is not confused with the main model. Reference that entry from the rail configuration in the Colang or config files. Keep the main model and the safety model as separate records so each can be swapped without changing the other. Confirm by sending one input that should trigger the rail and checking that the log names the safety model as the component that made the decision.
Run a request through the Python API
Load the configuration folder with the Python API, send one benign prompt and one prompt that the input rail should block, and inspect both responses. The benign prompt should return a normal model completion, and the blocked prompt should return the configured refusal message. Confirm the result by checking that the trace for each request names the expected model and rail. Failures at this stage usually point to a missing NVIDIA_API_KEY, a misspelled model name or a configuration path that does not resolve.
Start the guardrails server with the same configuration
Run the guardrails server against the same configuration folder, either directly or from the provided Dockerfile image, and send one request to its HTTP API with the same two prompts. The API key must reach the container through an environment variable or secret, not an image layer. Confirm the server by checking that the response matches the Python API result and that the server log shows the same model name. Matching results across both paths mean the configuration is portable between your development machine and your deployment.
Pull and self-host a NIM container
For the self-hosted path, log in to the NVIDIA container registry with an NGC_API_KEY that starts with nvapi-, then pull the NIM image and download its model artifacts. The NGC key is needed for the pull and download only. Start the container on hardware you control and confirm it is serving by calling its local endpoint. Ask your NVIDIA account contact or the current NIM documentation which images and model artifacts your entitlement covers before planning capacity.
Point base_url at the local NIM endpoint
Change the model entry for the self-hosted model so base_url points at the local NIM endpoint, and omit api_key_env_var because inference against your local container does not need an NVIDIA API key. Keep the NGC_API_KEY in the pull environment only, not in the application runtime. Confirm the change by sending the same benign and blocked prompts and checking that the traces show requests going to your internal address rather than the hosted endpoint. Then verify that the hosted key is no longer read from the runtime environment.
Choosing between build.nvidia.com and self-hosted NIM
Hosted endpoints on build.nvidia.com are the quickest path to a working configuration. The NeMo Guardrails tutorials and example configurations use NVIDIA-hosted models from that catalog, and the nim engine sends requests to by default. Your application authenticates with an NVIDIA_API_KEY` generated on build.nvidia.com, and that key becomes a credential your team must issue, store and rotate.
- Credential scope: the key is tied to an NVIDIA account, so decide who creates it, where it is stored and how it is rotated.
- Data path: prompts and completions leave your network for NVIDIA-hosted inference, so confirm the data handling terms for your account and chosen models before sending regulated data.
- Network egress: the runtime needs outbound access to the hosted endpoint, which many restricted networks block by default.
- Model pinning: the catalog changes over time, so record the exact model names you tested in your configuration.
- Availability: you depend on the hosted service's uptime and any rate limits on your account, which you should confirm with NVIDIA.
Before production use, confirm the data terms, egress rules and key ownership with your security and procurement teams. The installation guide describes the setup steps for this path.
Self-hosted NIM containers run models inside infrastructure you control, so prompts and safety-model calls stay on your network. Inference against local NIM containers needs no api_key_env_var setting, but an NGC_API_KEY beginning with nvapi- is still required to pull the Docker images and download model artifacts. That key is needed during build and deployment, so it belongs in your deployment pipeline even though the application's inference calls do not use the hosted key.
- Image pulls: build a registry workflow so hosts or clusters pull images from a source you approve, and record the image version in each environment.
- Artifact downloads: model artifacts are fetched during setup, so schedule that step inside controlled change windows.
- GPU capacity: the containers need accelerator hardware sized for the models you run, which you should confirm against NVIDIA's documentation for each model.
- Maintenance ownership: your platform team patches, upgrades and monitors the containers, and that work recurs with each release you adopt.
- Key storage: keep the NGC key in your secrets manager, scoped and rotated, and separate from the application runtime configuration.
Confirm hardware requirements, image access and upgrade ownership before the first deployment. The PII detection documentation includes the NGC key requirement for local containers.
Air-gapped networks cannot reach build.nvidia.com or pull images from the internet, so the hosted path is unavailable there. The deployment is built from artifacts that move across an approved transfer process. The NGC key is used in a connected staging environment where images and model artifacts are fetched, and the runtime environment never needs to hold it.
- Staging environment: a connected host pulls images and model artifacts with the NGC key, then the artifacts move through your transfer controls.
- Internal registry: an internal mirror holds the approved image versions that the cluster or hosts consume.
- Endpoint settings: the engine is pointed at internal model addresses through configuration changes, so the rail logic is untouched.
- Egress evidence: test that the runtime cannot reach external hosts and keep the results in a form you can show an auditor.
- Update cadence: each new release repeats the transfer and verification steps, so include that work in your change calendar.
Ask your security team how artifact transfers and egress evidence will be approved before scheduling the first deployment, and confirm which NIM versions your transfer process can carry.
The environment decision also decides who holds which responsibility. Hosted use concentrates the work on key management and data terms, while self-hosted use adds container lifecycle work that a platform team must run. Application owners keep the same rail configuration in both cases, so their work does not change with the environment. The table below summarizes how responsibilities usually divide, though your organization should confirm each assignment in writing.
- Security team: approves issuance, storage and rotation for the
NVIDIA_API_KEYand theNGC_API_KEY, and reviews egress rules. - Platform team: owns image pulls, GPU nodes, upgrades and monitoring for self-hosted NIM containers.
- Application owners: own the rail configuration, which stays the same across hosted, self-hosted and air-gapped environments.
- Procurement and legal: review the hosted service terms and any support or licensing terms that apply to your deployment, confirmed directly with NVIDIA.
- Auditors: need records showing which keys exist, which image versions ran and where data flowed.
Write these assignments into your deployment plan before choosing an environment, so each team knows what it must deliver and what evidence it must keep.
How a request flows through NeMo Guardrails to NIM models
A request starts in the client application, which calls either the NeMo Guardrails Python API or a guardrails server. Input rails send the prompt to a NemoGuard safety NIM before the main model NIM sees it, and output rails check the reply before it returns. Each hop to a NIM endpoint carries its own key, so check which credential each hop uses, where the trust boundary sits, and whether the safety models run in your network or on NVIDIA-hosted endpoints.
Request path through input rails, the main model NIM and output rails, with the trust boundary marked.
Mapping models, keys and config keys to each role
This table maps each role in a NeMo Guardrails setup (main model, input safety model, output safety model and container pull) to its engine, model field, endpoint and credential variable. Read each row as a checklist for one role, and confirm every model identifier against the NVIDIA catalog before you write configuration, because identifiers change between catalog releases.
| Role | Engine and endpoint | Model field and credential | What to confirm |
|---|---|---|---|
| Main model on build.nvidia.com | nim engine, alias nvidia_ai_endpoints, default base URL | Model identifier from the NVIDIA catalog in config.yml, key from NVIDIA_API_KEY generated on build.nvidia.com | Exact model identifier and that your account can call it |
| Input safety model (hosted) | nim engine with the same default endpoint as the main model | Safety model identifier set under the rail's model entry, reuses NVIDIA_API_KEY | Model identifier for the chosen NemoGuard safety model and rail configuration |
| Output safety model (hosted) | nim engine with the same default endpoint as the main model | Safety model identifier set under the output rail, reuses NVIDIA_API_KEY | Model identifier and that the output rail names the same model as the config |
| Self-hosted NIM container for safety | nim engine pointed at the base URL of your local NIM service | No api_key_env_var needed for inference, pull still requires an NGC_API_KEY starting with nvapi- | Base URL of your container, container image tag and hardware it supports |
| Container pull and model download | Docker image pull and model artifact download from NGC, outside NeMo Guardrails configuration | NGC_API_KEY starting with nvapi- supplied to the container host | Whether your registry access and artifact licenses cover your environment |
| Framework opt-in for LangChain paths | Environment variable NEMOGUARDRAILS_LLM_FRAMEWORK=langchain, only when a LangChain component is used | Not a credential, set in the runtime environment | Whether your chosen engine needs the opt-in in your version |
Protecting NVIDIA API keys and container access
NeMo Guardrails with NVIDIA NIM depends on two credentials and a set of network paths that all carry access to paid or restricted resources. The cards below cover where those credentials live, who can use them, how container images are pulled, which endpoints the guardrail host may reach, and what the guardrail layer records. Each control is worth checking on its own, and together they decide whether a compromised config file or container host exposes your model access.
Keep keys out of config.yml
Store NVIDIA_API_KEY and NGC_API_KEY in a secrets manager and inject them as environment variables at runtime. The config.yml file is usually committed to source control, copied into container images and shared between teams, so a key placed there spreads with every copy. Check that no configuration folder, Dockerfile layer or CI log contains a key string, and rotate any key that has appeared in one.
Scope keys to the owning team
Generate separate keys for each application or environment rather than one shared key for every guardrail deployment. When one key serves development, staging and production, a leak in a test notebook exposes production quota and billing. Ask who in your organization can create and revoke keys on the build.nvidia.com account, and record which service uses each key so that rotation does not break an unrelated workload.
Restrict who can pull NGC images
An NGC_API_KEY starting with nvapi- is needed to pull NIM containers and model artifacts, so the same key that lets a host pull images also grants access to them. Limit pulls to a small set of build and deployment identities, and keep the image registry credential in the platform's secret store rather than on developer laptops. Confirm with NVIDIA which NGC roles and organization permissions apply to your account before you grant broader access.
Limit egress to approved endpoints
Decide whether the guardrail host should reach an internal NIM host, or both, and block everything else at the network layer. The nim engine defaults to the hosted endpoint, so a misconfigured base_url` can send prompts to an unintended destination without any error. Use egress allow-lists in your firewall or Kubernetes network policy, and test that a blocked destination fails closed.
Log guardrail decisions securely
Record which rail fired, the decision it made and the model that was called, but avoid writing full prompts and responses to general-purpose logs where they can be read by many teams. Confirm the logging options your guardrails version provides, and decide who may view blocked content, how long records are kept and where they are stored. Keep API keys out of log output by testing it with a deliberately failing request.
Review access on a schedule
Keys and image pull rights tend to outlive the people and projects that needed them. Set a review cycle that lists every active key, its owner, its scope and the last time it was used, and revoke any that no longer map to a running service. Pair each review with a rotation step so that a key can be replaced without changing application code.
Why NIM calls fail and how to fix them
This table lists the failures teams most often hit when pointing NeMo Guardrails at NVIDIA-hosted or self-hosted NIM models, with the cause and fix for each. Read it when a call returns an authentication error, a container will not pull, or a rail appears to do nothing. Most failures trace back to one of two keys or to a mismatch between configuration and environment.
| Failure | Likely cause | Fix |
|---|---|---|
| Authentication error on hosted models | NVIDIA_API_KEY is missing from the environment the process runs in, or it is empty in the container. | Generate a key on build.nvidia.com, export NVIDIA_API_KEY in the runtime that starts NeMo Guardrails, and confirm it is passed into the container. |
| Wrong key type for the endpoint | An NGC_API_KEY was supplied where a build.nvidia.com key is needed for hosted inference, or the reverse. | Use the build.nvidia.com key for hosted inference. Use the NGC key only for pulling images and model artifacts. Confirm which key each config path reads. |
| Container cannot be pulled | Local NIM images and model artifacts require an NGC_API_KEY starting with nvapi-, and the key is absent, mistyped or lacks access. | Set the nvapi- key for the registry login before pulling. Inference against the local container needs no api_key_env_var, so the pull key is separate from the runtime setup. |
| Calls go to the wrong host | The base_url in config.yml does not match the NIM service address, or the default hosted endpoint is overridden by a stale value. | Remove overrides to use the default hosted endpoint, or set base_url to the exact address of your self-hosted service and test it with a single request. |
| Python import or install failure | The environment runs Python below 3.11. NeMo Guardrails 0.25.0 supports Python 3.11, 3.12 and 3.13. | Create the virtual environment or base image with Python 3.11 or later and reinstall the package there. |
| Safety rail appears to do nothing | A safety model is misnamed in config.yml, so the rail is not matched to a configured model and checks are skipped rather than failing loudly. | Compare each model name in config.yml against the model names the installed version expects, then send a known unsafe prompt and confirm the rail blocks it. Review logs for the rail's execution record. |
| Hosted endpoint not reachable from a restricted network | Egress to the hosted API is blocked by the network or proxy policy. | Confirm outbound access to the hosted endpoint, or switch to self-hosted NIM containers if the network must stay closed. Ask your network team to verify before testing. |
Questions teams ask before connecting NIM endpoints
Is it free to start with models on build.nvidia.com?
The NeMo Guardrails library is licensed under Apache 2.0, so the software itself costs nothing to download and run. Calling NVIDIA-hosted models on build.nvidia.com is a separate question. You need an NVIDIA_API_KEY generated on that site, and the terms for hosted access, including any usage limits or charges, are set by NVIDIA. Confirm those terms on the site before you build a design around them. Your own costs then come from the team hours to configure the rails, the calls each user request triggers across the main model and safety models, and any data handling reviews your compliance team requires.
What drives the cost of self-hosting NIM containers?
Self-hosting moves cost from per-call usage to infrastructure you run. The main drivers are the GPU capacity each NIM needs, how many safety models you host at once, the number of environments (development, staging, production), and the availability you require. Some costs are one-time, such as design, configuration and testing. Others recur, such as GPU hosting, storage, monitoring and model updates. Licensing for NVIDIA AI Enterprise is a separate line item that NVIDIA sets, so ask NVIDIA for current terms. Ask your hardware vendor for sizing against the models you plan to run, and ask DeployOpen for a written scope that lists each component and who pays for it.
How long does NeMo Guardrails with NIM setup take?
Setup time depends mostly on the environment and the number of rails. Connecting a hosted model to a basic configuration is a short exercise for an engineer who already runs Python services. Self-hosted NIMs add image pulls, GPU provisioning, network approvals and model artifact downloads, which often take longer than the configuration itself. Each additional rail adds prompt design, Colang logic, tests and tuning. The schedule should come from a written scope that names the environments, the rails and the approvals still outstanding. DeployOpen agrees timelines in writing before work starts, so ask for the scope and the dependencies it lists.
What must our team provide before the work starts?
Plan to provide four things. First, accounts: an NVIDIA account for the build.nvidia.com key and an NGC account for the key used to pull local containers. Second, compute: GPU capacity in a cluster or data center you control, if you self-host any NIM. Third, network approvals: outbound access to the endpoints you use, or internal routing to self-hosted services, plus any change approvals your security team requires. Fourth, a named owner who can make decisions about rails, data handling and sign-off. Without that owner, reviews stall. Confirm the exact network rules and GPU requirements with NVIDIA and your hardware vendor, since they depend on the models you choose.
Can one internal engineer set this up alone?
One capable engineer can usually set up a hosted-model configuration with a few rails, provided they have Python experience, access to the accounts and someone who can approve the design. Self-hosting is harder to carry alone, because it adds GPU operations, container registry access, monitoring and on-call duties. Rail design also needs input from security, compliance and the business owner of the assistant, and the testing needs a second reviewer. Decide early who maintains the configuration after handover. DeployOpen implements, documents and supports self-hosted platforms in your infrastructure, so you can use a fixed-scope engagement for the build and a retainer for ongoing work.
Does the NeMo Guardrails microservice sunset change the approach?
The sunset affects the microservice, not the open-source library. NVIDIA's NGC catalog page says the NeMo microservices container was sunset as of October 1, 2026, with no new releases and no continued support for that artifact. NVIDIA's archived documentation says new development has moved to NeMo Platform and asks existing users to contact their account team. The library remains on PyPI under Apache 2.0, with release 0.25.0 published on 19 November 2026. If you planned to run the microservice container, design the server from the library instead, and confirm your support path with NVIDIA before you commit. Your NIM connection work is unaffected.
Which API key do hosted and local NIMs need?
Hosted models on build.nvidia.com need an NVIDIA_API_KEY generated on that site. Local NIM containers need an NGC_API_KEY that starts with nvapi- to pull Docker images and download model artifacts. Once a local NIM runs, inference calls to it need no api_key_env_var, so the NGC key is needed for setup, not for each request. Store both keys in your secrets manager, not in configuration files in source control. Restrict each key to the account and scope it needs, and plan rotation with the teams that deploy the containers. Confirm current key scopes and rotation options with NVIDIA, since those can change.
Where does prompt data go when we call hosted NIM models?
When the engine calls the default endpoint, requests go to NVIDIA's hosted service at ` so prompts, retrieved content and responses leave your network. Before you send regulated or personal data, confirm NVIDIA's data handling, retention and processing terms for that service, and record the answer for your compliance team. If those terms do not meet your policy, use self-hosted NIMs or another self-hosted model inside your infrastructure. Check the NeMo Guardrails installation guide for setup details, and have your data protection owner sign off on the data flow diagram.
How DeployOpen scopes and delivers NIM integrations
DeployOpen plans and implements NeMo Guardrails with NVIDIA NIM and build.nvidia.com models inside infrastructure you control, with the model endpoints, API keys and safety models agreed before any configuration is written. Engagements are fixed-scope, so the written scope sets what is tested, documented and handed over. Ongoing support is available as a retainer.
How we scope
- Confirm which models run as the main model and which run as NemoGuard safety models, hosted on build.nvidia.com or self-hosted as NIM containers.
- Record where NVIDIA_API_KEY and NGC_API_KEY will be stored, who owns them, and how they are rotated.
- Agree in writing whether outbound calls to integrate.api.nvidia.com are permitted from your network, or whether local containers are required.
How we build
- Configure the nim engine in config.yml, checking the model name, streaming and tool call settings against your chosen models.
- Pull and verify any local NIM containers with your NGC key, then point the guardrails configuration at the internal endpoints.
- Test input and output rails against your policy cases, including rail behavior when a hosted endpoint is unavailable.
How we hand over
- Deliver the configuration folder, Python actions and Colang files with a record of each model, endpoint and key reference used.
- Document the secret locations, the container image versions pulled, and the steps to replace a model or rotate a key.
- Walk your platform and security teams through the test results and the open items agreed in the written scope.
How we support
- Review NeMo Guardrails release notes with you before upgrades, since the current release is 0.25.0 and the library is actively maintained.
- Re-test rails after model, container or key changes, and track which safety models were updated.
- Offer ongoing support, upgrades and continuous testing as a retainer if your team wants that continuity.

