prompt-optimizer README

README проекта с github.com/linshenkx/prompt-optimizer. Одним файлом markdown: README.md.

Prompt Optimizer 🚀

English | 中文

GitHub stars Chrome Web Store Users

linshenkx%2Fprompt-optimizer | Trendshift

License Docker Pulls GitHub forks Deploy with Vercel

Website | Online Optimizer | Prompt Garden | Docs | Quick Start | Chrome Extension | 💖 Support

First-time Tutorial | Development Docs | Vercel Deployment Guide | Cloudflare Deployment Guide | MCP Deployment Guide | DeepWiki Docs | ZRead Docs

📖 Project Introduction

Prompt Optimizer is a powerful AI prompt optimization tool that helps you write better AI prompts and improve the quality of AI outputs. It supports four usage methods: web application, desktop application, Chrome extension, and Docker deployment.

Prompts can start from manual writing, templates, local imports, or sources such as Prompt Garden. Prompt Optimizer is where those prompts are optimized, tested, evaluated, and saved as reusable prompt assets.

🎥 Feature Demonstration

1. Prompt Optimization: Clearer, Better-Structured Output

Clarify goals, constraints, and output structure. Compare both prompt versions on the same model to see changes in organization and emphasis.

Comparing output structure before and after prompt optimization

2. Variable Templates: Optimize Once, Reuse Across Inputs

Turn changing inputs into variables while reusing instructions and constraints. Compare prompt versions side by side for concise replies that follow your requirements.

Reusing a variable template and comparing original and optimized replies
See test results with different variable values Comparing original and optimized replies with different variable values

3. Arena: One Task, Multiple Models

Give the same prompt to multiple models. Compare output quality, style, and instruction following side by side to choose a model for your task.

Arena comparing GPT-6.2 Astra, GPT-6.2 Sol, and DeepSeek Flash on the same task

✨ Core Features

🚀 Advanced Features

Image Generation Mode

Prompt Sources & Smart Favorites

Advanced Testing Mode

Image workspace guides: Text-to-Image · Image-to-Image · Multi-Image

Quick Start

Direct access: https://prompt.always200.com

The online app stores its app data in your browser. Model requests go directly to the provider you configure. For your first run, connect one working text model in Model Manager, then follow the first-time tutorial to improve and copy a prompt.

2. Web Deployment

Vercel Deployment

Method 1: One-click deployment to your own Vercel: Deploy with Vercel

Method 2: Fork the project and import to Vercel (Recommended):

For more detailed deployment steps and important notes, please check:

Cloudflare Deployment

Deploy to Cloudflare

Use the Deploy to Cloudflare button for the quickest public-repository setup. It creates a repository under your GitHub/GitLab account and deploys with Workers Builds. For private repositories or stricter repository-access control, import your own repository manually; keep the default deploy commands and clear the build command if Cloudflare auto-fills pnpm run build, because wrangler.jsonc builds the Web frontend and publishes packages/web/dist as static assets.

For access control and analytics on Cloudflare, configure Cloudflare Access and Cloudflare Web Analytics in the Cloudflare dashboard. No frontend dependency or application-code change is required.

3. Download Desktop Application

Download the desktop build for your platform from GitHub Releases. Use the .exe installer for Windows, the .dmg disk image for macOS, or the .AppImage for Linux. Where available, .zip archives can be extracted and run directly.

The desktop app can connect to local models such as Ollama and to API providers that restrict browser requests. The Windows installer and Linux AppImage support in-app updates. On macOS, the app can check for updates. Download and install the new build from GitHub Releases.

4. Install Chrome Extension

  1. Install from Chrome Web Store (may not be the latest version due to approval delays): Chrome Web Store
  2. Click the icon to open the Prompt Optimizer

5. Docker Deployment

Click to view Docker deployment commands

Set ACCESS_PASSWORD to protect the web interface. ACCESS_USERNAME is optional and defaults to admin.

# Run container (default configuration)
docker run -d -p 8081:80 --restart unless-stopped --name prompt-optimizer linshen/prompt-optimizer

