PromptForge: Autonomous Prompt Generator PromptForge is an innovative tool for AI prompt engineers to generate multiple professional prompts from a simple topic. Built with a sleek Streamlit UI, it creates 4 prompt versions with different tones (formal, fun, aggressive, casual) and styles (long, short, detailed, bullet points) using OpenRouter's free-tier model (LLaMA 3.1 8B Instruct). Features
Topic Input: Enter a simple topic (e.g., 'blog about AI', 'story about robots'). Multiple Prompts: Generates 4 prompts with distinct tones and styles. Creativity Slider: Adjusts prompt complexity and novelty (1–10). Download Prompts: Save generated prompts as a TXT file. Modern UI: Streamlit-based interface with Tailwind CSS for a professional look.
Installation
Clone the repository: git clone https://github.com/yourusername/promptforge.git cd promptforge
Install dependencies: pip install streamlit requests python-dotenv
Set up your OpenRouter API key in a .env file in the project root: OPENROUTER_API_KEY=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
Run the app: streamlit run app.py
Usage
Open the app in your browser (default: http://localhost:8501). In the sidebar, select the OpenRouter model and adjust the creativity level. Enter a topic (e.g., 'email about sales'). Click "Forge Prompts" to generate 4 prompt versions. View the prompts with labels (e.g., 'Formal/Long', 'Fun/Short'). Click "Download Prompts" to save them as a TXT file.
Troubleshooting
401 Unauthorized Error: Ensure the .env file is in the promptforge/ directory and contains the correct API key. Verify your API key is valid at OpenRouter's dashboard. Run pip install python-dotenv to load the .env file. Restart the app after updating the .env file.
Rate Limits: The free tier has strict rate limits. Wait a few minutes if you hit limits. Check OpenRouter's status page for service issues.
API Key Validation: The app tests the API key on startup. Check terminal logs for errors if it fails.
File Structure
app.py: Main Streamlit application with the UI and core logic. prompt_generator.py: Prompt generation logic with tone and style variations. models_config.py: OpenRouter model configurations and client initialization. README.md: Project documentation.
Contributing Contributions are welcome! Please open an issue or submit a pull request on GitHub. Ensure your code follows PEP 8 and includes tests where applicable. License MIT License. See LICENSE for details.