ai_sdk_openai_compatible 1.2.0
ai_sdk_openai_compatible: ^1.2.0 copied to clipboard
Shared OpenAI Chat Completions base for AI SDK Dart providers. Implements tool calling, multimodal content, structured output, and SSE streaming once, behind a small per-provider config.
1.2.0 #
First release (versioned 1.2.0 to align with the AI SDK Dart monorepo).
OpenAICompatibleChatLanguageModel— a fullLanguageModelV3implementation of the OpenAI Chat Completions wire format: multimodal content parts (text + image + audio + file),tools/tool_choice(withstrict),response_formatJSON-schema, SSE streaming (text deltas + index-based tool-call delta state machine + finish + usage), non-streaming tool-call parsing, and finish-reason mapping.apiErrorFromDioException(...)— a shared Dio→AiApiCallErrorbridge (delegating toAiApiCallError.fromResponse) so non-2xx responses surface as a typedAiApiCallErroron both the non-streaming and stream-setup paths. Imported by the OpenAI / Azure / Groq / Mistral providers.OpenAICompatibleConfig— a small config object parameterizing the per-provider quirks: auth header scheme, base URL, query parameters (e.g. Azureapi-version), body field name overrides (seedvsrandom_seed,max_tokensvsmax_completion_tokens), feature flags (supportsTools,supportsMultimodal,supportsResponseFormatJsonSchema), anextraBodyhook for provider-specific fields, and aDiofactory.