Skip to main content

nimbench cli

A lightweight, high-performance benchmarking tool for NVIDIA NIM LLMs.
Measure latency, throughput, and reliability with style.


🚀 Overview

nimbench is a surgical CLI tool designed to benchmark NVIDIA NIM (NVIDIA Inference Microservices) chat models. Powered by httpx for connection-pooled requests and rich for beautiful terminal presentation, it handles model discovery, intelligent filtering, and robust benchmarking, providing you with a clean, formatted performance report.

✨ Key Features

  • 🔍 Auto-Discovery: Automatically finds and ranks all available models from your NVIDIA NIM endpoint.
  • 📊 Precise Metrics: Measures Median, Min, Max latency and Tokens Per Second (TPS).
  • ⏱️ Progress & ETA: Live interactive progress bar with percentage and estimated time remaining.
  • 🌈 Rich Terminal UI: Beautiful, color-coded status tables and highlights using rich.
  • 🔌 Connection Pooling: Uses httpx to reuse TCP connections, minimizing handshake overhead for accurate latency comparisons.
  • 🛡️ Intelligent Retries: Automatically handles rate limits (429) by respecting Retry-After headers and applies temperature fallbacks when needed.
  • 📝 Failure Analysis: Detailed breakdown of failure reasons (Not Provisioned, Timeout, Unsupported, etc.).
  • 💾 Skip Cache: Remembers failed models to speed up subsequent runs.

🔬 What it measures

nimbench measures wall-clock request time for a minimal POST /v1/chat/completions call. It is designed to evaluate request/response latency rather than long-form output quality.

Default Request Shape:

  • Prompt: Reply with one short word.
  • Max Tokens: 8
  • Temperature: 0.0 (with automatic fallback to 0.1 if rejected).

The CLI reports tokens per second for each model. It uses server-provided metrics when available, or derives an approximate rate from completion_tokens / wall_time.


🛠️ How it behaves

  • Discovery: Fetches all models from GET /v1/models and filters for likely chat-capable IDs.
  • Sequential Execution: Benchmarking is performed sequentially to preserve the 40 RPM (Requests Per Minute) cap.
  • Intelligent Skipping: A local skip cache is maintained for models that are not provisioned, reject chat input, or repeatedly timeout.
  • Cap Logic: The --limit flag means "stop after N successful benchmarks", preventing your rate limit from being wasted on unavailable models.

📦 Installation

Requires Python 3.10+.

git clone https://github.com/your-username/nimbench.git
cd nimbench
pip install -e .

🚀 Quick Start

Benchmark the top 10 most likely chat models:

python3 -m nimbench --limit 10

Advanced Usage

# Benchmark everything (including non-chat) with 3 repeats each
python3 -m nimbench --all-models --repeats 3

# Filter for specific models using regex
python3 -m nimbench --pattern "llama|nemotron|mistral"

# Export results to JSON
python3 -m nimbench --limit 5 --json > results.json

⚙️ Configuration & Options

API Key Precedence

  1. --api-key command-line argument.
  2. NVIDIA_API_KEY environment variable.
  3. Interactive prompt.

Options

Option Description
--api-key KEY NVIDIA API key
--base-url URL API base URL (Default: https://integrate.api.nvidia.com/v1)
--limit N Stop after N successful benchmarks
--pattern REGEX Only consider model ids matching REGEX
--timeout SECONDS Request timeout for each HTTP call
--repeats N Requests per model
--json Emit JSON instead of a text table
--rpm N Request rate cap (Default: 40)
--all-models Benchmark full catalog instead of chat-only default
--refresh-cache Ignore the local skip cache for this run

Environment Variables

  • NVIDIA_API_KEY: Your NVIDIA API key.
  • NIMBENCH_CACHE_DIR: Set this to override the default local skip cache directory.

🧪 Testing

Run the comprehensive test suite:

python3 -m unittest discover tests

Built with 💚 for the LLM community.

Metadata

Release files for nimbench 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nimbench 0.1.0
File Size Uploaded Provenance
nimbench-0.1.0.tar.gz 181.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nimbench 0.1.0
File Interpreter ABI Platform
nimbench-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 357.9 kB

Release files / nimbench-0.1.0.tar.gz

Download URL nimbench-0.1.0.tar.gz
Size 181.3 kB
Tags Source
SHA-256 checksum
How to use checksums
76ced5d45a3bf585cef90a98bab9a40110fe45df3a19c305ba5e4ff89285a127
BLAKE2b-256 checksum
How to use checksums
26e71aa17f7f64dc790b6279afcc261f4e7bc885e0109e4591843805db690d0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

Release files / nimbench-0.1.0-py3-none-any.whl

Download URL nimbench-0.1.0-py3-none-any.whl
Size 176.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e58d4e40e701c8cab54f8f5033bb35f4549f7bd9797382485df2406610fb215a
BLAKE2b-256 checksum
How to use checksums
2612ead95d0d16523e5ea868b7ba90a8d6028d5193eeb6482f8a9e768893dd0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

Security for nimbench 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nimbench-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page