Integrate OpenAI APIs ( GPT, Dall-E.. ) quickly and easily inside your Flutter application
Flutter OpenAI
This is an open-source Flutter package that leverages the use of dart_openai for connecting and integrating OpenAI Art-Of-State models such as GPT and Dall-E directly inside your Dart/Flutter application.
This package comes with prebuilt widgets, and Flutter components that can be used directly inside your app to make the process even easier and faster to fit for your needs.
Note:
Before diving into the usage of this package, please, give a quick look over dart_openai and see what it offers and how it works.
Usage
Authentication
API key
The OpenAI API uses API keys for authentication. you can get your account APU key by visiting API keys in your account.
We highly recommend loading your secret key at runtime from a .env
file, you can use the dotenv package for Dart applications or flutter_dotenv for Flutter’s.
void main() {
DotEnv env = DotEnv()..load([".env"]); // Loads our .env file.
OpenAI.apiKey = env['OPEN_AI_API_KEY']; // Initialize the package with that API key
runApp(const MyApp());
}
Setting an organization
if you belong to a specific organization, you can pass its id to OpenAI.organization
like this:
OpenAI.organization = "ORGANIZATION ID";
If you don’t belong actually to any organization, you can just ignore it, or set it to null
.
Widgets Progress
- OpenAI Models Builder Widget.
- OpenAI Model Builder Widget.
- OpenAI Completion Builder Widget.
- OpenAI Streamed Completion Builder Widget.
- OpenAI Edit Builder Widget.
- OpenAI Image Generator Widget.
- OpenAI Image Edit Widget.
- OpenAI Image Variation Widget.
- OpenAI Embeddings Builder Widget.
- OpenAI File Uploader Widget.
- OpenAI Files Builder Widget.
- OpenAI Fine-Tune Creator Widget.
- OpenAI Fine-tunes Builder Widget.
- OpenAI Fine-Tune Streamed Events Builder Widget.
- OpenAI Moderation Builder Widget.