AI Engineering Demo: My Own AI Tools Built with PHP
In this video I am giving a demo on AI engineering on my AI work:
Normal AI | Voice AI | Advance AI | Save Token for AI Input
What I built
- A small AI section on my own website, built with plain PHP, HTML and free-tier AI APIs.
- The API key stays on the server, so visitors never see it.
- It has 4 tools, and you can switch between them from the menu bar.
1. Normal AI
- A simple, fast chat. Type a question and get an answer.
- Best for quick questions.
2. Advance AI
- A bigger chat box with multi-line input.
- It shows live counters for characters, words and estimated tokens while you type.
- It has a copy button for replies and code, and shows which model answered.
- It automatically falls back to another model if one fails.
3. Voice AI
- Speech → Text: record or upload audio and get text, with optional translation to English.
- Text → Speech: type text and hear it spoken, in English or Arabic voices.
- Voice chat: speak to the AI and hear the reply.
- Safety check: screen text for prompt attacks or for rules you define.
4. Save Token for AI Input
- Helps you reduce the size of your input before sending it to AI.
- Fewer tokens means lower cost and fewer rate-limit problems on free plans.
Key lessons from AI engineering
- Free AI APIs are not truly unlimited. They have per-minute and daily limits, so plan for them.
- Not every model is a chat model. Some only do speech-to-text, text-to-speech or safety checks.
- Add a fallback list of models, so the site keeps working if one disappears.
- Tokens are roughly 4 characters or ¾ of a word, so tracking them saves money.
- Never put an API key in browser code. Keep it in PHP on the server.
- Add rate limits so one visitor can’t use up your free quota.
- If cURL gives a certificate error, add a
cacert.pem file next to your PHP files. This happened to me on a MAMP setup.
Try it yourself
TAGS='ai'
Comments (0)
No comments yet. Be the first to share your thoughts!