https://github.com/leynier/codex-dart
Dart SDK for Codex CLI
https://github.com/leynier/codex-dart
codex dart flutter flutter-desktop openai sdk
Last synced: 3 months ago
JSON representation
Dart SDK for Codex CLI
- Host: GitHub
- URL: https://github.com/leynier/codex-dart
- Owner: leynier
- License: other
- Created: 2026-02-20T04:00:55.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-02-20T04:30:47.000Z (5 months ago)
- Last Synced: 2026-02-20T07:17:24.798Z (5 months ago)
- Topics: codex, dart, flutter, flutter-desktop, openai, sdk
- Language: Dart
- Homepage: https://pub.dev/packages/codex
- Size: 28.3 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Notice: NOTICE
Awesome Lists containing this project
README
# codex
Dart SDK for Codex.
This package wraps the `codex` CLI and exchanges JSONL events over stdin/stdout.
## Installation
```bash
dart pub add codex
```
## Quickstart
```dart
import 'package:codex/codex.dart';
Future main() async {
final codex = Codex();
final thread = codex.startThread();
final turn = await thread.run('Diagnose the failing test and propose a fix.');
print(turn.finalResponse);
}
```
## Streaming
```dart
import 'package:codex/codex.dart';
Future main() async {
final codex = Codex();
final thread = codex.startThread();
final streamed = await thread.runStreamed('Inspect this repo and summarize risks.');
await for (final event in streamed.events) {
if (event is ItemCompletedEvent) {
print(event.item.runtimeType);
}
}
}
```
## Structured output
```dart
import 'package:codex/codex.dart';
Future main() async {
final codex = Codex();
final thread = codex.startThread();
final schema = {
'type': 'object',
'properties': {
'summary': {'type': 'string'},
'status': {
'type': 'string',
'enum': ['ok', 'action_required'],
},
},
'required': ['summary', 'status'],
'additionalProperties': false,
};
final result = await thread.run(
'Summarize repository status',
TurnOptions(outputSchema: schema),
);
print(result.finalResponse);
}
```
## Binary resolution strategy
This package resolves the executable in this order:
1. `codexPathOverride`
2. `CODEX_EXECUTABLE`
3. `PATH`
If `codex` cannot be found, it throws a clear error with remediation steps.
## Attribution and license
This project is a Dart port inspired by the TypeScript SDK in the OpenAI Codex repository (`sdk/typescript`).
- Upstream project: https://github.com/openai/codex
- Upstream license: Apache-2.0
See `LICENSE` and `NOTICE` in this repository for attribution details.
## Non-profit intent and package name
This project is maintained without profit intent and is published to help the Dart ecosystem.
If OpenAI decides to publish an official Dart package under the `codex` name, the current maintainer is willing to transfer/release this package name to OpenAI without issues.