Repolode
anasfik

anasfik/openai

Unofficial Dart and Flutter SDK for the OpenAI API, with typed clients for Responses, Chat, Realtime, Batch and more.

Stars
665
Forks
231
Open issues
0
Last commit
13 days ago

What is it?

dart_openai is an unofficial Dart and Flutter SDK that wraps the OpenAI API with typed clients for most of its surfaces, including Responses, Chat Completions, Realtime, Videos, Batch, Fine-tuning, Vector Stores and administration endpoints. It targets Android, iOS, macOS, Linux, Windows, web and server-side Dart from one codebase.

Each OpenAIClient holds its own configuration, so several accounts, Azure resources or OpenAI-compatible providers such as DeepSeek, LM Studio and Ollama can run side by side. Streaming endpoints are exposed as Dart streams, and requests retry automatically on connection errors and selected HTTP status codes with exponential backoff.

Errors are thrown as typed exceptions, and error payloads from different providers are normalized so the original body is preserved. Upload APIs use a platform-neutral file type, so the same code can run in the browser.

Key features

  • 01Typed clients for Responses, Chat Completions, Realtime, Batch, Fine-tuning and Vector Stores.
  • 02Streaming responses exposed as Dart streams over server-sent events.
  • 03Per-client configuration for multiple accounts, Azure, and compatible providers.
  • 04Automatic retries with exponential backoff and Retry-After support.
  • 05Platform-neutral file uploads that work on web and native targets.

Use cases

  • Adding LLM chat or streaming responses to a Flutter mobile or desktop app.
  • Calling OpenAI-compatible local or hosted models from Dart server code.
  • Building a Dart backend that manages OpenAI batch jobs, files or vector stores.

Quick start

  1. 1

    Add the dart_openai dependency to pubspec.yaml (version ^8.0.0)

  2. 2

    Fetch the dependencies

    dart pub get
  3. 3

    Set your OPENAI_API_KEY environment variable and run a chat completion from your Dart code

Things to know

  • Unofficial SDK, not maintained by OpenAI.
  • Requires an OpenAI API key or a compatible provider to make real calls.

In collections

Topics

FAQ

What is openai?
Unofficial Dart and Flutter SDK for the OpenAI API, with typed clients for Responses, Chat, Realtime, Batch and more. dart_openai is an unofficial Dart and Flutter SDK that wraps the OpenAI API with typed clients for most of its surfaces, including Responses, Chat Completions, Realtime, Videos, Batch, Fine-tuning, Vector Stores and administration endpoints. It targets Android, iOS, macOS, Linux, Windows, web and server-side Dart from one codebase.
Is openai free to use? What license does it have?
openai is open source under the MIT license. Check the license terms before using it in commercial products.
Is openai still maintained?
Actively maintained. The last commit to openai was on Oct 25, 2026.
What can I use openai for?
Adding LLM chat or streaming responses to a Flutter mobile or desktop app. Calling OpenAI-compatible local or hosted models from Dart server code. Building a Dart backend that manages OpenAI batch jobs, files or vector stores.
How do I install openai?
Add the dart_openai dependency to pubspec.yaml (version ^8.0.0) Fetch the dependencies: dart pub get Set your OPENAI_API_KEY environment variable and run a chat completion from your Dart code
Where can I get openai?
The source code and installation instructions are on GitHub: https://github.com/anasfik/openai

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects