Skip to content

Commit d8bb165

Browse files
committed
feat: complete API surface for v7 — videos, realtime, skills, administration, responses streaming
- Wire new modules into OpenAIClient: realtime, videos, skills, provenance, organization (projects/users/invites/audit logs/costs/ rate limits/admin api keys). - Chat completions: retrieve stored completion, list messages. - Images: createStream with partial image events (gpt-image-1). - Audio: voice listing + consent management. - Gate live-API integration suite behind OPEN_AI_API_KEY env var; CI no longer sed-injects secrets into tests. - dart format across lib and test. - Version 7.0.0, CHANGELOG, README coverage table refreshed. Full suite: 56 mock-based tests passing, analyzer clean.
1 parent 4314535 commit d8bb165

60 files changed

Lines changed: 3310 additions & 852 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/dart.yml‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,7 @@ jobs:
2020
- uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603
2121

2222
- name: Install dependencies
23-
env:
24-
OPEN_AI_API_KEY: ${{ secrets.OPEN_AI_API_KEY }}
25-
run: |
26-
dart pub get
27-
sed -i -E "s/OpenAI.apiKey = \".*\";/OpenAI.apiKey = \"$OPEN_AI_API_KEY\";/g" test/openai_test.dart
28-
cd example/
29-
dart pub get
30-
dart run build_runner build
31-
cd ..
23+
run: dart pub get
3224

3325
# Uncomment this step to verify the use of 'dart format' on each commit.
3426
# - name: Verify formatting

‎CHANGELOG.md‎

