Skip to main content

promptum

Python 3.10+ Async License: MIT PyPI Version PyPI Downloads

Test LLMs Like a Pro.

Stop writing boilerplate to test LLMs. Start getting results.


What's This?

You're choosing between GPT-4, Claude, and Gemini for your product. You need to know which one actually handles your prompts better — not some generic benchmark, but your real tasks, your edge cases, your expected formats.

promptum turns that into a few lines of Python. One client for 100+ models, automatic retries, latency/cost/token tracking, structured validation — all async, all typed, zero config files.

session = Session(provider=client, name="my_test")
session.add_test(Prompt(
    name="basic_math",
    prompt="What is 2+2?",
    model="openai/gpt-3.5-turbo",
    validator=Contains("4"),
))
report = await session.run()
summary = report.get_summary()

No YAML. No config files. Just Python you can read in 30 seconds.


Quick Start

pip install promptum  # (or: uv pip install promptum)
export OPENROUTER_API_KEY="your-key"
import asyncio
from promptum import Session, Prompt, OpenRouterClient, Contains

async def main():
    async with OpenRouterClient(api_key="your-key") as client:
        session = Session(provider=client, name="quick_test")

        session.add_test(Prompt(
            name="basic_math",
            prompt="What is 15 * 7? Reply with just the number.",
            model="openai/gpt-3.5-turbo",
            validator=Contains("105"),
        ))

        report = await session.run()
        summary = report.get_summary()

        print(f"Passed: {summary.passed}/{summary.total}")
        print(f"Avg latency: {summary.avg_latency_ms:.0f}ms")
        print(f"Total cost: ${summary.total_cost_usd:.6f}")

asyncio.run(main())

Why promptum?

Most LLM testing is ad-hoc scripts that grow into unmaintainable messes. You end up with separate API clients per provider, hand-rolled retry logic, manual latency tracking, and validation scattered across files.

promptum replaces all of that with a single coherent API:

  • 100+ Models via OpenRouter — one client for OpenAI, Anthropic, Google, and more
  • Smart Validation — ExactMatch, Contains, Regex, JsonSchema, or write your own
  • Automatic Retries — exponential/fixed-delay backoff with configurable attempts
  • Metrics Tracking — latency, tokens, cost — automatically captured
  • Async by Default — run tests in parallel with concurrency control
  • Extensible — implement LLMProvider or Validator to plug in any model or validation logic
  • Type Safe — full type hints, catches errors before runtime

Documentation

  • Session & Testing — Session, Prompt, Report, Summary, TestResult
  • Providers — LLMProvider, OpenRouterClient, Metrics, Retry, Exceptions
  • Validation — Validator, ExactMatch, Contains, Regex, JsonSchema

Requirements

  • Python 3.10+
  • An OpenRouter API key (or implement your own provider)

Contributing

Found a bug? Want a feature? PRs welcome!

git clone https://github.com/deyna256/promptum.git
cd promptum
just sync     # Install dependencies
just test     # Run tests
just style    # Check code style
just format   # Format code
just type     # Type checking

License

MIT - do whatever you want with it.


Star on GitHub | Report Bug | Request Feature

Made for developers who value their time.

Release files for promptum 0.1.3

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

Source distribution (sdist)

Source distribution for promptum 0.1.3
File Size Uploaded
promptum-0.1.3.tar.gz 47.0 kB Details

Built distribution (wheel)

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

Total release size: 62.2 kB

Release files / promptum-0.1.3.tar.gz

Download URL promptum-0.1.3.tar.gz
Size 47.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7561a3fd46bdb8bc2c11952c9f8ac1575f8a4faa619de6111a4e5aa107a58d06
BLAKE2b-256 checksum
How to use checksums
2c15c998d7ea13c50f0ba1e88b4fb020936078856a727d1ac5a3c6458c7939bb
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 Mar 2, 2026.

Transparency log

Release files / promptum-0.1.3-py3-none-any.whl

Download URL promptum-0.1.3-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c04fde615415e4b90ef8f84e4142b1300f2efcb3ab75f9f0398bb47264185501
BLAKE2b-256 checksum
How to use checksums
c2a2f334ea732e08617765e998233eac353271585e72e4d450f649b1f7da38a8
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 Mar 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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