Skip to content
pubscout

chat_gpt_sdk

3.1.6, released 6 months ago by redevrx.com

A Dart and Flutter SDK for OpenAI APIs including GPT-4, GPT-5, o1, and assistants.

$ flutter pub add chat_gpt_sdk
Source repository

What it does

Connects your Flutter app to OpenAI's advanced AI models, supporting chat completions, streaming SSE, image generation, audio transcription, embeddings, and fine-tuning.

AI-written summary of version 3.1.6, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to integrate ChatGPT, DALL-E, or other OpenAI models into a Flutter app.
  • You need support for server-sent event (SSE) streaming responses from AI models.

Skip it when

  • You want an on-device machine learning solution instead of a cloud-based API.
  • You are building an app with Firebase-based AI features and prefer using the official Firebase AI SDK.

Strengths

  • Comprehensive coverage of OpenAI APIs including chat completions, assistants, files, audio, and fine-tuning.
  • Supports modern features such as reasoning models (o1, o3-mini), developer roles, and prompt caching.

Weaknesses

  • Community-maintained and unofficial SDK.
  • Requires managing API keys and handling network communication costs.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4

Requires an OpenAI API token passed during initialization.

final openAI = OpenAI.instance.build(token: 'YOUR_TOKEN', baseOption: HttpSetup(receiveTimeout: const Duration(seconds: 5)), enableLog: true);
final request = ChatCompleteText(messages: [Map.of({"role": "user", "content": 'Hello!'})], maxToken: 200, model: Gpt4oMiniChatModel());
final response = await openAI.onChatCompletion(request: request);

Alternatives

Packages that do the same job and could replace chat_gpt_sdk.

  • firebase_ai

    If you prefer using Firebase as the gateway for your generative AI models.

  • llamadart

    If you want to run local language models instead of relying on a cloud OpenAI API.

Works with

Packages commonly used together with chat_gpt_sdk: ones it builds on, ones built on it, and its own family.