Skip to main content

LLM-Bench

A developer-centric CLI tool to systematically evaluate and compare Large Language Models (LLMs). Define prompts, test cases, and expected outputs, run them concurrently against multiple providers, and get detailed performance metrics (Accuracy, Latency, Throughput, Cost) in your terminal.

Demo

Features

  • Multi-Provider Support: OpenAI, Anthropic, Google Gemini, Groq, Mistral, Cohere, Together AI, Azure, and more (via litellm).
  • Rich Terminal Output: Real-time progress bars with ETA.
  • Detailed Metrics: Pass rates, P95 latency, TTFT, tokens/sec, and cost.
  • Flexible Validation: Regex patterns, custom Python validators, JSON Schema, LLM judges.
  • ROUGE-L Scoring: Compare outputs against reference texts.
  • Concurrent Execution: Fast parallel testing with rate limiting.
  • Caching: Saves money on repeated runs.
  • Export: HTML, CSV, or JSON reports with interactive charts.
  • Comparison: Compare benchmark results across runs.
  • External Data: Load test cases from CSV or JSONL files.
  • Interactive Setup: Config wizard to get started quickly.
  • CI/CD Friendly: Quiet mode, no-color output, fail-fast, and dry-run support.

Installation

pip install llm-bench-cli

Or install from source:

git clone https://github.com/abdulbb/llm-bench-cli.git
cd llm-bench-cli
pip install -e .

Setting Up API Keys

Set your API keys as environment variables before running benchmarks:

export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export GEMINI_API_KEY="..."
export GROQ_API_KEY="gsk_..."
export OPENROUTER_API_KEY="sk-or-..."

To make these persistent across terminal sessions, add them to your ~/.bashrc, ~/.zshrc, or use a tool like direnv.

For more detailed setup instructions, see Provider Setup.

Documentation

Quick Start

1. Create a new benchmark configuration:

# Interactive wizard
llm-bench init

# Or generate a template
llm-bench init --non-interactive

2. Validate your configuration:

llm-bench validate --config bench.config.yaml

3. Preview without making API calls:

llm-bench run --config bench.config.yaml --dry-run

4. Run the benchmark:

llm-bench run --config bench.config.yaml

Usage Examples

Run a Standard Benchmark:

llm-bench run --config code_gen.yaml

Compare Models on the Fly:

llm-bench run --model openai/gpt-4o --model anthropic/claude-3-5-sonnet-20241022

Generate an Interactive Report:

llm-bench run --config summarization.yaml --export html --output report.html

Set Safety Limits:

llm-bench run --config expensive_test.yaml --max-cost 1.0

Stop on First Failure:

llm-bench run --config ci_tests.yaml --fail-fast

CI/CD Mode (quiet, no colors):

llm-bench run --config bench.config.yaml --quiet --no-color

List Available Models:

llm-bench models
llm-bench models --provider openai
llm-bench models --provider groq

Manage Cache:

llm-bench cache info
llm-bench cache clear

Compare Benchmark Results:

llm-bench compare run1.json run2.json --export html --output comparison.html

Enable Shell Completions:

# Install completions for your shell
llm-bench --install-completion

# Show completion script without installing
llm-bench --show-completion

See CLI Reference for all commands and options, and Real-World Examples for full configuration files.

Example Configuration

name: "Code Generation Benchmark"
system_prompt: "You are a Python coding assistant."
models:
  - "openai/gpt-4o"
  - "anthropic/claude-3-5-sonnet-20241022"
  - "groq/llama-3.1-70b-versatile"

validators_file: "validators.py"

test_cases:
  - input: "Write a function to calculate factorial"
    regex_pattern: "def factorial"
    validator: "is_valid_python"
    
  - input: "What is 2+2?"
    expected: 4

License

MIT

Metadata

Release files for llm-bench-cli 0.2.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 llm-bench-cli 0.2.0
File Size Uploaded
llm_bench_cli-0.2.0.tar.gz 593.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-bench-cli 0.2.0
File Interpreter ABI Platform
llm_bench_cli-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 650.3 kB

Release files / llm_bench_cli-0.2.0.tar.gz

Download URL llm_bench_cli-0.2.0.tar.gz
Size 593.1 kB
Tags Source
SHA-256 checksum
How to use checksums
500e5d12535f7815ce1ac87cca37c940269c6215969f53c14a4454a5188541d5
BLAKE2b-256 checksum
How to use checksums
1d22c40bb59e7e441caf936b4921f760d2c829027f64dc6cbc0163a5ec99a226
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Dec 31, 2025.

Transparency log

Release files / llm_bench_cli-0.2.0-py3-none-any.whl

Download URL llm_bench_cli-0.2.0-py3-none-any.whl
Size 57.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
483228f2df3ceb7deeb536e5b1a5b10749b2f17005c6d761ee2a3bd3fb1710f9
BLAKE2b-256 checksum
How to use checksums
1fd1f3a95df7f555763cdcbf16f08d242d739c97dc4b55ac2112b225c60b160d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Dec 31, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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