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

OpenAI-compatible LlmProvider for flutter_ai: streams Chat Completions (text, tool calls, finish reasons) as flutter_ai_core AiStreamEvents over an injectable HTTP client.

flutter_ai_provider_openai #

Streamed Markdown response

Streamed responses render through flutter_ai_elements (AiResponse).

An OpenAI-compatible LlmProvider for the flutter_ai family.

Streams the OpenAI Chat Completions API and maps each chunk to flutter_ai_core AiStreamEvents — text deltas, streamed tool calls, and finish reasons. Works with the public OpenAI endpoint or any compatible server (Azure OpenAI, proxies, local servers) via a custom base URL.

Usage #

import 'package:flutter_ai_provider_openai/flutter_ai_provider_openai.dart';

final provider = OpenAiProvider(
  apiKey: const String.fromEnvironment('OPENAI_API_KEY'),
  defaultModel: 'gpt-4o-mini',
);

// Drive it with flutter_ai_client's UseChatController:
final controller = UseChatController(provider: provider);
controller.sendText('Hello!');

Point it elsewhere with baseUrl:

OpenAiProvider(
  apiKey: key,
  baseUrl: Uri.parse('https://my-proxy.example.com/v1'),
);

The HTTP client is injectable (client:) for testing or custom transport.

Status #

0.1.0. The request/response mapping is unit-tested against recorded SSE chunks; it has not been exercised against the live OpenAI API in this release. Depends on flutter_ai_core via a local path (publish_to: none) until that package is published.

0
likes
0
points
529
downloads

Publisher

unverified uploader

Weekly Downloads

OpenAI-compatible LlmProvider for flutter_ai: streams Chat Completions (text, tool calls, finish reasons) as flutter_ai_core AiStreamEvents over an injectable HTTP client.

Homepage
Repository (GitHub)
View/report issues

Topics

#ai #llm #openai #chat #streaming

License

unknown (license)

Dependencies

flutter_ai_core, http

More

Packages that depend on flutter_ai_provider_openai