# Run container (with API key configuration and password protection)
docker run -d -p 8081:80 \
  -e VITE_OPENAI_API_KEY=your_key \
  -e ACCESS_USERNAME=your_username \
  -e ACCESS_PASSWORD=your_password \
  --restart unless-stopped \
  --name prompt-optimizer \
  linshen/prompt-optimizer

6. Docker Compose Deployment

Click to view Docker Compose deployment steps
# 1. Clone the repository
git clone https://github.com/linshenkx/prompt-optimizer.git
cd prompt-optimizer

# 2. Copy the template and edit .env to set your own ACCESS_PASSWORD
#    and any model API keys used by the Compose service.
cp env.local.example .env

# 3. Start the service
docker compose --env-file .env -f docker/docker-compose.yml up -d

# 4. View logs
docker compose --env-file .env -f docker/docker-compose.yml logs -f

The included Compose file serves the web app at http://localhost:28081 and MCP at http://localhost:28081/mcp. Edit the Compose file to change the host port or which environment variables are passed to the container.

7. MCP Server Usage Instructions

Click to view MCP Server usage instructions

Prompt Optimizer now supports the Model Context Protocol (MCP), enabling integration with AI applications that support MCP such as Claude Desktop.

When running via Docker, the MCP Server automatically starts and can be accessed via http://ip:port/mcp.

Environment Variable Configuration

MCP Server requires API key configuration to function properly. Main MCP-specific configurations:

# MCP Server Configuration
MCP_DEFAULT_MODEL_PROVIDER=openai  # Options: openai, gemini, anthropic, deepseek, grok, siliconflow, zhipu, dashscope, openrouter, modelscope, custom
MCP_LOG_LEVEL=info                 # Log level

Using MCP in Docker Environment

In a Docker environment, the MCP Server runs alongside the web application. You can access the MCP service through the same port as the web application at the /mcp path.

For example, if you map the container's port 80 to port 8081 on the host:

docker run -d -p 8081:80 \
  -e VITE_OPENAI_API_KEY=your-openai-key \
  -e MCP_DEFAULT_MODEL_PROVIDER=openai \
  --name prompt-optimizer \
  linshen/prompt-optimizer

The MCP Server will then be accessible at http://localhost:8081/mcp.

Use that URL with a client that supports Streamable HTTP.

Available Tools

  • optimize-user-prompt: Optimize user prompts to improve LLM performance
  • optimize-system-prompt: Optimize system prompts to improve LLM performance
  • iterate-prompt: Iteratively improve mature prompts based on specific requirements

For more detailed information, please refer to the MCP Server User Guide.

An AI assistant can also use the models you configure and prompts you save in the desktop or web app. See the desktop and browser MCP preview guide (in Chinese).

⚙️ API Key Configuration

Click to view API key configuration methods
  1. Open Model Manager from the top bar.
  2. In Text Models, click Add. Select a provider, enter its API key, and select a model your account can use.
  3. Click Test Connection, then Create.

Set connection defaults under Advanced Parameters in Model Manager. To try a different setting for one test, open that test's model dropdown and adjust the parameters it exposes. See Model Selection and Parameters.

Method 2: Via Environment Variables

Configure environment variables through the -e parameter when deploying with Docker:

-e VITE_OPENAI_API_KEY=your_key
-e VITE_GEMINI_API_KEY=your_key
-e VITE_DEEPSEEK_API_KEY=your_key
-e VITE_GROK_API_KEY=your_key
-e VITE_ZHIPU_API_KEY=your_key
-e VITE_SILICONFLOW_API_KEY=your_key

# Multiple Custom Models Configuration (Unlimited Quantity)
-e VITE_CUSTOM_API_KEY_ollama=dummy_key
-e VITE_CUSTOM_API_BASE_URL_ollama=http://localhost:11434/v1
-e VITE_CUSTOM_API_MODEL_ollama=qwen2.5:7b

📖 Detailed Configuration Guide: See Multiple Custom Models Documentation for complete configuration methods and advanced usage

Local Development

Use Node.js 24 (24.22.1 or later in the 24.x series) and pnpm 10.6.1. See the development guide for details.

