A minimal iOS app that allows you to converse with OpenAI Chat GPT-3.5/4.
A minimal iOS app that interacts with OpenAI Chat GPT-3.5/4.
This is a minimal iOS app that communicates with OpenAI Chat GPT 3.5/4 via OpenAI API. The purpose of this project is showing a very basic sample code which communicates with OpenAI GPT 3.5/4. The project handles the OpenAI API directly.
In order to use the OpenAI API, you need to sign up to the OpenAI website and get the API key. First you are given free credits. When it is used up, it is necessary to subscribe to a paid service. In addition to that, GPT-4 is under the limited service, so you need to entry to the waiting list first. After invited to GPT-4, you will be able to use the GPT-4 models. The API Key can be used for both GPT-3.5 and GPT-4. Until then, please use GPT-3.5 models.
By tapping the duplicate icon in the chat view, the current conversation will be duplicated. By modifying the messages (editing text, deleting messages or moving message's positions), users can get another responses from OpenAI GPT. And the conversations are stored to review later.
User can send multiple conversations to OpenAI GPT simultaneously.
The API Key for OpenAI API is required. You need to sign up to OpenAI site (https://openai.com/api/) and get the key. You can get the key at the account management page. (https://platform.openai.com/account/)
To use the OpenAI API, you need credits. You will get some free credits when you sign up. After using it, you need to purchase a paid subscription. It is reasonable because the computational cost of LLM is very high.
If your API Key is invalid or your credits are short, the API calls will fail.
The app consists of simple SwiftUI Views, a View Model, Models, a Manager, and OpenAI modules.
Change the color of chat foreground and background as you like. Set colors for light mode and dark mode of the ColorSet in the Assets.catalog.
Defined ColorSet in Assets.catalog:
UserChatFG
/ AIChatFG
... foreground color of each chat (user / AI)UserChatBG
/ AIChatBG
... background color of each chat (user / AI)XXXXX 1
... default color (You can use it to easily restore defaults.)OpenAI says,
"By default, OpenAI will not use data submitted by customers via our API to train OpenAI models or improve OpenAI’s service offering."
"OpenAI retains API data for 30 days for abuse and misuse monitoring purposes."
It seems using the paid OpenAI API is safer than using their free Chat-GPT webpage.