flutter_ai_provider_openai 0.1.11 copy "flutter_ai_provider_openai: ^0.1.11" to clipboard
flutter_ai_provider_openai: ^0.1.11 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.

Changelog #

0.1.11 #

  • Fix: maxOutputTokens now maps to max_completion_tokens instead of the deprecated max_tokens, which reasoning models (o-series, gpt-5) reject with a
    1. A caller targeting an older OpenAI-compatible endpoint can still pass max_tokens via extra.
  • Fix: a mid-stream {"error": ...} chunk is now surfaced as a StreamErrorEvent instead of being ignored (which left an empty, apparently successful message).

0.1.10 #

  • Map AiRequestOptions.reasoningEffort to OpenAI's reasoning_effort. An explicit reasoning_effort in extra still takes precedence. Requires flutter_ai_core ^0.1.13.

0.1.9 #

  • Fix (Web): the default HTTP client now streams token-by-token on Flutter Web. http.Client() resolves to the XHR-backed BrowserClient on the web, which buffers the entire response body before the stream emits — silently degrading streaming to all-at-once. The default is now a fetch-based client (via a conditional import) that reads the response ReadableStream incrementally. Native platforms are unchanged. Inject your own client to override.

0.1.8 #

  • Fix: raise the flutter_ai_core lower bound to ^0.1.11 — the parser emits AiUsage (added in core 0.1.3) and later APIs, so the old ^0.1.0 bound let dependency downgrades resolve a core that couldn't compile.

0.1.7 #

  • Docs: refreshed the README listing with a hero image, screenshot gallery, and badges (consistent across the package family). No code changes.

0.1.6 #

  • Implements EmbeddingProvider: embed(inputs, {model}) POSTs /embeddings (default text-embedding-3-small) and returns AiEmbedding vectors.
  • Declares supported platforms: (all 6).

0.1.5 #

  • Throws typed LlmExceptions (auth/rate-limit/server/request) on HTTP errors instead of a generic Exception; retries 408/409 too.

0.1.4 #

  • Readies tool calls on any finish reason (and in finalize()), so calls can't hang in inputStreaming.
  • A mid-stream stall now surfaces a message-scoped StreamErrorEvent instead of also finalizing a terminal event that masked the timeout.
  • Asserts a non-empty apiKey with an actionable message.

0.1.3 #

  • Structured output: maps AiRequestOptions.responseFormat to a json_schema response_format (with strict).

0.1.2 #

  • Reports token usage: sets stream_options.include_usage and parses the trailing usage chunk (prompt/completion/total, cached + reasoning token details) into AiUsage on MessageFinished.

0.1.1 #

  • Docs: added a "Buy me a coffee" (Ko-fi) support section to the README. No code changes.

0.1.0 #

Initial release.

  • OpenAiProvider — an LlmProvider for the OpenAI Chat Completions API (or any OpenAI-compatible endpoint via a custom base URL), with an injectable HTTP client and a configurable default model.
  • Maps conversations (system/user/assistant/tool messages, assistant tool calls, tool results) into the request, and streams text, tool calls, and finish reasons back as AiStreamEvents.
  • OpenAiChunkParser — the chunk→event mapping, unit-tested against recorded SSE.
  • Robustness: configurable connect + idle timeout (a stalled stream surfaces a StreamErrorEvent instead of hanging); a wrong-shape chunk emits a StreamErrorEvent instead of crashing the stream; close() only closes a client it created; retry backoff is now capped and jittered.
  • Re-exports flutter_ai_core.

The mapping is unit-tested against recorded SSE chunks; it has not been run against the live OpenAI API in this release.

0
likes
160
points
529
downloads

Documentation

API reference

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
Contributing

Topics

#ai #llm #openai #chat #streaming

License

BSD-3-Clause (license)

Dependencies

fetch_client, flutter_ai_core, http

More

Packages that depend on flutter_ai_provider_openai