Create Custom AI Tools

Rate this post

If you want to create your own ai tool for free then you can follow these step to make your own ai tool. as we know that when we search on google about the latest ai tools then we can find new ai tools everyday, and if you thing that how you can create your own ai tool then you can follow some steps I have mentioned in this article.

What is Ai tool

AI tool is kind of programm that use the LLM to produced the desired result according to our input. there are a lot of ai tools available in market and every single day bunch of ai tools will lounched. So, after reading this article you can create your own ai tool for free bu just using some different ai tools.

What is the platform required to create an ai tool.

there are a lot of platform available that can help us to create our own ai tools but most of them are expancive and rest on other are unable to create custom ai tools. But at the same time you can use different kind of platform to create a new ai tool for free. You need to use the following things to create the ai tool.

  1. Hosting https://bit.ly/3QrDi4k
  2. Test the toolhttps://bit.ly/3S9sE3B
  3. Claude https://claude.ai/chats
  4. Openai https://platform.openai.com/account/api-keys
  5. PromptsShared in this post.

How to create your own ai tool

If you want to create your own ai tool then you need a tool Idea – like youtube title generator, tag generator,

story generator, Video script generator or etc…,

after the idea you need a hosting server where you can host your ai tool. I persionally use the hostinger and my feedback is that this platform is the best to host your website or your ai tools.

after this you need to install wordpress and complet the basic setup of wordpress.

Now, Add some pluging that can make your journey easy.

  1. Code snippet
image 80

2. Elementor

image 81

After installing these plugins you need to activate those plugins.

Now you need to create New Post and name the tool and the save as draft.

Now click on Edit with elementor.

image 82

Now search for html code. then drag that and drop into the post section.

image 83

After this you need to visit at https://claude.ai/chats and create your account. after creating this account you need to use some prompts.

Here is the prompts

Prompt 1.

Generate a PHP function named openai_generate_text that uses the OpenAI API to make a chat-based language model call. The function takes no arguments.

Within the function:
1. Retrieve the topic from an AJAX POST request using the variable $prompt.
2. Set the API URL as 'https://api.openai.com/v1/chat/completions'.
3. Define the API key as 'sk-XXX' (Replace with your actual OpenAI API key).
4. Set the headers as an array with 'Content-Type' and 'Authorization' for the OpenAI API.
5. Create a message in the 'messages' array with the role 'user' and the content as the $prompt variable.
6. Set the 'temperature' to 0.7 for the language model.
7. Define arguments in the $args array for the WordPress HTTP API:
    - 'method' is set to 'POST'.
    - 'headers' are set to the previously defined headers.
    - 'body' is set to a JSON-encoded version of the $body array.
    - 'timeout' is set to 120.
8. Make a POST request to the OpenAI API using the defined API URL and arguments and store the response in the $response variable.
9. Handle the response:
   - If the response is a WordPress error, retrieve and send an error message.
   - If the response is successful, decode the JSON response and check for errors or missing data. If everything is valid, send a success message.
10. Always use 'wp_die()' in functions that echo AJAX content.
Don’t add anything extra.

Prompt 2.

This prompt will generate code of HTML, CSS, and JavaScript for a text generation tool.


Generate the HTML and CSS code for a text generation tool with the following features code should start from <div>:

- An input field with the id "topic" and a placeholder "Your Topic..."
- A button with the id "generate-button" labelled "Generate!"
- A result container with the id "result-container" initially set to "display: none;"
- Inside the result container, a result wrapper with the class "result-wrapper"
- Inside the result wrapper, a result content div with the class "result-content"
- Inside the result content, a textarea with the id "result" and "readonly"
- Inside the result wrapper, a copy button container with the class "copy-button-container"
- Inside the copy button container, a button with the id "copy-button" labelled "Copy"
- A loading spinner with the id "loading" and the class "loader," initially set to "display: none;"

Apply the following styles to the elements:

For the text generation tool:
- Set the width to 100% and a maximum width of 600px.
- Center align the tool with "margin: 0 auto."
- Use the "Arial, sans-serif" font family.

For the input field with id "topic":
- Set the width to 100%.
- Apply padding of 15px and a margin bottom of 20px.
- Use a font size of 16px.
- Add a border-radius of 5px and a 1px solid border with the color #ddd.

