Automatically inspect and visualize LLM prompts and responses in your Python projects
Project description
anyprompt 📝
anyprompt is a powerful yet simple tool that automatically monitors and visualizes LLM prompts and responses in your Python projects. With a single import, you get a beautiful web interface to inspect all prompts going to various AI providers.
Features
- Zero Configuration: Just import and it works!
- Automatic Detection: Captures prompts from popular LLM libraries (OpenAI, Anthropic, etc.)
- Beautiful UI: Modern, responsive web interface with dark mode support
- Compatible with all major HTTP libraries:
requestshttpx(sync and async)aiohttp- Python's built-in
urllibandhttp.client
- Non-Intrusive: Won't interfere with your existing code
- Real-time Updates: The UI automatically refreshes as new prompts are captured
Installation
pip install anyprompt
For full functionality with all supported HTTP clients:
pip install "anyprompt[all]"
Quick Start
Just import anyprompt in your code, and it will automatically start capturing prompts:
from openai import OpenAI
import anyprompt # Automatically starts the web interface at http://localhost:2400
client = OpenAI()
# This prompt will be automatically captured!
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Tell me a joke about programming"}]
)
print(response.choices[0].message.content)
That's it! When you import anyprompt, it will print a message like:
📦 anyprompt: ✨ anyprompt is running! View your prompts at http://localhost:2400
Click on the link or navigate to http://localhost:2400 in your browser to see your captured prompts.
How It Works
anyprompt works by patching popular HTTP libraries to intercept and record API calls to LLM services. When a request is made to a known LLM service, anyprompt captures the prompt data and displays it in the web interface.
The captured prompts are stored in a prompts/prompts.json file in your current working directory, so they persist between runs. You can clear this history anytime through the web interface.
Supported Services
anyprompt can detect prompts sent to:
- OpenAI (including chat, completions, embeddings)
- Anthropic
- Cohere
- AI21
- Hugging Face Inference API
- Any other API that uses standard HTTP requests with a similar format
Privacy & Security
- anyprompt only runs locally on your machine
- No data is ever sent to external servers
- All captured prompts are stored locally in your project directory
- The web interface is only accessible from your local machine
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the anyprompt team
Project details
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 anyprompt-0.1.0.tar.gz.
File metadata
- Download URL: anyprompt-0.1.0.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44985c8ed11191abf3107ef9691402a34b8495f37609a56f16cd8817c9dd596b
|
|
| MD5 |
f6acad20d6149c520c6d53e32853ba29
|
|
| BLAKE2b-256 |
e724d08970bca9c5a2172d2c7024bf2f828f43c6c7905ffcc22ae2f8730a2cc2
|
File details
Details for the file anyprompt-0.1.0-py3-none-any.whl.
File metadata
- Download URL: anyprompt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0efa2437de8e5f5862ba4ab9b0386d0bdba7292edaa3b32a17008197b4a40076
|
|
| MD5 |
12787ecf2292c3e457bf4b2b7c838807
|
|
| BLAKE2b-256 |
3b937bd799fbb34cdf134c66474f2597e2e1ffc3bf60d9c3eeae0120984d3f5e
|