Scanning NVIDIA NIM endpoints with garak: what the integration does
Teams serving models through NVIDIA NIM, whether from build.nvidia.com or from self-hosted NIM containers, can point garak at those endpoints through its NIM generator family. The key decision is the target type. For chat models, which are most of the NIM catalog, garak uses --target_type nim with the model name, such as meta/llama-3.1-8b-instruct, as the target_name. Completion models instead use the nim.NVOpenAICompletion generator. Choosing the wrong type sends prompts in the wrong shape, so confirm each model's interface on its model card before the first scan.
The API key is supplied through the NIM_API_KEY environment variable or the configuration YAML. Keep the key out of shared config files and CI logs, and confirm which key scope your NIM deployment requires. For self-hosted containers, confirm the base endpoint and the exact model identifier the container reports, because the name garak expects must match what the service accepts. garak is an Apache 2.0 licensed command-line tool, installed from PyPI with pip on Python 3.11 or newer, so the scanning host needs that runtime and outbound or internal network access to the NIM endpoint.
DeployOpen plans and runs this integration in infrastructure you control: the scanning host, network path to your NIM services, key handling and the report storage that follows each run. Before scoping the work, confirm which NIM models are in use, whether they run in hosted or self-hosted form, and whether the scan host can reach them without leaving your network boundary.
What you need before the first NIM scan
A NIM scan depends on four things lining up: a working garak install on the scan host, credentials for the endpoint, the exact model name the generator expects, and a network path that lets the host reach the NIM. Check each one before you touch the scan configuration, because a failure in any of them usually shows up as a confusing error mid-run.
A supported Python and garak install
garak is installed from PyPI with pip, and the PyPI package requires Python 3.11 or newer. The tool is developed on Linux and macOS, so use one of those hosts for the scan runner. Pin the garak version in a virtual environment so that later upgrades do not change scores without you knowing why. Confirm the current release on the NVIDIA/garak releases page before you pin it.
garak on PyPIAn API key for hosted NIM
For endpoints on build.nvidia.com, the key is supplied through the NIM_API_KEY environment variable or the config YAML. Create a key for the scan account rather than reusing a personal key, and store it in your secrets system, not in a shell history or a committed config file. Ask who owns the key, how it is rotated and whether the account has usage limits that a full probe run could exhaust.
A self-hosted NIM container
If the model runs in your own cluster or on a GPU host, you need the container running and reachable, not a build.nvidia.com key. Confirm the NIM container version, supported accelerators, memory and disk requirements with NVIDIA's current NIM documentation for your environment, because these change between releases and depend on the model. Record the exact image tag you scanned so the results can be tied to it later.
The exact model name
garak needs the model name in the form the endpoint publishes, for example meta/llama-3.1-8b-instruct, with the organization and model separated by a slash. The garak FAQ says target_type should be nim for chat models, which is most of them, and target_name takes the organization and model name from build.nvidia.com. Query the endpoint's model list first and copy the name exactly, because a near-miss name fails at the first request.
Network path from the scan host
The scan host must reach the NIM endpoint over HTTPS for hosted models or on the cluster network for self-hosted containers. Check egress rules, proxies, DNS resolution and any firewall between the runner and the service before the first scan. If the scan host sits in a restricted segment, agree the route with the network team in writing, since the probe traffic is a deliberate stream of adversarial prompts.
Written approval and a scan owner
Probe runs send many attack prompts to the endpoint and may generate logs, usage charges and alerts on the provider or platform side. Name one owner who approves the target, the scan window and the storage location for the JSONL report and garak.log. Tell the teams that operate the endpoint when scans run, so that their monitoring does not treat the activity as an incident.
Choosing chat or completion target types for NIM models
Most NIM models are chat models. They accept a list of role-tagged messages and return an assistant reply. For these, the garak FAQ states that the target type should be nim. You set --target_type nim and pass the organization and model name from build.nvidia.com as the target name, for example meta/llama-3.1-8b-instruct. The rest of the run uses garak's standard probe selection and detectors, so the setup work is small.
- Target type:
--target_type nimselects garak's NIM path for chat models. - Model name: copy the organization and model path exactly as the listing shows it, such as
meta/llama-3.1-8b-instruct. - Credentials: place the key in
NIM_API_KEYor in the config YAML. The variable keeps the key out of command lines and shell history. - Self-hosted containers: check your container's documentation for how the endpoint is addressed and which model name it reports, then use that name as the target name.
- Repeatability: record the target type and model name in a config file so later runs use the same settings.
Before a full run, confirm that the model name resolves and that replies come back in the chat form you expect.
Completion models take a plain text prompt and continue it, without a role-tagged message structure. For these, garak uses the completion generator nim.NVOpenAICompletion in place of the chat path. The probe content and detectors stay the same, but the request shape and the way the model returns text change, so the setup needs its own check.
- Generator class:
nim.NVOpenAICompletionis the generator for completion models. - Prompt shape: probes arrive as one block of text, and the model continues that text instead of replying as an assistant.
- Credentials: the API key still comes from
NIM_API_KEYor the config YAML, so the same key handling applies. - Model name: the name still comes from the NIM listing. Confirm it matches the model you intend to test.
- First report: read the first report closely, since continuation output can look different from chat replies and should match what you expected from the model.
If the first probe returns text that reads as a continuation of your prompt, the completion path is likely the right choice for that model.
The model's listing and its API documentation show how the endpoint is meant to be called. Start with the interface the documentation describes, then check the request format, since the format is the clearest sign of the model type. Use the garak FAQ as the reference for the default choice before you test.
- Listing and documentation: open the model's page on build.nvidia.com and its API reference, and look for whether the interface is described as chat or completion.
- Request format: chat endpoints take a list of messages with roles, while completion endpoints take a single prompt string.
- Model family: instruction-tuned and chat-tuned models are the usual chat candidates. Base models are often used for completion, but treat this as a hint rather than a rule and check the documentation.
- Container metadata: for self-hosted containers, read the documentation and model card shipped with that container, since the hosted listing may not describe your build.
- Default guidance: the garak FAQ says the target type should be
nimfor chat-type models, which is most of them, so start there unless the documentation clearly describes a completion interface.
If the documentation is unclear, begin with the chat path and let a single probe settle the question.
A single narrow probe run is the cheapest way to confirm the target type before a full scan. It exercises the endpoint, the key and the model name together, and the report shows whether replies match the type you chose. Use a probe from garak's probe list, select it with the probes option, and keep the run small enough to review by hand.
- Pick one probe: choose a single probe that targets a weakness you already care about, so the output tells you something useful.
- Read the errors: an authentication failure usually points to the key, and an unknown model error usually points to the model name.
- Check the reply shape: open the JSONL report and confirm that replies look like the model type you selected.
- Switch if needed: if replies are malformed or empty, change the target type and rerun the same probe with the same settings.
- Keep the evidence: save the report and the garak.log file so the target choice can be explained to reviewers later.
Start the full scan only after the single probe returns readable, well-formed attempts from the endpoint.
How to configure garak against a NIM endpoint
This sequence takes a team from an empty Python environment to a verified garak connection to an NVIDIA NIM chat model, with credentials kept out of shell history and a small probe run that proves the setup works. The output is a JSONL report and a garak.log file that you can inspect before scaling up the scan.
Create a virtual environment and install garak
Confirm that the host runs Python 3.11 or newer, since the PyPI package requires it, then create an isolated virtual environment and install garak from PyPI with pip. Run the garak command-line help to confirm the install is on the path. garak is developed on Linux and macOS, so confirm that your operating system is one of those before you start. Pin the version you install and record it, because report results can shift between releases.
Obtain and store the NIM API key
Generate an API key for your NVIDIA account on build.nvidia.com for hosted models, or confirm the authentication method your self-hosted NIM container requires. Store the key in the NIM_API_KEY environment variable for the session, or in a garak config YAML file that only the scanning account can read. If you use a file, restrict its permissions so that only the owner can read and write it, and keep it out of version control. Check that the variable is set without printing its value.
Identify the chat model and its target name
Open the model page on build.nvidia.com and copy the organization and model name exactly as shown, for example meta/llama-3.1-8b-instruct. garak's FAQ states that target_type should be nim for most chat-type models and that target_name takes the organization and model name from build.nvidia.com. Note whether the model is chat or completion, because completion models use the nim.NVOpenAICompletion generator instead. Confirm the chosen model is available to your key before you scan it.
Set target type and target name
Launch a first run with --target_type nim and the copied model name as the target name, or place the same values in a config YAML and reference that file. Keep the endpoint and model name in the config file once the first run succeeds so that later runs are repeatable. Run the command with a single probe and a single generation so that any authentication or naming error appears immediately. A successful run prints a response from the model and no authorization error.
Run a small probe set
Select one or two low-cost probes from the probe list and limit the generations per prompt, since garak defaults to 5 generations per prompt. This keeps the first run short and makes it easy to read the output. Confirm that the run completes and that the console lists each probe with a pass or fail result. A FAIL result here is a finding about the model, not a setup error, so record it and continue to the next check.
Confirm the JSONL report and log
Find the JSONL report that garak wrote for the run and open it in a text viewer or with a JSON parser. Check that each line is an attempt with its prompt, the model response and its evaluation. Then open garak.log, which continues across runs, and confirm that it records this run without error lines about authentication or connection failures. Note the report file path, because it is the input for every later review and comparison.
Record the configuration before scaling up
Save the exact command or config file, the garak version, the target type, the model name and the probe selection in your scan records. Confirm that the stored config file does not contain the key or that the key is still read from the environment. Once these records exist, the same configuration can be rerun against the same model, which is what makes later comparisons meaningful. Review the findings from the small run with the model owner before expanding the probe set.
How model names and keys map between garak and NIM
The target_name in the garak generator must match the organization and model string shown on the model's page at build.nvidia.com, such as meta/llama-3.1-8b-instruct, including the slash and casing. garak sends that string as the model identifier in each request, so it is the only thing that selects the model under test. A missing organization prefix, a typo, or a name copied from a different catalog entry typically produces request errors on the first attempt. If a scan fails before any probe runs, check the name against the model page first. The garak FAQ explains the target_type and target_name pairing for NIM.
The API key reaches the generator from the NIM_API_KEY environment variable or from the config YAML. Environment variables are the safer default on shared scan hosts because the key stays out of files that teams commit to version control or copy into tickets. If both sources are set, confirm which value your garak version reads before a run, so the scan does not authenticate with an unexpected key. Keys are also easy to leak through run artifacts, so review the JSONL report and garak.log before sharing them outside the scanning team, and confirm what those files record in your version.
Hosted endpoints on build.nvidia.com send every probe prompt and model response to NVIDIA-hosted infrastructure over the internet, so test content leaves your network. Self-hosted NIM containers keep that traffic inside your environment when the container is reachable only from your scan host. Before scanning, confirm with your NVIDIA agreement and data handling terms what is retained, logged or used for training, separately for the hosted service and for any containers you license. Ask for that answer in writing, and make sure your security team has reviewed it before probe content that resembles customer data is sent to a hosted endpoint.
Securing the scan host and the NIM key
A garak scan against a NIM endpoint touches three sensitive things: the API key that authorizes calls, the prompts and model outputs written to disk, and the network path to a self-hosted container. The cards below cover how each is held, stored and reviewed, and what to confirm with your own security team before the first run.
Keep the key out of shell history
Exporting NIM_API_KEY inline on the command line can leave the key in shell history and process listings on shared hosts. Load it from a secret store or a protected environment file readable only by the scan account, and run the scan from a session that does not echo the variable. Check that your shell history settings and CI logs do not capture the value.
garak READMEAvoid keys in committed config
garak accepts the API key either from the environment or from a config YAML, so a config file for a repeatable scan can quietly become a credential store. Keep the key out of files in version control, add the config path to ignore rules, and run a secret scanner over the repository before pushing. Ask NVIDIA or your account owner which key scope and expiry apply to your build.nvidia.com account.
Plan key rotation and revocation
Define who owns the NIM key, where it is stored, and how it is rotated after staff changes or any suspected exposure. Rotation should be a documented step with a test scan afterward to confirm the new key works and the old one no longer does. Confirm with your provider how keys are issued, whether they expire, and how revocation takes effect.
Restrict access to reports and logs
Each run writes a JSONL report of every attempt and a garak.log file that continues across runs. Prompts and model outputs in these files can contain sensitive system prompt content, retrieved data or simulated personal information, so treat them as confidential. Set file permissions on the output directory, limit who can read it, and decide how long reports are kept before deletion.
- Output files per run
- 2
Control network paths to NIM containers
A self-hosted NIM container should be reachable only from the scan host and the services that need it, not from the open network. Restrict inbound ports with host or network firewall rules, keep the endpoint on an internal segment, and confirm whether the container's own authentication is enabled before exposing it. Record the allowed source addresses so the scan path can be audited later.
Confirm egress and scan host hygiene
A scan host that sends prompts to build.nvidia.com should have a documented egress path, and the host should be patched and limited to the packages needed for garak. Confirm with your network team which destinations are allowed, whether a proxy inspects traffic, and whether the host's logs record outbound calls. Review these settings again whenever garak is upgraded or the scan target changes.
Mapping garak settings to NIM endpoint values
This table pairs each garak setting used for a NIM scan with the NIM value it must match, so you can check a run before it starts. Confirm every value against the model card or endpoint you actually call, because a mismatch between target type and model family is the most common cause of a failed or misleading scan.
| garak setting | NIM counterpart | What to confirm |
|---|---|---|
| --target_type nim | Chat model served through a NIM chat endpoint | The model accepts chat-style messages. Most NIM models are chat models, so this is the default starting point. |
| --target_type nim.NVOpenAICompletion | Completion-only model served through a NIM endpoint | The model is completion-only. Check the model card before choosing this, since using it for a chat model changes results. |
| --target_name | Organization/model name as listed on build.nvidia.com | The exact string from the model page, including the organization prefix, for example meta/llama-3.1-8b-instruct (illustrative format). |
| NIM_API_KEY environment variable | API key issued for the build.nvidia.com account or NIM deployment | The key is valid for the endpoint you target and is stored outside shared config files and logs. |
| api_key in the config YAML | Same key, supplied in a run configuration file | Your team's rule on whether keys may sit in config files. Prefer the environment variable where config files are shared or committed. |
| Hosted build.nvidia.com endpoint | Model called through NVIDIA's hosted API | Data sent to the hosted service is acceptable under your data handling policy and the probes you plan to run. |
| Self-hosted NIM container | Model running in your own infrastructure, reached by URL | The endpoint address and model name match what your container reports, and network egress rules allow the scan host to reach it. |
| Model name in the request | Model identifier the NIM endpoint expects | Your self-hosted container may expose a different identifier from the hosted catalog name. Query the endpoint to confirm it. |
Questions buyers ask before scanning NIM endpoints
How much does it cost to scan a NVIDIA NIM endpoint with garak?
garak itself is free to use, since the project is licensed under Apache 2.0 and the maintainers describe it as a free tool. The real costs are the compute that runs the scan, the usage charges for the NIM endpoint or hosted API calls, and the staff time to configure, run and read the results. Each probe makes several generations per prompt by default (5), so the number of attempts, and therefore the usage and time, grows with the probe selection and the number of runs. Ask for a quote that separates one-time setup from recurring scan runs, and confirm with NVIDIA which usage terms apply to the NIM endpoint you plan to test.
How long does it take to set up a garak scan against NIM?
The scan itself can start quickly once garak is installed and the endpoint responds, because the main configuration is the target type, the model name and the API key. Setup time is driven by the parts around that: confirming Python 3.11 or newer is available, deciding which probes match your exposure, agreeing where the API key is stored, and deciding how results are reviewed and retested. Self-hosted NIM containers add work for networking, GPU capacity and access control. Ask for a written plan that lists each of these steps before agreeing to a timeline.
Can our internal team run garak against NIM without outside help?
Yes, a team with Linux or macOS experience and Python 3.11 or newer can install garak from PyPI and run it against a chat model. The first run needs the right target type, which is nim for most chat models, the model name in organisation/model form from build.nvidia.com, and the key in NIM_API_KEY. Teams usually need outside help when the scan must cover tool use, retrieval or guardrails, when the report must serve as audit evidence, or when results must be compared across garak upgrades. Assess your engineers' time against those demands before deciding.
What do we need to provide for a NIM scan engagement?
The work needs a few things from your side before it starts:
- An API key for the NIM endpoint, or access to your self-hosted NIM containers, with the rights to send test traffic
- The exact model names and endpoint locations you want tested, including whether each is a chat or completion model
- A named owner who approves the scope, receives findings and decides on fixes
- Agreement on where keys are stored, since they should not be written into shared configuration files
- Network access from the machine that runs garak to the endpoint, and a place to keep the JSONL reports and garak.log files
Confirm these items with your platform and security teams during scoping.
How do I know whether to use chat or completion target type for NIM?
Use the chat setting for most NIM models, which is nim with the model name, such as meta/llama-3.1-8b-instruct. garak's FAQ says target_type should be nim for chat-type models, which is most of them. Completion models use the nim.NVOpenAICompletion generator instead. Check the model's documented interface on build.nvidia.com or in your container before choosing, because a mismatch produces errors or misleading results. Record the choice in your scan configuration so later runs match.
How is a DeployOpen engagement for NIM scanning scoped?
DeployOpen engagements are fixed-scope, so the endpoints, probe families, deliverables and timelines are agreed in writing before work starts. A written scope usually names the NIM models and deployment type in use, the probe selection, how the report will be delivered, and whether fixes and a retest are included. DeployOpen does not publish a price list, so a quote follows from that written scope. Ask for the scope document to list each deliverable, the assumptions about access and keys, and the change process if the endpoint or model list changes mid-engagement.
Does a garak scan of NIM count as a compliance certification?
No. A garak scan produces test results, and DeployOpen prepares systems, controls and evidence for compliance assessments but does not issue audit reports, attestations or certifications. Independent auditors and certification bodies make those determinations. A scan report can support an assessment as one piece of testing evidence, but the auditor decides what it proves. Ask your compliance lead which evidence the assessor expects before scoping the scan.
How a garak scan reaches a NIM endpoint
The scan starts on the scan host, where garak loads its probes and detectors and the nim generator picks up the API key from NIM_API_KEY or a config YAML. Each prompt leaves the host and crosses the trust boundary to either the hosted build.nvidia.com endpoint or a self-hosted NIM container inside your network. Check that the key is supplied only on the scan host and that the target type and model name match the endpoint. Results come back to the scan host, where garak writes the JSONL report and the garak.log file.
Request path from the garak scan host to hosted or self-hosted NIM endpoints, with reports written back locally.
How DeployOpen scopes and delivers a garak NIM integration
DeployOpen plans and runs garak scans against NVIDIA NIM endpoints as a fixed-scope piece of work, starting from the model types, endpoints and keys your team uses. The output is a repeatable scan setup, documented run steps and a handover your engineers can operate without us.
How we scope
- Confirm whether each target is a chat model or a completion model, since the generator choice depends on it
- Record the model names and build.nvidia.com or self-hosted NIM endpoints in scope, with their owners
- Agree in writing which probes, generations and reporting outputs the scan covers before work starts
- Identify where the NIM_API_KEY value will be stored and who may read it
How we build
- Install garak from PyPI on a Python 3.11 or newer host you control and pin the version used
- Write a config file that sets the target type, target name and generation settings for each model
- Run a short test scan to confirm that requests reach the endpoint and that reports are written
- Check the JSONL report and garak.log output against the agreed scope before running the full set
How we hand over
- Deliver the garak configuration files, run commands and the variable names your team must set
- Document the model naming used for each NIM target so future runs refer to the same identifiers
- Provide a findings summary that explains each failed probe and the attempts behind it
- Walk your engineers through rerunning the scan and reading reports in a session you can keep
How we support
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts
- Ongoing rescans, garak version upgrades and continued testing are available as a retainer
- Confirm with us whether a retainer should cover new NIM models added after the initial handover
- Quotes follow from the written scope, so ask for the scope items that drive effort to be listed