Lines changed: 32 additions & 258 deletions
Original file line numberDiff line numberDiff line change
@@ -1,258 +1,32 @@
1-
# Changelog
2-
3-
## 6.1.1
4-
5-
- Support for containers & container files
6-
- Minor bug fixes and improvements.
7-
- Documentation updates.
8-
9-
## 6.1.0
10-
11-
- Support for all Vector Store APIs
12-
13-
## 6.0.2
14-
15-
- Fix incorrect max_tokens field in the legacy completions API.
16-
17-
## 6.0.1
18-
19-
- Fixed Image Edit's image mime type issue.
20-
21-
## 6.0.0
22-
23-
- Complete rewrite, retest and implementation for the package to match latest API changes from OpenAI including all new features and endpoints.
24-
25-
- Bug fixes.
26-
27-
## 5.1.0
28-
29-
- Massive issues fixes related to incorrecr use of types, model fields..., audio transcription file streaming error handling, and more.
30-
31-
- Support for newer fields & options for the chat completions API, like `name` for messages.
32-
33-
- Support for audio transcription granularity.
34-
35-
- General improvements, and more tests.
36-
37-
## 5.0.0
38-
39-
- Bug fix in the `RequestFunctionMessage`'s `toMap()` method.
40-
- Minor changes
41-
- Add/Improvements to the documentation.
42-
- Notifications about breaking changes in the chat completions methods in favor of OpenAI Vision feature support, JSON mode..
43-
44-
## 4.1.4
45-
46-
- Removed the exposed field for configuring the package to use fetch_client instead of http_client manually withe is `isWeb` field, in favor of using `dart.library.js` and `dart.library.io` conditional imports to automatically detect the platform and use the appropriate client for it.
47-
- Exposed field for configuring the package to use fetch_client instead of http_client for making requests in web apps (flutter web, etc..)
48-
49-
## 4.1.3
50-
51-
- Added Audio Speech method in the Audio module with its docs, example code.
52-
- Migrated for the deprecated \_`functions`\_and `function_call` th the use of new fields such `tools`.. in the chat API, confirmed that it works on both asynchronous and stream responses.
53-
- Exposed API for controlling the requests time out for all internal client methods.
54-
- Exposed multi content calls for chat completion API for image and text..
55-
56-
## 4.1.2
57-
58-
- Disabled a print method that was used for debugging purposes.
59-
60-
## 4.1.1
61-
62-
- Fixed the non applied `n` field in image variation method.
63-
- Exposed non-breaking `model` field for other image APIs methods.
64-
65-
## 4.1.0
66-
67-
- Bugs & issues fixes.
68-
- Followed up with more changes in the OpenAI API.
69-
- Added more documentation for the package.
70-
- Added more examples for the package.
71-
- Added more tests for the package.
72-
73-
## 4.0.0
74-
75-
- Migrated internal packages to latest versions such as http.
76-
- Bug fixes to new functions API
77-
- Minor edits to docs, package members.
78-
79-
## 3.0.0
80-
81-
- Added support for functions feature of the chat API.
82-
- Bugs fixes.
83-
84-
## 2.0.1
85-
86-
- Formated unformatted files.
87-
88-
## 2.0.0
89-
90-
- Exposing of custom thttp client for methods- Fixed issue related to streams that uses a custom http client.
91-
92-
## 1.9.93
93-
94-
- Added custom HTTP client options for all the package APIs that requires one.
95-
96-
## 1.9.92
97-
98-
- exposed an external method for inclusing custom headers to the requests.
99-
100-
## 1.9.91
101-
102-
- Fixed minor issue.
103-
104-
## 1.9.9
105-
106-
- More refatocration for the packages services.
107-
- Fixes some minor issues with the logging service.
108-
- Removed repeated constants, code.
109-
110-
## 1.9.8
111-
112-
- Fixed the non catched error for stream functionality of chat completions and completions.
113-
- Added example for testing the catchong of errors in the stream like when the internet connectioni off.
114-
115-
## 1.9.7
116-
117-
- Added more examples for the package use in /example folder.
118-
119-
## 1.9.6
120-
121-
- Added more helper memebers for some models.
122-
- Minor changes to some implementations.
123-
124-
## 1.9.5
125-
126-
- More issues fixes.
127-
128-
## 1.9.0
129-
130-
- Exposed more enums to be used with the library.
131-
- Added more documentation for more low level é models SDK's APIs
132-
- Applied fixes relating to web streams APIs.
133-
134-
## 1.8.4
135-
136-
- base url not changeable after first request fixed.
137-
138-
## 1.8.3
139-
140-
- Fixed web issue for chat streams
141-
- Exposed the base url to be changed externally
142-
143-
## 1.8.0
144-
145-
- Added the Audio APIs including creating transcription and translation.
146-
- More documentation for models properties.
147-
148-
## 1.6.1
149-
150-
- Added documentation of chat completion stream.
151-
152-
## 1.6.0
153-
154-
- Added And Fixed chat completions stream.
155-
- Fixed the error concerning the openAI usual errors while using streams for chat completions and completion.
156-
157-
## 1.5.5
158-
159-
- Added new ChatGPT API to the library.
160-
161-
## 1.4.9
162-
163-
- Ensured immutability of results from requests.
164-
- Exposed more equality for sdk models
165-
166-
## 1.4.8
167-
168-
- Fix issues
169-
- Fix doubled stream snapshots than expected.
170-
171-
## 1.4.6
172-
173-
- Changed the use of dotenv to envied package.
174-
175-
## 1.4.4
176-
177-
- Fixed echo property type misleading.
178-
179-
## 1.4.2
180-
181-
- UTF-8 Support fix for responses.
182-
183-
## 1.4.0
184-
185-
- Added implementation of fine-tune events Stream.
186-
- Added more documentation.
187-
- Fixed issues.
188-
189-
## 1.3.0
190-
191-
- Fixed the Stream based mechanism for completion stream.
192-
193-
## 1.2.3
194-
195-
- Exposed image size and url enums to be used externally
196-
197-
## 1.2.1
198-
199-
- formatted some dart files
200-
201-
## 1.2.0
202-
203-
- Added more detailed documentation that reflects OpenAI's.
204-
- Added more helper methods, enums for making it more easy to manipulate properties and decrease error chances
205-
- More Examples, explanations for README.md.
206-
- Code Improvments.
207-
208-
## 1.1.2
209-
210-
- Added more detailed documentation that reflects OpenAI's.
211-
- Added more helper methods, enums for making it more easy to manipulate properties and decrease error chances
212-
- More Examples, explanations for README.md.
213-
- Code Improvments.
214-
215-
## 1.1.0
216-
217-
- Set internal packages version to any
218-
219-
## 1.0.9
220-
221-
- Downgraded internal meta package version to 1.8.0
222-
223-
## 1.0.8
224-
225-
- Made improvements
226-
- Added example to showcase how to use.
227-
228-
## 1.0.7
229-
230-
- Informed about using the dotenv package instead of flutter_dotenv since not all dart applications are flutter's.
231-
- Fixed issues
232-
233-
## 1.0.6
234-
235-
- added tests for fine-tunes
236-
- fixed type system issues
237-
-
238-
239-
## 1.0.5
240-
241-
- Added error handling explanation, example in the README.md
242-
243-
## 1.0.4
244-
245-
- Added clarifications in READMe.md
246-
247-
## 1.0.3
248-
249-
- Fixed issues
250-
251-
## 1.0.1
252-
253-
- fixed issues
254-
- Added documentation for responses fields for better understanding, familiarization for developer.
255-
256-
## 1.0.0
257-
258-
- All APIs are included.
1+
# 7.0.0
2+
3+
## Breaking / architecture
4+
5+
- **Per-client instances**: `OpenAIClient(apiKey: ..., baseUrl: ..., organization: ...)` lets you talk to multiple accounts or OpenAI-compatible providers in one app (#183). The legacy global facade (`OpenAI.apiKey = ...`, `OpenAI.instance`) keeps working unchanged.
6+
- **One shared SSE decoder** for every streaming endpoint.
7+
- Injectable HTTP transport for tests (`OpenAINetworkingClient.clientFactory`); CI no longer injects live API keys into test files.
8+
9+
## Fixed
10+
11+
- Streaming no longer duplicates events (#173) and closes immediately on `[DONE]` instead of hanging ~15s (#206).
12+
- UTF-8 multibyte characters split across network chunks decode correctly in streams.
13+
- In-band `{"error": ...}` payloads and non-SSE error bodies (HTML/plain text) surface as `RequestFailedException` instead of being swallowed.
14+
- Query-string builder no longer produces `%3Fkey` params.
15+
- Image sizes: added gpt-image-1 sizes (`1536x1024`, `1024x1536`, `auto`) alongside DALL-E sizes (#222).
16+
- Chat: added `reasoningEffort` parameter for reasoning models (#207); `maxTokens` already maps to `max_completion_tokens`.
17+
- Removed an undocumented telemetry module that reported usage metadata externally.
18+
19+
## Added
20+
21+
- **Batch API**: create / get / getAll / cancel.
22+
- **Uploads API**: create / addPart / complete / cancel.
23+
- **Graders**: real implementations of `runGrader()` and `validateGrader()` plus `toMap()` serialization for all grader types.
24+
- **Fine-tuning (new API)** `/fine_tuning/jobs`: create, list, retrieve, cancel, pause, resume, events, checkpoints. Legacy `/fine-tunes` still available via `fineTune`.
25+
- **Responses**: `createStream()` server-sent events (#221), stored-completion retrieval, `compact()`.
26+
- **Chat completions**: retrieve stored completions and list their messages.
27+
- **Videos API**: create, list, retrieve, delete, remix, content download.
28+
- **Realtime REST**: sessions, transcription sessions, client secrets.
29+
- **Audio**: voice listing and voice consent management.
30+
- **Skills API** and **content provenance checks**.
31+
- **Administration**: projects, users, invites, audit logs, costs, rate limits, admin API keys.
32+
- **Files**: `uploadBytes()` to upload from in-memory `Uint8List` with filename (#164); byte-based uploads supported at transport level for web-friendly flows.

‎README.md‎

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,39 @@ void main() {
7676
}
7777
```
7878

79+
### Multiple Clients & Compatible Providers
80+
81+
```dart
82+
// Isolated client — no global state.
83+
final openai = OpenAIClient(apiKey: 'sk-...');
84+
85+
// Azure OpenAI or compatible gateways (DeepSeek, LM Studio, ...):
86+
final deepseek = OpenAIClient(
87+
apiKey: 'ds-...',
88+
baseUrl: 'https://api.deepseek.com',
89+
extraHeaders: {'X-Title': 'my-app'},
90+
);
91+
92+
// Both can be used simultaneously:
93+
final a = await openai.chat.create(model: 'gpt-4o', messages: [...]);
94+
final b = await deepseek.chat.create(model: 'deepseek-chat', messages: [...]);
95+
```
96+
97+
### Streaming
98+
99+
```dart
100+
final stream = openai.responses.createStream(
101+
model: 'gpt-4o',
102+
input: 'Tell me a story',
103+
);
104+
105+
await for (final event in stream) {
106+
if (event['type'] == 'response.output_text.delta') {
107+
stdout.write(event['delta']);
108+
}
109+
}
110+
```
111+
79112
### Your First API Call
80113

81114
```dart
@@ -95,10 +128,36 @@ print(chatCompletion.choices.first.message.content);
95128

96129
---
97130

98-
## 📊 API Coverage (2025)
99-
100-
| API feature | Status | Details | Last Updated |
101-
|--------------|--------|----------| --------------|
131+
## 📊 API Coverage
132+
133+
| API | Status | Access |
134+
|-----|--------|--------|
135+
| **Responses** (incl. streaming) | ✅ Complete | `client.responses` |
136+
| **Conversations** | ✅ Complete | `client.conversations` |
137+
| **Chat Completions** (incl. stored completions, reasoning params) | ✅ Complete | `client.chat` |
138+
| **Completions** (legacy) | ✅ Complete | `client.completion` |
139+
| **Edits** (deprecated by OpenAI) | ✅ Complete | `client.edit` |
140+
| **Audio** (speech, transcription, translation, voices, consents) | ✅ Complete | `client.audio` |
141+
| **Images** (incl. streaming partials) | ✅ Complete | `client.image` |
142+
| **Embeddings** | ✅ Complete | `client.embedding` |
143+
| **Files** (incl. byte uploads) | ✅ Complete | `client.file` |
144+
| **Uploads** (multipart sessions) | ✅ Complete | `client.uploads` |
145+
| **Batch** | ✅ Complete | `client.batch` |
146+
| **Models** / **Moderation** | ✅ Complete | `client.model` / `client.moderation` |
147+
| **Vector Stores** (+files, +batches) | ✅ Complete | `client.vectorStores` |
148+
| **Containers** (+files) | ✅ Complete | `client.container` |
149+
| **Evals** | ✅ Complete | `client.evals` |
150+
| **Graders** (incl. run/validate) | ✅ Complete | `client.graders` |
151+
| **Fine-tuning** (new `/fine_tuning` API) | ✅ Complete | `client.fineTuning` |
152+
| **Fine-tunes** (legacy) | ⚠️ Deprecated | `client.fineTune` |
153+
| **Videos** | ✅ Complete | `client.videos` |
154+
| **Realtime** (REST sessions & client secrets) | ✅ Complete | `client.realtime` |
155+
| **Skills** | ✅ Complete | `client.skills` |
156+
| **Content Provenance Checks** | ✅ Complete | `client.provenance` |
157+
| **Administration** (projects, users, invites, audit logs, costs, rate limits, API keys) | ✅ Core complete | `client.organization` |
158+
| Realtime WebSocket client | 🗓️ planned | separate package consideration |
159+
160+
--------------|--------|----------| --------------|
102161
| **📋 [Responses](#-responses)** | ✅ Complete | All | 11-08-2025 17:33:39 |
103162
| **💭 [Conversations](#-conversations)** | ✅ Complete | All | 11-08-2025 17:38:56 |
104163
| **🎵 [Audio](#-audio)** | ✅ Complete | All | 11-08-2025 17:42:54 |

‎example/pubspec.lock‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ packages:
151151
path: ".."
152152
relative: true
153153
source: path
154-
version: "6.1.1"
154+
version: "7.0.0"
155155
dart_style:
156156
dependency: transitive
157157
description:

0 commit comments

Comments
 (0)