ai-sdk-provider-gemini-cli
Version:
Community AI SDK provider for Google Gemini using the official CLI/SDK
129 lines (101 loc) • 4.51 kB
Markdown
# Development Status for AI SDK v5
## Overview
This document tracks the development status of the Gemini CLI Provider for Vercel AI SDK v5 compatibility.
## Current Status: ✅ COMPLETE
The provider has been fully migrated to support AI SDK v5.
## Completed Features
### Core Functionality
- ✅ **Provider Interface**: Extends `ProviderV2` correctly
- ✅ **Language Model**: Implements `LanguageModelV2` interface
- ✅ **Text Generation**: Full `generateText` support with v5 response format
- ✅ **Streaming**: Complete `streamText` implementation with promise-based API
- ✅ **Object Generation**: `generateObject` with Zod schema validation
- ✅ **System Messages**: Proper system instruction support
- ✅ **Conversation History**: Multi-turn conversation support
- ✅ **Multimodal**: Base64 image support (URL images not supported by design)
### Authentication
- ✅ **OAuth Personal**: Default authentication via Gemini CLI
- ✅ **API Key**: Both `api-key` and `gemini-api-key` auth types
- ✅ **Credential Management**: Uses `~/.gemini/oauth_creds.json`
### Models
- ✅ **gemini-3-pro-preview**: Full support (Preview)
- ✅ **gemini-2.5-pro**: Full support (Previous generation)
- ✅ **gemini-2.5-flash**: Full support for faster responses
### Error Handling
- ✅ **Error Mapping**: Proper error types for v5
- ✅ **Abort Signals**: Correct AbortError handling (with limitations)
- ✅ **Validation Errors**: Clear error messages for schema failures
### Documentation
- ✅ **Breaking Changes Guide**: Complete migration guide from v4
- ✅ **Usage Guide**: Comprehensive v5 patterns and examples
- ✅ **Troubleshooting**: Common issues and solutions documented
- ✅ **API Documentation**: All interfaces documented
### Examples
- ✅ All 14 example files updated and tested with v5
- ✅ Examples use gemini-2.5-pro for consistency
- ✅ Clear documentation of patterns and best practices
## Known Limitations
### 1. Abort Signal Support
- **Status**: Partial
- **Issue**: The underlying `gemini-cli-core` doesn't support request cancellation
- **Impact**: Abort signals work from SDK perspective but HTTP requests continue in background
- **Workaround**: None - this is a limitation of the underlying library
### 2. maxOutputTokens with gemini-2.5-pro
- **Status**: Known Issue
- **Issue**: Setting `maxOutputTokens` can cause empty responses
- **Impact**: Users may get unexpected empty results
- **Workaround**: Omit the parameter or use gemini-2.5-flash
### 3. Image URL Support
- **Status**: Not Supported
- **Issue**: Only base64-encoded images are supported
- **Impact**: Users must convert images to base64
- **Workaround**: Read images as buffers and encode to base64
### 4. Unsupported Parameters
- **frequencyPenalty**: Not supported by Gemini
- **presencePenalty**: Not supported by Gemini
- **seed**: Not supported by Gemini
- **responseFormat**: Partially supported (JSON mode only)
## Testing Status
### Unit Tests
- ✅ All tests updated for v5 compatibility
- ✅ 98.85% test coverage achieved
- ✅ All tests passing
### Integration Tests
- ✅ All examples run successfully
- ✅ Authentication verified
- ✅ Model responses validated
### Manual Testing
- ✅ Basic text generation
- ✅ Streaming responses
- ✅ Object generation
- ✅ System messages
- ✅ Conversation history
- ✅ Error scenarios
- ✅ Timeout/abort handling
## Migration Checklist
- [x] Update dependencies to v5 versions
- [x] Implement ProviderV2 interface
- [x] Implement LanguageModelV2 interface
- [x] Update message format handling
- [x] Update streaming implementation
- [x] Update token usage property names
- [x] Update parameter names (maxTokens → maxOutputTokens)
- [x] Update error handling
- [x] Update all examples
- [x] Update all documentation
- [x] Run comprehensive tests
## Version Information
- **Provider Version**: 1.0.0-beta.x
- **AI SDK Version**: 5.0.0-beta.26+
- **AI SDK Provider**: 2.0.0-beta.1+
- **Node.js**: ≥20 required
## Future Considerations
1. **Request Cancellation**: If `gemini-cli-core` adds abort support, update provider
2. **New Models**: Add support for new Gemini models as they become available
3. **Additional Features**: Monitor AI SDK v5 for new features to support
4. **Performance**: Consider optimization opportunities for streaming
## Support
For issues or questions:
- Review [TROUBLESHOOTING.md](./TROUBLESHOOTING.md)
- Check [examples](../../examples/) for patterns
- File issues on GitHub repository