For the button with id "generate-button":
- Make it a block-level element and set the width to 100%.
- Apply padding of 15px and a margin bottom of 20px.
- Use a font size of 16px.
- Remove the border and add a border-radius of 5px.
- Set the text color to #fff and the background color to #3498db.
- Add a hover effect with a darker background color (#2980b9).

For the result container with id "result-container":
- Initially hide it with "display: none."
- Add a margin bottom of 20px.

For the result wrapper with class "result-wrapper":
- Use relative positioning and hide overflow.

For the result content with class "result-content":
- Display it as flex.

For the textarea with id "result":
- Make it flex to occupy the available space.
- Set the height to 400px.
- Apply padding of 15px, a font size of 16px, a border-radius of 5px, and a 1px solid border with the color #ddd.
- Use a background color of #f9f9f9.

For the copy button container:
- Add a top margin of 10px.
- Right-align the contents.

For the button with id "copy-button":
- Use padding of 8px by 12px.
- Set a font size of 14px.
- Remove the border and add a border-radius of 5px.
- Set the text color to #fff and the background color to #3498db.
- Add a hover effect with a darker background color (#2980b9).

For the loader with class "loader":
- Display it as a block.
- Center it with "margin: 50px auto."
- Create a rotating spinner with a light grey border and a blue top border, simulating a loading animation.

@keyframes spin:
- Define a keyframe animation "spin" to create a loading spinner.
- Rotate the spinner from 0 to 360 degrees for a full rotation.

Prompt 3

Generate JavaScript code that performs the following actions:

1. Add an event listener to the element with the id "generate-button" to respond to a click event.
2. Prevent the default behavior of the click event using `e.preventDefault()`.
3. Get the element with the id "generate-button" and store it in the variable `generateButton`.
4. Check if `generateButton` is disabled, and if it is, return to prevent multiple clicks while content is being generated.
5. Disable the `generateButton` by setting its `disabled` property to `true`.
6. Get the value of the input element with the id "topic" and store it in the variable `topic`.
7. Create a prompt by setting the `prompt` variable with the value "Generate 3 youtube titles for " + `topic`.
8. Get the elements with the ids "loading," "result," and "result-container" and store them in the variables `loading`, `result`, and `resultC`.
9. Display the loading element by setting its `style.display` property to 'block'.
10. Hide the result textarea and result container by setting their `style.display` properties to 'none'.
11. Create a `FormData` object and append the values 'openai_generate_text' and `prompt` with the respective keys to it.
12. Make a POST request to '/wp-admin/admin-ajax.php' with the `formData` as the request body.
13. Handle the response by parsing it as JSON and updating the UI accordingly:
    - Hide the loading element by setting its `style.display` property to 'none'.
    - If the response indicates success, set the `result.value` to the generated content, show the result textarea and container, and re-enable the `generateButton`.
    - If there is an error, set the `result.value` to an error message and show the result textarea and container, and re-enable the `generateButton`.
14. Add an event listener to the element with the id 'copy-button' to respond to a click event.
15. When the copy button is clicked, select the content of the result textarea and copy it to the clipboard using `document.execCommand('copy')`.
16. Display an alert to notify the user that the content has been copied to the clipboard.

This code is designed to create a simple web-based text generation tool and handle user interactions with it.

You can also use the all prompt at once.

Prompt 1

Generate a PHP function named openai_generate_text that uses the OpenAI API to make a chat-based language model call. The function takes no arguments.

Within the function:
1. Retrieve the topic from an AJAX POST request using the variable $prompt.
2. Set the API URL as 'https://api.openai.com/v1/chat/completions'.
3. Define the API key as 'sk-XXX' (Replace with your actual OpenAI API key).
4. Set the headers as an array with 'Content-Type' and 'Authorization' for the OpenAI API.
5. Create a message in the 'messages' array with the role 'user' and the content as the $prompt variable.
6. Set the 'temperature' to 0.7 for the language model.
7. Define arguments in the $args array for the WordPress HTTP API:
    - 'method' is set to 'POST'.
    - 'headers' are set to the previously defined headers.
    - 'body' is set to a JSON-encoded version of the $body array.
    - 'timeout' is set to 120.
8. Make a POST request to the OpenAI API using the defined API URL and arguments and store the response in the $response variable.
9. Handle the response:
   - If the response is a WordPress error, retrieve and send an error message.
   - If the response is successful, decode the JSON response and check for errors or missing data. If everything is valid, send a success message.
10. Always use 'wp_die()' in functions that echo AJAX content.
Don’t add anything extra.


Prompt 2
This prompt will generate code of HTML, CSS, and JavaScript for a text generation tool.


Generate the HTML and CSS code for a text generation tool with the following features code should start from <div>:

- An input field with the id "topic" and a placeholder "Your Topic..."
- A button with the id "generate-button" labelled "Generate!"
- A result container with the id "result-container" initially set to "display: none;"
- Inside the result container, a result wrapper with the class "result-wrapper"
- Inside the result wrapper, a result content div with the class "result-content"
- Inside the result content, a textarea with the id "result" and "readonly"
- Inside the result wrapper, a copy button container with the class "copy-button-container"
- Inside the copy button container, a button with the id "copy-button" labelled "Copy"
- A loading spinner with the id "loading" and the class "loader," initially set to "display: none;"

Apply the following styles to the elements:

For the text generation tool:
- Set the width to 100% and a maximum width of 600px.
- Center align the tool with "margin: 0 auto."
- Use the "Arial, sans-serif" font family.

For the input field with id "topic":
- Set the width to 100%.
- Apply padding of 15px and a margin bottom of 20px.
- Use a font size of 16px.
- Add a border-radius of 5px and a 1px solid border with the color #ddd.

For the button with id "generate-button":
- Make it a block-level element and set the width to 100%.
- Apply padding of 15px and a margin bottom of 20px.
- Use a font size of 16px.
- Remove the border and add a border-radius of 5px.
- Set the text color to #fff and the background color to #3498db.
- Add a hover effect with a darker background color (#2980b9).

For the result container with id "result-container":
- Initially hide it with "display: none."
- Add a margin bottom of 20px.

For the result wrapper with class "result-wrapper":
- Use relative positioning and hide overflow.

For the result content with class "result-content":
- Display it as flex.

For the textarea with id "result":
- Make it flex to occupy the available space.
- Set the height to 400px.
- Apply padding of 15px, a font size of 16px, a border-radius of 5px, and a 1px solid border with the color #ddd.
- Use a background color of #f9f9f9.

For the copy button container:
- Add a top margin of 10px.
- Right-align the contents.

For the button with id "copy-button":
- Use padding of 8px by 12px.
- Set a font size of 14px.
- Remove the border and add a border-radius of 5px.
- Set the text color to #fff and the background color to #3498db.
- Add a hover effect with a darker background color (#2980b9).

For the loader with class "loader":
- Display it as a block.
- Center it with "margin: 50px auto."
- Create a rotating spinner with a light grey border and a blue top border, simulating a loading animation.

@keyframes spin:
- Define a keyframe animation "spin" to create a loading spinner.
- Rotate the spinner from 0 to 360 degrees for a full rotation.



Prompt 3

Generate JavaScript code that performs the following actions:

1. Add an event listener to the element with the id "generate-button" to respond to a click event.
2. Prevent the default behavior of the click event using `e.preventDefault()`.
3. Get the element with the id "generate-button" and store it in the variable `generateButton`.
4. Check if `generateButton` is disabled, and if it is, return to prevent multiple clicks while content is being generated.
5. Disable the `generateButton` by setting its `disabled` property to `true`.
6. Get the value of the input element with the id "topic" and store it in the variable `topic`.
7. Create a prompt by setting the `prompt` variable with the value "Generate 3 youtube titles for " + `topic`.
8. Get the elements with the ids "loading," "result," and "result-container" and store them in the variables `loading`, `result`, and `resultC`.
9. Display the loading element by setting its `style.display` property to 'block'.
10. Hide the result textarea and result container by setting their `style.display` properties to 'none'.
11. Create a `FormData` object and append the values 'openai_generate_text' and `prompt` with the respective keys to it.
12. Make a POST request to '/wp-admin/admin-ajax.php' with the `formData` as the request body.
13. Handle the response by parsing it as JSON and updating the UI accordingly:
    - Hide the loading element by setting its `style.display` property to 'none'.
    - If the response indicates success, set the `result.value` to the generated content, show the result textarea and container, and re-enable the `generateButton`.
    - If there is an error, set the `result.value` to an error message and show the result textarea and container, and re-enable the `generateButton`.
14. Add an event listener to the element with the id 'copy-button' to respond to a click event.
15. When the copy button is clicked, select the content of the result textarea and copy it to the clipboard using `document.execCommand('copy')`.
16. Display an alert to notify the user that the content has been copied to the clipboard.

This code is designed to create a simple web-based text generation tool and handle user interactions with it.

All of them (Prompt 1, Prompt 2 and Prompt 3 ) must be interconnected.

After using these prompts the claude will generate some codes – HTML, CSS, JS and Pyhton code.

Also Check  ChatGPT Word Limit: Demystifying the Constraints

Now you need to add the code accordingly.

  • Html, css and java Script – At the html section of the post.
  • Python code at the code snipped section.

At the python code you need to add the API key and the APi key Will be available at https://platform.openai.com/account/api-keys.

After complete this process you need to test your tool. if the tool is working fine then you can use it and if don’t then you need to ask the solution to chatgpt and resolve it.

How to create different kind of ai tools.

If you want to create different tools then you need to change the prompt using at backend.

search for the prompt into the html code you added in post section and change the prompt accordingly.

Conclusion

In this detailed article I have shared the detailed guide to create an AI tool. and if you have any kind of problem then feel free to ask in comment section.

Also Check  NVIDIA Canvas App : Turn Simple Brushstrokes into Realistic Images with AI