Community-maintained Swift package wrapping the OpenAI public API, covering chat, responses, images, audio, embeddings and assistants.
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
Add the dart_openai dependency to pubspec.yaml (version ^8.0.0)
- 2
Fetch the dependencies
dart pub get - 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
A community-maintained PHP client for the OpenAI REST API, with streaming support and no third-party runtime dependencies.
Official Java and Kotlin SDK for the OpenAI REST API, with sync and async clients, streaming, and typed request and response classes.
A ChatGPT-based AI fortune-telling app offering tarot, BaZi, name analysis, dream interpretation and Meihua divination with streaming output.
An unofficial, zero-dependency Go client for the OpenAI API, covering Responses, Chat Completions, images, audio and more.
An SDK for building AI agents and multi-agent systems in Python, .NET and Java, with model, plugin and vector database integrations.