openrouter 1.0.1
openrouter: ^1.0.1 copied to clipboard
A Flutter plugin for the OpenRouter API - unified access to hundreds of AI models including OpenAI, Anthropic, Google, and more.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.1 - 2026-02-01 #
- update topics
1.0.0 - 2026-02-01 #
Added #
Response API (Beta)
-
New API Support: Added full support for the OpenRouter Responses API (Beta)
createResponse()method for non-streaming responsesstreamResponse()method for streaming responses- Complete type-safe request/response models
- Support for reasoning/thinking process display
- Web search integration with
WebSearchPreviewTool - Function calling support
- File search capabilities
- Image generation support
- Support for text, JSON object, and JSON schema response formats
-
New Models:
ResponsesRequest- Request model with support for:- Simple text input
- Structured message input with
EasyInputMessageandInputMessageItem - Multi-modal content (text, images, audio, video, files)
- Tool definitions and tool choice
- Reasoning configuration with effort levels
- Response format configuration
- Plugins (web search, auto-router, file parser, etc.)
ResponsesResponse- Response model with:- Output items (messages, reasoning, function calls)
- Web search call outputs
- File search call outputs
- Image generation call outputs
- Usage and cost information
- Error handling
ResponsesStreamingChunk- Streaming response chunks
Features
-
Reasoning Support: Added support for displaying model reasoning/thinking processes
ResponsesReasoningConfigfor configuring reasoning effortOutputReasoningfor accessing reasoning output- Multiple reasoning effort levels:
none,minimal,low,medium,high,xhigh - Reasoning summary verbosity options
-
Tool Calling: Enhanced tool calling capabilities
ResponsesFunctionToolfor defining function toolsWebSearchPreviewToolfor web search integrationOutputFunctionCallfor accessing function call outputs- Tool choice options: auto, none, required, or specific function
-
Content Types: Support for various input content types
ResponseInputText- Text inputResponseInputImage- Image input with URL or base64ResponseInputFile- File input with ID, data, or URLResponseInputAudio- Audio inputResponseInputVideo- Video inputResponseInputImageDetail- Image detail level control
-
Annotations: Support for citation annotations in responses
UrlCitation- URL citation with titleFileCitation- File citation with filenameFilePath- File path annotation
-
Plugins: Support for OpenRouter plugins
- Web search plugin
- Auto-router plugin for model selection
- File parser plugin with PDF options
- Response healing plugin
- Moderation plugin
Example App
- New Response API Demo: Added
ResponsesScreento example app- Interactive chat interface demonstrating Response API features
- Reasoning process display
- Token usage and cost tracking
- Feature badges showing supported capabilities
- About dialog explaining Response API features
Documentation
- Comprehensive README: Completely rewritten with:
- Feature overview
- Quick start guide
- Detailed usage examples for all APIs
- Chat completions (streaming and non-streaming)
- Embeddings
- Model listing
- Responses API examples
- Error handling patterns
- Configuration options
- Example app instructions
Changed #
-
Model Organization: Improved exports structure
- Hide conflicting type names (
ReasoningEffort,ToolChoiceFunction,PdfOptions,TopLogprob,CostDetails) - Better separation between Chat API and Response API types
- Hide conflicting type names (
-
Type Safety: Enhanced type safety with sealed classes
ResponsesInputItem- Sealed class for input itemsResponseContentPart- Sealed class for content partsResponsesTool- Sealed class for toolsResponsesToolChoice- Sealed class for tool choicesResponseFormatTextConfig- Sealed class for format configsResponsesOutputItem- Sealed class for output itemsOutputContent- Sealed class for output contentAnnotation- Sealed class for annotations
Fixed #
-
JSON Serialization: Fixed polymorphic type serialization
- Added custom converters for
List<ResponsesTool> - Added custom converters for
List<ResponsesOutputItem> - Added custom converters for
List<OutputContent> - Added custom converters for
List<Annotation> - Added custom converters for
List<ResponseContentPart> - Added custom converters for
ResponseFormatTextConfig - Added custom converters for
ResponsesToolChoice - Proper handling of sealed class hierarchies with type discrimination
- Added custom converters for
-
Code Quality:
- Removed
@immutableannotations from sealed classes (build_runner compatibility) - Fixed all LSP errors and warnings
- Applied
dart fixsuggestions - Formatted all code with
dart format
- Removed
Technical Details #
-
Dependencies:
- Uses
json_annotationandjson_serializablefor code generation - Uses
httppackage for HTTP requests - Uses
metapackage for annotations
- Uses
-
Code Generation:
- All models support JSON serialization via build_runner
- Generated
.g.dartfiles for all serializable models - Custom fromJson/toJson logic for polymorphic types
-
Compatibility:
- Requires Dart SDK ^3.0.0
- Flutter 3.0+ support
- Multi-platform support (iOS, Android, Web, Desktop)
0.0.1 Initial Release #
Added #
- Initial project structure
- Basic Flutter plugin setup
- Placeholder implementation
Release Notes Format #
Each release includes:
- Added: New features
- Changed: Changes in existing functionality
- Deprecated: Soon-to-be removed features
- Removed: Now removed features
- Fixed: Bug fixes
- Security: Security improvements
Migration Guide #
Migrating to 1.0.0 #
If you're upgrading from earlier versions:
-
Update imports: No breaking changes to existing Chat API imports
-
New Response API: Add additional imports if using Response API:
import 'package:openrouter/openrouter.dart' hide ReasoningEffort; import 'package:openrouter/src/models/responses_request.dart' as responses; import 'package:openrouter/src/models/responses_response.dart' as responses; -
ReasoningEffort: If using
ReasoningEffortfrom chat requests, it is now shared. No action needed unless you were importing it specifically. -
New Features: Response API is fully additive - existing code continues to work without changes.