How to use AI Prompt with ChatGPT API
This page provides information on how to send AI Prompts to ChatGPT from the command line using AI Prompt. Ozeki AI Prompt is fully compatible with the ChatGPT API, thus you can send basic and JSON prompts to ChatGPT and use interactive mode as well. In this short article, you will learn how to configure AI Prompt to send basic and JSON Prompts to DeepSeek API. Let's get started!
What is AI Prompt?
The AI Prompt is a command line tool which makes it possible to run AI prompts on the command line, that are evaluated by HTTP AI APIs, such as Ozeki AI Server or OpenAI (ChatGPT).
What is OpenAI API?
The OpenAI API provides access to advanced AI models, such as ChatGPT, enabling developers to integrate these models into applications. It allows users to perform tasks like text generation, summarization, translation, code generation, and more.
How to use AI Prompt with DeepSeek API (Few steps)
- Requirements
- Configuration
- Send basic prompt
- Send JSON prompt
Requirements
Before continuing with this guide, make sure Ozeki AI Prompt is installed on your computer and you have an OpenAI API key.
If you haven't downloaded AI Prompt yet, check out AI prompt to learn how to setup AI Prompt on your computer.
If you don't have an OpenAI API key, proceed to https://platform.openai.com/api-keys to generate a new API key, and set up your payment at https://platform.openai.com/settings/organization/billing/overview.
Check out the How to use ChatGPT in Ozeki AI Chat guide for step-by-step instructions on setting up your API access.
Configuration
With AI Prompt being an universal tool, there isn't a big difference in configuring AI Prompt to work with OpenAI API compared to Ozeki HTTP API. Follow the next configuration steps to make sure you will use AI Prompt properly with OpenAI API.
API key
Specify your OpenAI API key, using the -a option.
Model
Select the OpenAI Model you want to use. Check out the OpenAI Models documentation, to learn about the different models capabilities and pricing. In this example, the gpt-4o-mini model will be used as it is the fast and cost-effective version of OpenAI's flagship model, gpt-4o
To specify the model, use the -m option
URL
The ChatGPT API can be accessed through the following URL:
https://api.openai.com/v1/chat/completions
Use the -h option to set this URL.
How to send basic prompt to ChatGPT API with AI Prompt (Video tutorial)
In this video you will see how to send a basic prompt to DeepSeek API. This video will demonstrate which options must be specified to make AI Prompt work properly with DeepSeek AI.
How to send basic prompt to ChatGPT API with AI Prompt
You can send a basic prompt the same way to OpenAI API the same way as you would to Ozeki HTTP API. Make sure you set the model, the server URL and the API key as mentioned earlier:
::Change the example API key to your OpenAI API key aiprompt.exe "Where is Budapest?" -m gpt-4o-mini -h https://api.openai.com/v1/chat/completions -a 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
Output:
Role: assistant Content: Budapest is the capital city of Hungary, located in Central Europe. It sits on both sides of the Danube River, with Buda on the west bank and Pest on the east. Budapest is known for its stunning architecture, historic sites, and vibrant culture, making it a popular destination for tourists.
How to send JSON prompt to ChatGPT API with AI Prompt (Video tutorial)
This video demonstrate how to create and read a JSON file containing a JSON prompt suitable to be used with OpenAI API, and how to send it to the OpenAI API using AI Prompt.
How to send JSON prompt to ChatGPT API with AI Prompt
It is recommended to use JSON files for sending JSON prompts instead of defining then in the command line.
Open the File Explorer at the location of your AI Prompt installation.
Create a JSON File using Notepad. To open a Notepad, type notepad into the File Explorer's address bar and press Enter.
Paste the JSON prompt into the newly opened Notepad:
Example JSON:
{ "model":"gpt-4o-mini", "messages":[ { "role":"user", "content":"Where is Budapest?" }, { "role":"assistant", "content":"Budapest is the capital city of Hungary, located in Central Europe. It sits on both sides of the Danube River, with Buda on the west bank and Pest on the east. Budapest is known for its stunning architecture, historic sites, and vibrant culture, making it a popular destination for tourists." }, { "role":"user", "content":"Tell me the three most visited tourist attraction in Budapest" } ] }
This example is specialized for ChatGPT usage, as the model is set to gpt-4o-mini
Save the json file by selecting the File menu, and clicking on the Save as.. option.
After clicking Save as..., the Save as dialog is opened. Set the save location to the path to your AI Prompt installation. Enter the filename "prompt.json" in the input area labeled File name and select All Files in the dropdown menu labeled Save as type.
Click the Save button to save the JSON file.
At this point you have successfully created the JSON file, which you can confirm by looking at the File Explorer. To run AI Prompt, open Command Prompt by typing cmd into the address bar of the File Explorer, and press Enter.
Use the type command to print the contents of the JSON file to the standard input. Run AI Prompt with the -j option to enable JSON mode. Make sure you are using the OpenAI API's server URL and your API key is set correctly.
::Change the example API key to your OpenAI API key type prompt.json | aiprompt.exe -m gpt-4o-mini -h https://api.openai.com/v1/chat/completions -a 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
Output:
{ "id": "chatcmpl-AuHI1fcMkFFuScNc45WhdNHDZd9ZU", "object": "chat.completion", "created": 1738079678, "model": "gpt-4o-mini-2024-07-18", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Three of the most visited tourist attractions in Budapest are:\n\n1. **Buda Castle**: This historic palace complex offers stunning views of the city and the Danube River. It houses the Hungarian National Gallery, the Budapest History Museum, and the National Széchenyi Library. The castle's impressive architecture and rich history make it a must-see attraction.\n\n2. **Fisherman's Bastion**: Located in the Buda district, this neo-Romanesque terrace offers panoramic views of the city and the Danube. It is near the Matthias Church and features numerous turrets and lookout points, making it a popular spot for photos.\n\n3. **Parliament Building**: One of the largest and most iconic buildings in Hungary, the Parliament Building sits along the Danube River. Its stunning architecture reflects the Gothic Revival style, and visitors can take guided tours to learn about its history and see the impressive interiors, including the Crown Jewels of Hungary. \n\nThese attractions highlight Budapest's rich history and architectural beauty, drawing millions of visitors each year." "refusal": null }, "logprobs": null, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 90, "completion_tokens": 212, "total_tokens": 302, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0 } }, "service_tier": "default", "system_fingerprint": "fp_72ed7ab54c" }
Final thoughts
In conclusion, this article has provided you with the essential steps to use the OpenAI API with Ozeki AI Prompt. If you feel like using the OpenAI API instead of the Ozeki HTTP API is too much hassle, or if you want to use other models simultaneously in a simple way, you can also integrate ChatGPT into Ozeki AI Server, unifying the two API endpoints into a single one. Check out the How to use ChatGPT in Ozeki AI Chat guide on this topic.
More information