LLMSim provides these API providers:
| Provider | Base Path | Description |
|---|---|---|
| OpenAI | /openai/v1/ |
OpenAI-compatible Chat Completions and Responses API |
| OpenResponses | /openresponses/v1/ |
OpenResponses specification |
| Anthropic | /anthropic/v1/ |
Anthropic Messages API |
| TypeSafe | /typesafe/v1/ |
TypeSafe System One API |
| Endpoint | Method | Description |
|---|---|---|
/openai/v1/chat/completions |
POST | Chat completions (streaming supported) |
/openai/v1/responses |
POST | Responses API (streaming supported) |
/openai/v1/responses |
WS | WebSocket mode for Responses API |
/openai/v1/models |
GET | List available models |
/openai/v1/models/:id |
GET | Get model details |
| Endpoint | Method | Description |
|---|---|---|
/openresponses/v1/responses |
POST | Create response (streaming supported) |
| Endpoint | Method | Description |
|---|---|---|
/anthropic/v1/messages |
POST | Messages API (streaming supported) |
/anthropic/v1/models |
GET | List available Claude models |
/anthropic/v1/models/:id |
GET | Get model details |
| Endpoint | Method | Description |
|---|---|---|
/typesafe/v1/systemone |
POST | System One evaluation (Jev; noul, choice, score) |
/typesafe/v1/models |
GET | List Jev models and aliases |
All examples require the server to be running first:
# Start server (headless)
cargo run --release -- serve --port 8080
# Or start with TUI dashboard to watch stats in real-time
cargo run --release -- serve --port 8080 --tuiDemonstrates library usage: token counting, generators, latency profiles, and streaming.
cargo run --example basic_usageDirect usage of the official OpenAI Python library:
uv run examples/openai_client.pyUsing the OpenResponses specification with httpx:
uv run examples/openresponses_client.pyGenerate simulated images (gpt-image / "ChatGPT Images"), including streaming with progressive partial images. Each image is a synthetic PNG of the requested size rendering the prompt text and a "LLMSIM SIMULATED IMAGE" watermark:
uv run examples/images_client.pyUsing the WebSocket transport for the Responses API:
uv run examples/openai_websocket_client.pyUsing LangChain's OpenAI-compatible client:
uv run examples/langchain_client.pyUsing Pydantic AI via its OpenAI-compatible provider:
uv run examples/pydantic_ai_client.pyStructured
output_typeresults and tool calling require the server to be running in scripted mode; a default server returns simulated text.
Direct usage of the official Anthropic Python SDK (messages, streaming, tools, models):
uv run examples/anthropic_client.pyUsing LangChain's ChatAnthropic client:
uv run examples/anthropic_langchain.pyDirect usage of the official TypeSafe Python SDK (typesafe-sdk): System One
with noul, choice, and score questions, deterministic answers, a server-side
validation error, and model listing:
uv run examples/typesafe_client.pyDrive a deterministic multi-turn script (tool calls, errors, mixed text+calls) for agent scenario tests:
# Boot the server with a script file
cargo run -- serve --config examples/scripted_demo/scripted_demo.toml
# In another shell
uv run examples/scripted_demo/scripted_demo.pySee knowledge/simulation/scripted-mode.md for the full
script JSON format.
The TypeScript examples live in their own folder with a pinned
package.json/package-lock.json:
cd examples/node
npm installDirect usage of the official OpenAI Node.js library:
npx tsx openai_client.tsGenerate simulated images (gpt-image / "ChatGPT Images"), including streaming with progressive partial images:
npx tsx images_client.tsUsing the Vercel AI SDK via its OpenAI-compatible provider:
npx tsx vercel_ai_client.ts
generateObjectand tool calling require the server to be running in scripted mode; a default server returns simulated text.
Direct usage of the official Anthropic Node.js SDK:
npx tsx anthropic_client.tsDirect usage of the official Anthropic Go SDK (the module is committed under
examples/go, so no setup is needed):
cd examples/go
LLMSIM_URL=http://localhost:8080/anthropic/ go run anthropic_client.goRaw HTTP against the Anthropic Messages API:
./examples/anthropic_curl.sh# OpenAI examples
LLMSIM_URL=http://localhost:9000/openai/v1 uv run examples/openai_client.py
# OpenResponses example
LLMSIM_URL=http://localhost:9000 uv run examples/openresponses_client.py
# Anthropic example
LLMSIM_URL=http://localhost:9000/anthropic uv run examples/anthropic_client.pyYou can fetch real-time server statistics:
curl http://localhost:8080/llmsim/stats | jqResponse includes:
- Request counts (total, active, streaming, non-streaming)
- Token usage (prompt, completion, total)
- Error breakdown (rate limits, server errors, timeouts)
- Latency metrics (avg, min, max)
- Requests per second
- Per-model request distribution
curl http://localhost:8080/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5",
"messages": [{"role": "user", "content": "Hello!"}]
}'curl http://localhost:8080/openai/v1/responses \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5",
"input": "What is 2+2?"
}'curl http://localhost:8080/openai/v1/images/generations \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-1",
"prompt": "a cat riding a bicycle",
"size": "1024x1024",
"quality": "low"
}'curl http://localhost:8080/openresponses/v1/responses \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5",
"input": "Hello, world!"
}'curl http://localhost:8080/openresponses/v1/responses \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5",
"input": "Tell me a story",
"stream": true
}'curl http://localhost:8080/anthropic/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: not-needed" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-opus-4-8",
"max_tokens": 64,
"messages": [{"role": "user", "content": "Hello, Claude!"}]
}'curl -N http://localhost:8080/anthropic/v1/messages \
-H "content-type: application/json" \
-d '{
"model": "claude-haiku-4-5",
"max_tokens": 64,
"stream": true,
"messages": [{"role": "user", "content": "Tell me a story"}]
}'