Skip to main content

ai_stream_client 0.1.0 copy "ai_stream_client: ^0.1.0" to clipboard
ai_stream_client: ^0.1.0 copied to clipboard

A typed, provider-neutral Dart client for streaming OpenAI-compatible chat APIs with cancellation and structured errors.

example/ai_stream_client_example.dart

import 'package:ai_stream_client/ai_stream_client.dart';

Future<void> main() async {
  final client = AiStreamClient(
    // Point this at your backend proxy. Do not ship provider keys in an app.
    baseUrl: Uri.parse('https://api.example.com/v1/'),
  );
  final request = AiChatRequest(
    model: 'your-model',
    messages: const [AiMessage.user('Explain Flutter in one sentence.')],
  );
  await for (final chunk in client.streamChat(request)) {
    print(chunk.text);
  }
  client.close();
}
1
likes
160
points
419
downloads

Documentation

API reference

Publisher

verified publishersyedwaleednawaz.com

Weekly Downloads

A typed, provider-neutral Dart client for streaming OpenAI-compatible chat APIs with cancellation and structured errors.

Homepage
Repository (GitHub)
View/report issues

Topics

#ai #streaming #api-client #sse

License

MIT (license)

Dependencies

http

More

Packages that depend on ai_stream_client