Skip to main content

llmsim (Python)

In-process llmsim server for Python tests: a fast LLM API simulator for the OpenAI (Chat Completions, Responses, Images), Anthropic Messages, and OpenResponses APIs. No model, no network, no API key. The server is the same Rust code as the llmsim CLI, shipped as a native wheel.

pip install llmsim

Usage

from openai import OpenAI
from llmsim import Server

with Server(generator="echo", latency="instant") as sim:
    client = OpenAI(base_url=sim.openai_base_url, api_key="unused")
    reply = client.chat.completions.create(model="gpt-5", messages=[{"role": "user", "content": "hello"}])
    assert reply.choices[0].message.content == "Echo: hello"
    print(sim.stats()["total_requests"])  # 1

Anthropic:

import anthropic

with Server(latency="instant") as sim:
    client = anthropic.Anthropic(base_url=sim.anthropic_base_url, api_key="unused")

pytest fixture:

import pytest
from llmsim import Server


@pytest.fixture(scope="session")
def llm():
    with Server(latency="instant") as sim:
        yield sim

Configuration

Server(...) accepts the same settings as the llmsim serve TOML file. Sources merge in this order, later wins: config_file= or toml=, then config= (a dict shaped like the TOML), then the shortcut keywords.

Keyword Meaning
host, port Bind address. Defaults 127.0.0.1 and 0 (a free port).
generator lorem (default), echo, random, sequence, fixed:<text>
target_tokens Target response length
latency Named profile: instant, fast, gpt5, claude-sonnet, ...
script Scripted-mode file (exact replies, tool calls, per turn)
scenarios Load-test scenario file or directory
Server({"errors": {"rate_limit_rate": 0.2, "server_error_rate": 0.05}})
Server(config_file="llmsim.toml", port=8080)

Properties: url, port, host, openai_base_url, anthropic_base_url, openresponses_base_url, config, is_running. Methods: start(), stop(), stats(). Server is a sync and async context manager.

See the configuration docs for every option.

Metadata

Release files for llmsim 0.7.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 llmsim 0.7.0
File Size Uploaded Provenance Actions
llmsim-0.7.0.tar.gz 1.4 MB Without provenance Details for llmsim-0.7.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for llmsim 0.7.0
File Actions
llmsim-0.7.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for llmsim-0.7.0-cp39-abi3-win_amd64.whl
llmsim-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for llmsim-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl
llmsim-0.7.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for llmsim-0.7.0-cp39-abi3-musllinux_1_2_aarch64.whl
llmsim-0.7.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for llmsim-0.7.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
llmsim-0.7.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for llmsim-0.7.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
llmsim-0.7.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for llmsim-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
llmsim-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for llmsim-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 44.7 MB

Release files / llmsim-0.7.0.tar.gz

Download URL llmsim-0.7.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
54f9276dba350450b804976e3cd8bac567347c58738237f8b263ca7304696061
BLAKE2b-256 checksum
How to use checksums
290276c1d203831da75db6b095472bd9f4fac55072ea2d1b92cf66456a6e5ba6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llmsim-0.7.0-cp39-abi3-win_amd64.whl

Download URL llmsim-0.7.0-cp39-abi3-win_amd64.whl
Size 5.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
fc521098fab22add07082a62bfbd96d823d71c136ae677ad94ed64ea3ef16c87
BLAKE2b-256 checksum
How to use checksums
2ad40701485d3550cb167586528e3c9faada6afaf4f833dc57db437e33ae31f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llmsim-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL llmsim-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 6.6 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
42aa44440f947fc016cc712314a59b70de1a844055c6145dbad7e288c5fc8f42
BLAKE2b-256 checksum
How to use checksums
10ca35257c85fe7cf1b3957f46ba0422e6fe2b7ce98c4fa40edb69b45652c770
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llmsim-0.7.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL llmsim-0.7.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 6.5 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
4c93910ae94f45d4e7b3cc618970fb2bccc932332801872be9a67bceb9c86d35
BLAKE2b-256 checksum
How to use checksums
bfef30ea35529225b8f4f2418c56d75fd11dc39f8bd6bf0b7e0f1cda8b06be79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llmsim-0.7.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL llmsim-0.7.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 6.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
903e75d6439c1dae8452bfccc4ea1cbb058bc757ba4881627ab81c6d7f6e9386
BLAKE2b-256 checksum
How to use checksums
74b5c0921437e25594a0d9db512b4cfc7d79d4f1b920a07c86badae83703e0fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llmsim-0.7.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL llmsim-0.7.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.3 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
2a9c51cd95330d95a589cccfda40087871676c20c31bb99d756bb3186b468317
BLAKE2b-256 checksum
How to use checksums
ee4aafa5a20dbdaebd001d2de81dcadb35c8c19f0f8fb08d8f6381162b9dcc99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llmsim-0.7.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL llmsim-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
Size 6.0 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
101c1458426d07cc5d91aef2e66df1d1c425b0e58ffe84082c16a7ad80f92985
BLAKE2b-256 checksum
How to use checksums
81d71701ed03d16b3b5188a242ab8ec84aa3e03218a37027a9224933fc3ea9da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llmsim-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL llmsim-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 6.0 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
458b838a190dcff371d1a5d16a4a6b2f275f4aa5587899112eb05a1434d79afc
BLAKE2b-256 checksum
How to use checksums
1428b3fa9ec03cfa15f24da2023d9e57ee6f21395ec8f0c8d7a30b2f49cb75ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llmsim 0.7.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.7.0 This release

8 release files No 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