Click to view local development commands
# 1. Clone the project
git clone https://github.com/linshenkx/prompt-optimizer.git
cd prompt-optimizer

# 2. Install dependencies
pnpm install

# 3. Start development server
pnpm dev               # Main development command: build core/ui and run web app
pnpm dev:fresh        # Complete reset and restart development environment

🗺️ Roadmap

For detailed project status, see Project Status Document

Star History

Star History Chart

FAQ

Click to view frequently asked questions

API Connection Issues

Q1: Why can't I connect to the model service after configuring the API key?

A: Most connection failures are caused by Cross-Origin Resource Sharing (CORS) issues. As this project is a pure frontend application, browsers block direct access to API services from different origins for security reasons. Model services will reject direct requests from browsers if CORS policies are not correctly configured.

Q2: How to solve Ollama connection issues?

A: Ollama fully supports the OpenAI standard interface, just configure the correct CORS policy:

  1. Set environment variable OLLAMA_ORIGINS=* to allow requests from any origin
  2. If issues persist, set OLLAMA_HOST=0.0.0.0:11434 to listen on any IP address

Q3: How to solve CORS issues with commercial APIs (such as Nvidia's DS API, ByteDance's Volcano API)?

A: These platforms typically have strict CORS restrictions. Recommended solutions:

  1. Use Desktop Application (Most Recommended)

    • Desktop app has no CORS restrictions as a native application
    • Can directly connect to any API service, including locally deployed models
    • Provides the most complete and stable feature experience
    • Download from GitHub Releases
  2. Use Self-deployed API Proxy Service (Professional solution)

    • Deploy open-source API aggregation/proxy tools like OneAPI, NewAPI
    • Configure as custom API endpoint in settings
    • Request flow: Browser → Proxy service → Model service provider
    • Full control over security policies and access permissions

Note: All web versions (including online version, Vercel deployment, Docker deployment) are pure frontend applications and subject to browser CORS restrictions. Only the desktop version or using an API proxy service can solve CORS issues.

Q4: I have correctly configured CORS policies for my local model (like Ollama), why can't I still connect using the online version?

A: This is caused by the browser's Mixed Content security policy. For security reasons, browsers block secure HTTPS pages (like the online version) from sending requests to insecure HTTP addresses (like your local Ollama service).

Solutions: To bypass this limitation, you need to have the application and API under the same protocol (e.g., both HTTP). We recommend the following approaches:

  1. Use the desktop version: Desktop applications have no browser restrictions and are the most stable and reliable way to connect to local models
  2. Use Docker deployment (HTTP): Access via http://localhost:8081, both the app and local Ollama use HTTP
  3. Use Chrome extension: Extensions can bypass some security restrictions in certain situations

macOS Desktop Application Issues

Q5: macOS shows "damaged" or "unverified developer" when opening the app?

A: This is because the application has not been signed with an Apple Developer certificate. Due to the high cost of Apple Developer accounts, the desktop application is currently unsigned.

Solution: Run the following command in Terminal to remove the quarantine attribute:

# For installed applications
xattr -rd com.apple.quarantine /Applications/PromptOptimizer.app

# For downloaded .dmg files (run before installation)
xattr -rd com.apple.quarantine ~/Downloads/PromptOptimizer-*.dmg

After running the command, you can open the application normally.

🤝 Contributing

Click to view contribution guidelines
  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Tip: When developing with Cursor tool, it is recommended to do the following before committing:

  1. Use the "CodeReview" rule for review
  2. Check according to the review report format:
    • Overall consistency of changes
    • Code quality and implementation method
    • Test coverage
    • Documentation completeness
  3. Optimize based on review results before submitting

👏 Contributors

Thanks to all the developers who have contributed to this project!

Contributors

🙏 Acknowledgements

This project was partly inspired by LangGPT in prompt engineering and structured prompt design. Thanks to the LangGPT project and community for their open-source sharing and continued exploration.

📄 License

This project is licensed under AGPL-3.0.

