open_responses 0.4.0
open_responses: ^0.4.0 copied to clipboard
Dart client for the OpenResponses API. Provides a unified, type-safe interface for interacting with multiple LLM providers through the OpenResponses specification.
0.4.0 #
Caution
This release has breaking changes. See the Migration Guide for upgrade instructions.
Tracks OpenResponses spec v2.3.0 (openresponses#68) by adding response compaction, the assistant message phase, and broader output-item coverage. Adds POST /responses/compact via ResponsesResource.compact() along with new CompactResource, CompactResponseRequest, CompactionItem (input variant), and CompactionOutputItem (output variant) models. Adds MessagePhase (commentary/final_answer) with a new optional phase field on AssistantMessageItem and MessageOutputItem — required for follow-up requests on gpt-5.3-codex and similar models. Also adds FunctionCallOutputResponseItem so OutputItem covers all members of the spec's ItemField union, and supports input_* content parts in MessageOutputItem.content so echoed-back user messages in stored or compacted history parse correctly. Breaking: MessageOutputItem.content is retyped from List<OutputContent> to List<MessageContentPart> — type guards on leaf classes still narrow correctly, but callers that declare the intermediate list type must migrate.
0.3.2 #
Adds support for WebSocket mode in the Responses API via new WebSocketResponseCreateEvent and WebSocketErrorEvent types. The request wrapper composes an existing CreateResponseRequest with the required response.create discriminator and automatically strips the three HTTP-only fields (background, stream, stream_options) that must not be sent over WebSocket. Promotes the bundled OpenResponses spec to v2.3.0 (openresponses#71).
0.3.1 #
Annotates llms.txt with per-link token counts and per-package totals so coding agents can budget context before fetching documentation, examples, or changelogs — inspired by Addy Osmani's Agentic Engine Optimization article.
0.3.0 #
Caution
This release has breaking changes. See the Migration Guide for upgrade instructions.
The InputFileContent.data() factory now requires a mediaType parameter and constructs proper data URL format instead of passing raw base64 (which was rejected by the API). Also adds the missing ReasoningItemParam manifest entry and copyWith method to ReasoningInputItem.
0.2.0 #
Caution
This release has breaking changes. See the Migration Guide for upgrade instructions.
Replaces the ServiceTier enum with an extensible class to preserve provider-specific tier values on round-trip serialization, aligning with the provider-agnostic OpenResponses specification. Also standardizes equality helper locations, overhauls README documentation with llms.txt ecosystem files, and aligns compliance tests with the official OpenResponses CLI test runner.
- BREAKING FEAT: Improve spec compliance for ServiceTier and ResponseError (#133). (487231d2)
- REFACTOR: Standardize equality helpers location across packages (#123). (34086102)
- DOCS: Overhaul READMEs and add llms.txt ecosystem (#149). (98f11483)
- TEST: Align compliance tests with official CLI test runner (#134). (f7919790)
0.1.5 #
Added StreamingEventAccumulator for assembling streamed response events into a complete response, convenience factories on Item for creating common message types (userMessage, assistantMessage, functionCall, etc.), and type-safe ResponseInput for building request input with compile-time safety. Also added copyWith methods to streaming events and several model classes.
0.1.4 #
0.1.3 #
0.1.2 #
0.1.1 #
0.1.0 #
Initial release of the OpenResponses Dart client.
Features #
- Core Client:
OpenResponsesClientwith configurable base URL and authentication - Response Creation:
responses.create()for non-streaming requests - Streaming:
responses.createStream()andresponses.stream()with builder pattern - Multi-provider Support: Works with OpenAI, Ollama, Hugging Face, OpenRouter, and LM Studio
Request Features #
- String or message item list input
- System instructions via
instructionsparameter - Multi-turn conversations with
previousResponseId - Temperature and max output tokens control
- Service tier selection
Tools #
FunctionTool: Define custom functions with JSON Schema parametersMcpTool: Remote Model Context Protocol server tools- Tool choice configuration (auto, required, specific function)
Structured Output #
TextConfigwith format optionsJsonSchemaFormatfor structured JSON responses with strict modeTextResponseFormatandJsonObjectFormat
Reasoning Models #
ReasoningConfigwith effort levels (low, medium, high)- Reasoning summary modes (concise, detailed, auto)
- Access to reasoning items via
response.reasoningItems
Streaming Events #
- Full SSE event parsing with 25+ event types
- Response lifecycle events (created, queued, in_progress, completed, failed)
- Output item and content part events
- Text delta and done events
- Function call argument streaming
- Reasoning delta and summary events
- Error events
Content Types #
InputTextContent: Text inputInputImageContent: Image URLs with detail levelInputFileContent: File referencesOutputTextContent: Text output with annotationsRefusalContent: Model refusal messages
Message Items #
MessageItemwith role (user, assistant, system, developer)- Convenience factories:
userText(),systemText(),assistantText() FunctionCallItemandFunctionCallOutputItemItemReferencefor referencing previous items
DX Extensions #
response.outputText: Concatenated text from outputresponse.functionCalls: All function call itemsresponse.reasoningItems: All reasoning itemsresponse.hasToolCalls,response.isCompleted,response.isFailedevent.textDelta,event.isFinalstream.text,stream.finalResponse
Error Handling #
OpenResponsesExceptionsealed class hierarchyApiExceptionwith error code and detailsAuthenticationExceptionfor auth failuresRateLimitExceptionwith retry-after durationValidationExceptionfor invalid requestsTimeoutExceptionandAbortedException
Authentication #
BearerTokenProviderfor API key authenticationNoAuthProviderfor local providers (Ollama, LM Studio)- Extensible
AuthProviderinterface
Configuration #
OpenResponsesConfigwith base URL, auth, headers, timeoutRetryPolicywith exponential backoff and jitter- Custom HTTP client support
Commits #
- FEAT: Initial implementation of OpenResponses Dart client (#10). (4fac8fa6)
- FEAT: Comprehensive model improvements with new features (#16). (6b6450a7)
- FEAT: Add SummaryTextContent for reasoning models (#23). (93ce0a00)
- FEAT: Add ReasoningInputItem, UnknownEvent, and provider aliases (#28). (e1fa0afe)
- REFACTOR: Align client package architecture across SDK packages (#37). (cf741ee1)
- REFACTOR: Align API surface across all SDK packages (#36). (ed969cc7)