Micro AI Tool
AI Prompt Refiner
This project turns rough prompts into cleaner, stronger prompt variants using the OpenAI Responses API. It is intentionally lightweight and does not require a database.
What It Does
- Takes an original prompt from the user.
- Lets the user choose a refinement mode, tone, and use case.
- Returns three prompt variants: refined, concise, and expert.
- Shows the result pack in a focused modal popup for easier copying.
- Explains what improved in a short list.
Setup
- Open
functions/config.local.php. - Add your OpenAI API key to
openai_api_key. - Keep or change the default model in
openai_model. The project starts withgpt-5-mini. - Optional: add
adsense_clientandadsense_sidebar_slotto activate the right sidebar ad area. - Optional: instead of the local config file, you can provide
OPENAI_API_KEYfrom the server environment. - Load
/AiPromptRefiner/in your browser through MAMP.
How To Use
- Paste your original prompt into the main textarea.
- Choose the refinement mode that matches your goal.
- Optionally add tone, use case, goal, and extra context.
- Click
Refine Prompt. - Review the generated output in the popup modal.
- Copy the version you want, or reopen it with the
View Refined Outputbutton.
Folder Structure
index.php– main UI entry pointcss/style.css– full interface stylingjs/app.js– browser-side interactions and API requestsfunctions/lib.php– configuration, validation, OpenAI request logicfunctions/config.local.php– local API key and model settingsfunctions/api.php– backend endpoint for prompt refinementstorage/logs– lightweight debug logs
Security Notes
- The
functionsandstoragefolders are protected with.htaccess. - Requests use a CSRF token.
- A simple file-based rate limit helps reduce abuse without a database.
Troubleshooting
- If you see an API key error, check
functions/config.local.phpor your environment variables. - If responses fail, confirm that your PHP setup supports
curl. - If folder protection does not work, make sure Apache allows
.htaccessoverrides.