In simple terms: You can freely use, modify, and commercialize this project, but if you turn it into a website or service for others, you must share your source code.

👉 Click for detailed explanation

What you can do:

  • ✅ Personal use, learning, and research
  • ✅ Internal company use (not offering public services)
  • ✅ Modify code for commercial projects
  • ✅ Charge for products or services

What you must do:

  • 📖 If distributing software or offering network services, disclose source code
  • 📝 Preserve original author's copyright notices

Core principle: Commercial use is allowed, but not closed-source.


If this project is helpful to you, please consider giving it a Star ⭐️

👥 Contact Us

prompt-optimizer (linshenkx/prompt-optimizer)

Ищем в базе…

Что это такое?Prompt Optimizer - это инструмент на основе ИИ, который помогает писать более удачные промпты и получать лучшие результаты от моделей ИИ. Доступен как веб-приложение, настольное приложение, расширение для Chrome и вариант для развёртывания в Docker.
Это веб-приложение, настольное приложение или расширение для браузера?Сразу всё вместе, плюс вариант для Docker: один и тот же оптимизатор выпускается как веб-приложение, нативное настольное приложение, расширение для Chrome и самостоятельно развёртываемый контейнер Docker.
Как начать пользоваться?Проще всего воспользоваться онлайн-версией: это чисто фронтенд-приложение, его не нужно устанавливать. Для собственного развёртывания можно одной кнопкой развернуть приложение в Vercel или Cloudflare, скачать настольный установщик со страницы GitHub Releases, установить расширение для Chrome или запустить через Docker/Docker Compose.
Нужен ли мне собственный API-ключ от поставщика ИИ?Да, нужно настроить API-ключ одного из поддерживаемых поставщиков, например OpenAI, Gemini, DeepSeek, Grok, Zhipu AI, SiliconFlow или MiniMax. Сделать это можно в панели настроек либо через переменные окружения при запуске образа Docker.
Есть ли в веб-версии ограничения, которых нет в настольном приложении?Да, веб-приложение и расширение работают в браузере и подчиняются ограничениям CORS, поэтому подключение к таким сервисам, как локальный экземпляр Ollama или строгие коммерческие API, может не работать. Настольное приложение полностью снимает это ограничение.
Можно ли пользоваться настольным приложением на Windows, Mac и Linux?Да, на странице GitHub Releases есть установщики и архивы для каждой платформы, например .exe для Windows, .dmg для macOS и .AppImage для Linux.
Куда попадают мои промпты и данные API-ключа?Всё работает на стороне клиента, то есть в вашем браузере или локальном приложении, и обращается напрямую к API поставщика ИИ. Никакой промежуточный сервер не видит ваши промпты и ключи.
Что такое Prompt Garden?Prompt Garden - один из источников промптов для импорта наряду с ручным написанием, шаблонами и локальными файлами. Из него можно взять исходные промпты, которые Prompt Optimizer затем улучшает и позволяет сохранить как избранные для повторного использования.
Можно ли использовать это внутри Claude Desktop?Да, приложение реализует Протокол контекста модели (Model Context Protocol, MCP) и предоставляет инструменты, например optimize-user-prompt, optimize-system-prompt и iterate-prompt, которые Claude Desktop или любое другое приложение с поддержкой MCP может вызывать напрямую.
Можно ли генерировать или редактировать изображения, а не только текстовые промпты?Да, помимо оптимизации текстовых промптов поддерживаются режимы Text-to-Image, Image-to-Image и Multi-Image с использованием таких моделей, как Gemini, Seedream и Grok, включая перенос стиля с опорных изображений.
Что происходит с промптами, которые я отмечаю как избранные?Smart Favorites сохраняет их как многократно используемые материалы с историей версий, воспроизводимыми примерами, поддержкой медиафайлов и привязкой к источнику, так что их можно снова применить к будущим задачам.
Какие есть похожие проекты?opencodex, gpt4free, system_prompts_leaks, evenfire, chathub, prompts.chat, NextChat, repomix
Автор
linshenkx
Размер
51.3 MB
Звёзды
43K
Возраст
1 г
Коммиты · 90 дней