Skip to content

AI-Prompt-Optimizer

Crafting Smarter Prompts to Unlock Better AI Responses Efficient, Clear, and Cost Effective.

Core trick

Counts tokens with GPT-5-specific encoding and shortens prompts through spaCy lemmatization, with an optional LangGraph agent that searches the web.

Tags

Description

AI Prompt Optimizer is a Streamlit-powered tool that helps you write shorter, smarter prompts for AI models like GPT-5, Claude, and LLaMA—cutting token usage and costs without losing quality. It offers three optimization modes: Local Optimizer (spaCy + Lemminflect): Quickly cleans and simplifies prompts with rules and lemmatization. LLM Optimizer (LangChain + GPT-5): Uses GPT-5 with 8 expert personas for context-aware rewriting. Agent Optimizer (LangGraph + GPT-5): A smart agent that can even search the web via Tavily to enhance prompts in real time. Key Features: Accurate token counting with GPT-5-specific encoding. Instant cost-saving calculations with custom model rates. Modern, responsive UI with side-by-side comparison. Export and share optimized prompts with savings stats. Adjustable optimization levels to match your needs. With AI Prompt Optimizer, you craft clear, efficient prompts—saving money and boosting AI performance.
AliAhmad238/AI-Prompt-Optimizer★ 13 forksPythonCreated Aug 22, 2025 · last push Dec 9, 2025

README excerpt

# 🚀 AI Prompt Optimizer

**AI Prompt Optimizer** is a multilingual Streamlit-based tool that intelligently shortens and optimizes your AI prompts, reducing token usage while maintaining semantic integrity.
This helps you **cut costs** on API calls for models like GPT-5, Claude, and LLaMA, without sacrificing output quality.

🌍 **Now available in English, Arabic, and French!**

### 🏆 Hackathon Project

This project was created as part of the [Co-Creating with GPT-5 Hackathon](https://lablab.ai/event/co-creating-with-gpt-5/promptcraft/ai-prompt-optimizer) hosted by Lablab AI.

---

## ✨ Key Features

### 🌐 **Multilingual Support**
- **Three Languages:** Full interface localization in English, Arabic, and French
- **URL Persistence:** Language preference saved in URL for easy sharing
- **Persona Localization:** All optimization personas translated to selected language
- **Seamless Switching:** Instant language changes without page reload

### 🚀 **Triple Optimization Modes**
- **Local Optimizer:** Uses spaCy and Lemminflect for fast, rule-based optimization
- **LLM-based Optimizer (LangChain):** Uses GPT-5 for advanced, context-aware optimization with **9 specialized personas**
- **Agent-based Optimizer (LangGraph):** Uses a GPT-5 powered ReAct agent for intelligent, autonomous optimization with search capabilities

### 🎨 **Enhanced UI/UX Design**
- Modern gradient-based interface with professional styling
- Responsive design with clean visual hierarchy
- Improved text wrapping f

Team