Wind shear for LLM APIs — intercept, mutate, record, replay, and stress-test any LLM conversation.
Project description
windtunnel-shear
Wind shear for LLM APIs — intercept, mutate, record, replay, and stress-test any LLM conversation.
Install
pip install windtunnel-shear
Quickstart
1. See your LLM traffic (zero config)
shear proxy
# Point your app at localhost:9800 and watch requests flow
→ gpt-4o | 3 messages | 847 tokens
← 200 | 234 tokens | 1.2s | "The capital of France is..."
2. Record and replay
# Record a session
shear record -o session.json
# Replay without API calls
shear replay -i session.json
3. Inject faults and jitters
# Test your app's resilience
shear proxy --fault rate-limit:0.3
# Test your LLM's robustness
shear proxy --jitter noise:0.1
# Combine freely
shear proxy --fault latency:200ms --jitter contradict
4. Library mode
from windtunnel_shear import wrap
from openai import OpenAI
client = wrap(OpenAI()) # that's it
Why Shear?
Shear is not a gateway (no routing or load balancing), not an observability platform (no dashboards), and not a guardrail system (no content filtering). It's the "what if" tool — what if 30% of requests get rate-limited? What if the user prompt has typos? What if the system prompt gets contradicted? Shear answers these questions without changing your application code.
Features
| Feature | Status |
|---|---|
| HTTP proxy with auto-detect upstream | ✅ v0.1 |
| Human-readable console output | ✅ v0.1 |
| Record & replay sessions | ✅ v0.1 |
Library mode (wrap()) |
✅ v0.1 |
| Infrastructure faults (rate-limit, latency, error, timeout) | ✅ v0.1 |
| Prompt jitters (noise, contradict, dilute, rephrase) | ✅ v0.1 |
| Hook pipeline (before_request, after_response, on_error) | ✅ v0.1 |
| SSE streaming support (reassemble + re-stream) | ✅ v0.1 |
| Token counting (tiktoken) | coming |
Session inspector (shear inspect) |
coming |
Response simulation (shear simulate) |
coming |
| Tool call jitters | coming |
| Chunk-level stream mutation | coming |
CLI Reference
shear proxy # Zero-config proxy on port 9800
shear proxy --port 8080 # Custom port
shear proxy --upstream https://api.openai.com/v1 # Explicit upstream
shear proxy --hooks my_hooks.py # Custom hook file
shear proxy --verbose # Full payloads
shear proxy --json # Machine-readable output
shear proxy --fault rate-limit:0.3 # 30% rate limiting
shear proxy --fault latency:500ms # Add 500ms latency
shear proxy --fault error:503:0.1 # 10% 503 errors
shear proxy --fault timeout:10s # Timeout after 10s
shear proxy --jitter noise:0.1 # 10% word-level typos
shear proxy --jitter contradict # Contradict system prompt
shear proxy --jitter dilute:5 # Pad with 5 irrelevant turns
shear proxy --jitter rephrase # Reword system prompt
shear record -o session.json # Record traffic
shear replay -i session.json # Replay from file
shear proxy --timeout 30s # Upstream timeout
shear proxy --verbose # Compact + jitter diffs
shear proxy --debug # Full JSON payloads
Hook API
from windtunnel_shear import Hook
from windtunnel_shear.core.models import InterceptedRequest, InterceptedResponse
@Hook.before_request(name="add_system_prompt")
def add_system_prompt(req: InterceptedRequest) -> InterceptedRequest:
req.messages.insert(0, {"role": "system", "content": "Be concise."})
return req
@Hook.after_response(name="log_usage")
def log_usage(req: InterceptedRequest, resp: InterceptedResponse) -> InterceptedResponse:
print(f"Tokens used: {resp.usage}")
return resp
Part of Wind Tunnel
Shear is the first building block of the Wind Tunnel family of LLM testing tools by Butterfly Labs.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file windtunnel_shear-0.1.0.tar.gz.
File metadata
- Download URL: windtunnel_shear-0.1.0.tar.gz
- Upload date:
- Size: 58.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2db1cacd514f8479969b648f000c9ff3d858fc6f945889fb632cda6eb884424
|
|
| MD5 |
208d4de3d50708007782042533173643
|
|
| BLAKE2b-256 |
0eb9c45270dab0bb1a6c73b884a70eca656c826b9162ea11b31f185cee1c0360
|
File details
Details for the file windtunnel_shear-0.1.0-py3-none-any.whl.
File metadata
- Download URL: windtunnel_shear-0.1.0-py3-none-any.whl
- Upload date:
- Size: 47.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ba2d90de5131508aafc9c5c4dcccbcc0d07fbbf245fca17ecfd01b1586a1ea5
|
|
| MD5 |
0f1638d67067c182c08e638ce9a97bb7
|
|
| BLAKE2b-256 |
8c5977098069add2ccc15913049ec11e3b95292a700b16a4d724681d4f273e7d
|