OpenAi Simplified

OpenAI Simplified is an application that aims to provide easy and intuitive access to OpenAI services. With it, developers can integrate some of OpenAI's artificial intelligence technologies into their own applications in a simple and efficient manner.

Status: Developing 👷🏿 ⚠️ Some of the tools provided by OpenAI are still under development and will be implemented over time


To instal OpenAi Simplified, you can use either of the following methods:

Method 1: flutter pub add

flutter pub add open_ai_simplified

Method 2: pubspec.yaml

Alternatively, you can add the following line to your pubspec.yaml file:

    open_ai_simplified: ^VERSION

Replace VERSION with the latest version of OpenAI Simplified Import the library into your code by adding the following line at the top of your file:

import 'package:open_ai_simplified/open_ai_simplified.dart';


Below are some of the features available.

Feature Availability

Getting started

OpenAI Simplified aims to make it easier to use its capabilities, so almost no configuration is required to use it. Just initialize its repository and provide it with your OpenAI API secret key, and all the features already use the suggested configuration in the API as the default. It is also possible to change the settings if necessary. To configure the parameters of the desired functionality, methods are available, one where it is possible to use one of the objects from the package itself and another passing a Map with the data structure provided by the OpenAI API.


void main() async {
  // Load env
  await dotenv.load(fileName: ".env");
  // Create a new repository.
  OpenIARepository openAi = OpenIARepository();
  // Add the api key.
  // Retrive the models avaibles.
  final models = await openAi.getRawModelsList();
  // Print the models
  // Configure the completion params, this can also be done using the method configCompletionFromMap
  openAi.configCompletionFromConfig(ConfigCompletion(temperature: 0.6));
  // Create a completion
  final completion = await openAi.getCompletion('what times it?');
  // Print the completion
  // Configure the edits params, this can also be done using the method configEditsFromMap
  openAi.configEditsFromConfig(config: ConfigEdits(temperature: 0.8));
  // Print the edits
  final edit = await openAi.getEdits(
      input: 'helo piple', instruction: 'fix the spelling mistakes');
  // Print the edits
   // Configure the images params, this can also be done using the method configImagesFromMap
  // The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024
  openAi.configImagesFromConfig(ConfigImages(n: 1, size: '256x256'));
  // Create the images
  final images = await openAi.getImages('horse with golden hair and dragons');
  // Print the url with the images {
   // Create a variation of an image, the image should be a png file with less then 4MB and a square
  final imageVariation = await openAi.createAImageVariation(
    imageFile: await downloadFile([0].url),
  // Edits an image, you also can pass another image as mask
  final editImage = await openAi.editImage(
      image: await downloadFile([0].url),
      prompt: 'give a new hair style to the horse');
  // Print the url with the image

  /// create an embedding
  final embedding = await openAi.createEmbedding(prompt: 'sabado a noite');

  /// print the embeddings

  /// The file need to be an JsonL, another types of file will not work
  /// Retrives the list of stored files as ListFileResponse object. you can have
  /// the data as Map if use the method getRawFilesList
  final list = await openAi.getFilesList();

  /// print the list

  /// Upload a file that contains document(s) to be used across various endpoints/features.
  ///  Currently, the size of all the files uploaded by one organization can be up to 1 GB.
  final uploadedFile = await openAi.uploadFile(
      file: File('director/xxx.jsonl'), purpose: 'fine-tune');

  /// print the uploadedFile

  /// Deletes a file and return informations about de file deleted
  final deletedFile = await openAi.deleteFile(fileId: 'fileId');

  /// print the information about the file deleted

  /// Get the info about a file as a FileData object
  /// you also can get the info as Map with the method retriveRawFileInfo
  final fileInfo = await openAi.retriveFileInfo(fileId: 'fileId');

  /// print the file info

  /// Get the content of a specific file.
  final fileContent = await openAi.retriveFileContent(fileId: 'fileId');

  /// print the content

  /// Classifies if text violates OpenAI's Content Policy, returns ModerationResponse object
  final moderationInfo =
      await openAi.moderationCheck(input: 'I want to kill them.');

  /// print moderation info

  /// Creates a job that fine-tunes a specified model from a given dataset. return a FineTunesResponse object
  /// The ID of an uploaded file that contains training data. you also can get the Map with the method createRawFineTunes
  final fineTunesCreated =
      await openAi.createFineTunes(trainingFile: 'ID of an uploaded file');

  /// print fineTune created info

  /// List your organization's fine-tuning jobs, return a ListFineTunesResponse object
  ///  you also can get the Map with the method getRawListFineTunes
  final listFineTunes = await openAi.getListFineTunes();

  /// print fineTune list info

  /// Gets info about the fine-tune job. return a FineTunesResponse object
  ///  you also can get the Map with the method retriveRawFineTune
  final retrivedFileTune =
      await openAi.retriveFineTune(fineTuneId: 'ID of an uploaded file');

  /// print fineTune  info

  /// Immediately cancel a fine-tune job. return a FineTunesResponse object
  ///  you also can get the Map with the method cancelRawFineTune
  final canceledFineTune =
      await openAi.cancelFineTune(fineTuneId: 'fineTuneId');

  /// print fineTune canceled info

  /// Delete a fine-tuned model. You must have the Owner role in your organization. Return a Map
  final deletedFineTune = await openAi.deleteFineTunelModel(model: 'model');

  /// print fineTune deleted info

Future<File> downloadFile(String url) async {
  Dio simple = Dio();
  String savePath = '${Directory.systemTemp.path}/${url.split('/').last}';
  await, savePath,
      options: Options(responseType: ResponseType.bytes));
  File file = File(savePath);
  return file;


We welcome contributions to the OpenAi Simplified project! If you would like to contribute, please feel free to reach out to the current maintainers for more information.


If you encounter any issues while using Focus on It, please open a new issue in the issue tracker. Please include as much information as possible, such as the version of Focus on It you are using and steps to reproduce the issue.


OpenAi Simplified is licensed under the MIT license. See LICENSE.