AI-powered prompt refinement with adaptive questioning and multi-provider support (6+ LLM backends)
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Refine and optimize prompts for LLMs
If you're already in an async application (e.g., FastAPI), call refine_prompt_async instead of the sync helper.
Promptheus analyzes your prompts and refines them with:
| Provider | Models | Setup |
|---|---|---|
| Google Gemini | gemini-2.0-flash, gemini-1.5-pro | API Key |
| Anthropic Claude | claude-3-5-sonnet, claude-3-opus | Console |
| OpenAI | gpt-4o, gpt-4-turbo | API Key |
| Groq | llama-3.3-70b, mixtral-8x7b | Console |
| Alibaba Qwen | qwen-max, qwen-plus | DashScope |
| Zhipu GLM | glm-4-plus, glm-4-air | Console |
| OpenRouter | openrouter/auto (auto-routing) | Dashboard |
OpenRouter integration in Promptheus is optimized around the openrouter/auto routing model:
OPENROUTER_MODEL or --model if your key has access.π§ Adaptive Task Detection Automatically detects whether your task needs refinement or direct optimization
β‘ Interactive Refinement Ask targeted questions to elicit requirements and improve outputs
π Pipeline Integration Works seamlessly in Unix pipelines and shell scripts
π Session Management Track, load, and reuse past prompts automatically
π Telemetry & Analytics Anonymous usage and performance metrics tracking for insights (local storage only, can be disabled)
π Web Interface Beautiful UI for interactive prompt refinement and history management
Create a .env file with at least one provider API key:
Or run the interactive setup:
Content Generation
Code Analysis
Interactive Session
Pipeline Integration
Testing & Examples: See sample_prompts.md for test prompts demonstrating adaptive task detection (analysis vs generation).
Telemetry & Analytics
Promptheus includes a Model Context Protocol (MCP) server that exposes prompt refinement capabilities as standardized tools for integration with MCP-compatible clients.
The Promptheus MCP server provides:
Prerequisites:
pip install mcp (included in requirements.txt)refine_promptIntelligent prompt refinement with optional clarification questions.
Inputs:
prompt (required): The initial prompt to refineanswers (optional): Dictionary mapping question IDs to answers {q0: "answer", q1: "answer"}answer_mapping (optional): Maps question IDs to original question textprovider (optional): Override provider (e.g., "google", "openai")model (optional): Override model nameResponse Types:
{"type": "refined", "prompt": "...", "next_action": "..."}: Success with refined prompt{"type": "clarification_needed", "questions_for_ask_user_question": [...], "answer_mapping": {...}}: Questions needed{"type": "error", "error_type": "...", "message": "..."}: Error occurredtweak_promptApply targeted modifications to existing prompts.
Inputs:
prompt (required): Current prompt to modifymodification (required): Description of changes (e.g., "make it shorter")provider, model (optional): Provider/model overridesReturns:
{"type": "refined", "prompt": "..."}: Modified promptlist_modelsDiscover available models from configured providers.
Inputs:
providers (optional): List of provider names to querylimit (optional): Max models per provider (default: 20)include_nontext (optional): Include vision/embedding modelsReturns:
{"type": "success", "providers": {"google": {"available": true, "models": [...]}}}list_providersCheck provider configuration status.
Returns:
{"type": "success", "providers": {"google": {"configured": true, "model": "..."}}}validate_environmentTest environment configuration and API connectivity.
Inputs:
providers (optional): Specific providers to validatetest_connection (optional): Test actual API connectivityReturns:
{"type": "success", "validation": {"google": {"configured": true, "connection_test": "passed"}}}The MCP server supports a structured clarification workflow for optimal prompt refinement:
Use your MCP client's AskUserQuestion tool with the provided questions, then map answers to question IDs.
Response:
The MCP server operates in two modes:
Interactive Mode (when AskUserQuestion is available):
Structured Mode (fallback for all clients):
clarification_needed response with formatted questionsanswer_mapping dictionaryQuestion Format:
Each question in questions_for_ask_user_question includes:
question: The question text to displayheader: Short identifier (Q1, Q2, etc.)multiSelect: Boolean for multi-select optionsoptions: Array of {label, description} for radio/checkbox questionsAnswer Mapping:
q0, q1, q2, etc.{"q0": "answer", "q1": "answer"}answer_mapping preserves original question text for provider contextMCP Package Not Installed
Fix: pip install mcp or install Promptheus with dev dependencies: pip install -e .[dev]
Missing Provider API Keys
Diagnosis: Use list_providers or validate_environment tools to check configuration status
Provider Misconfiguration
Fix: Set missing API keys in .env file or environment variables
Connection Test Failures
Fix: Verify API keys are valid and have necessary permissions
Quick reference: promptheus --help
Comprehensive guides:
See CLAUDE.md for detailed development guidance.
MIT License - see LICENSE for details
Contributions welcome! Please see our development guide for contribution guidelines.
Questions? Open an issue | Live demo: promptheus web
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/promptheus)<a href="https://allmcps.com/mcp/promptheus"><img src="https://allmcps.com/api/badge/promptheus?style=directory" alt="Promptheus on AllMCPs" /></a>