Search packages, repositories and app categories

chat_gpt_flutter cover
Package detailsv1.0.16

chat_gpt_flutter

Integration of OpenAI API using Flutter framework, ChatGPT and more

AndroidiOSWebmacOSWindowsLinux
30-day downloads
362
Likes
48
Pub points
150

Install package

flutter pub add chat_gpt_flutter

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that enables integration of OpenAI's API, including ChatGPT, within Flutter applications. It provides a straightforward interface to send messages and receive responses from generative AI models across multiple platforms. Designed for developers aiming to add conversational AI features to apps with minimal setup. The package supports Android, iOS, Web, macOS, Windows, and Linux, making it highly versatile for cross-platform development. It simplifies authentication and request handling, allowing quick implementation of AI-powered chat interfaces.

Use cases

  • Building AI chatbots in mobile and web apps
  • Integrating generative AI into productivity tools
  • Creating interactive customer support features
  • Developing educational apps with AI assistance
  • Enabling real-time language translation via AI

Key features

  • Cross-platform compatibility
  • Simple API for OpenAI integration
  • Support for ChatGPT and other LLMs
  • Built-in authentication handling
  • Real-time message streaming
  • Easy setup with Flutter pub

Suitable for

  • Flutter developers adding AI features
  • Startups building AI-powered apps
  • Educational and enterprise app creators
  • Apps requiring natural language interaction

Considerations

  • Requires valid OpenAI API key
  • May incur usage costs based on API calls
  • Depends on stable internet connection
  • Limited to OpenAI's model offerings
  • Not suitable for offline AI functionality

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

ChatGPT API implemented in Flutter

Buy Me A Coffee

Usage example

Getting started

You have to create OpenAI account and request API key from here: https://beta.openai.com/account/api-keys

Stream usage


final chatGpt = ChatGpt(apiKey: apiKey);

final question =
    'Which Disney character famously leaves a glass slipper behind at a royal ball?';

final request = CompletionRequest(
  prompt: question,
  stream: true,
  maxTokens: 4000,
  model: ChatGptModel.textDavinci003.key,
);

final stream = await chatGpt.createCompletionStream(request);

Usage without stream


final chatGpt = ChatGpt(apiKey: apiKey);

final testPrompt =
    'Which Disney character famously leaves a glass slipper behind at a royal ball?';

final testRequest = CompletionRequest(
  prompt: testPrompt,
  model: ChatGptModel.textDavinci003.key,
);

final result = await chatGpt.createCompletion(testRequest);

Categories

Dependencies

Dependency list 5 items

Source repository

Projects using this package