Skip to main content
Glama
CHANGELOG-v1.2.0.mdโ€ข7.62 kB
# Smart AI Bridge v1.2.0 - Dynamic Token Scaling **Release Date**: 2025-11-03 **Type**: Minor Feature Release **Breaking Changes**: None **Migration Required**: No --- ## ๐ŸŽ‰ New Features ### Dynamic Token Allocation System Automatically scales token limits based on request complexity and backend capabilities. **Token Allocation Strategy**: - **Unity Generation**: 16,384 tokens for large game development scripts - **Complex Requests**: 8,192 tokens for comprehensive code generation - **Simple Queries**: 2,048 tokens for fast, efficient responses - **Fallback**: 4,096 tokens for medium complexity operations **Intelligent Detection**: - Unity/MonoBehaviour pattern recognition - Complex generation keyword analysis - Large codebase size estimation - Automatic prompt complexity assessment **Backend-Aware Limits**: - Respects individual backend maximum token capacities - Local Qwen: 65,536 tokens (YARN extended) - Gemini Pro: 32,768 tokens - NVIDIA DeepSeek: 8,192 tokens - NVIDIA Qwen3: 32,768 tokens --- ## โœจ Improvements ### Enhanced AI Routing - Token optimization integrated with multi-backend routing - Improved resource allocation for Unity game development - Better performance for simple queries through reduced token overhead - Intelligent fallback when requests exceed backend limits ### Modular Architecture - New `DynamicTokenManager` class for clean separation of concerns - Configurable token thresholds via constructor - Optional logging for production environments - Pure computation module with no external dependencies --- ## ๐Ÿ“š Technical Details ### New Module **File**: `dynamic-token-manager.js` **Export**: `DynamicTokenManager` class + singleton instance **API**: ```javascript import { DynamicTokenManager, dynamicTokenManager } from './dynamic-token-manager.js'; // Use default singleton const tokens = dynamicTokenManager.calculateDynamicTokenLimit( prompt, 'local', { enableLogging: true } ); // Or create custom instance const manager = new DynamicTokenManager({ unity_generation_tokens: 20000, complex_request_tokens: 10000, simple_request_tokens: 2000, fallback_tokens: 5000 }); ``` ### Detection Patterns **Unity Recognition**: ```regex /unity|monobehaviour|gameobject|transform|rigidbody| collider|animation|shader|script.*generation| generate.*unity|create.*unity.*script/i ``` **Complex Generation**: ```regex /generate|create|build|write.*script| complete.*implementation|full.*code|entire.*system/i ``` **Large Codebase**: ```javascript tokenCount > 8000 || /multi.*file|entire.*project|complete.*system/i ``` ### Configuration Options ```javascript { local_max: 65536, // Local model max tokens gemini_max: 32768, // Gemini Pro max nvidia_deepseek_max: 8192, // DeepSeek max nvidia_qwen_max: 32768, // Qwen3 max unity_generation_tokens: 16384, // Unity scripts complex_request_tokens: 8192, // Complex operations simple_request_tokens: 2048, // Simple requests fallback_tokens: 4096 // Medium complexity } ``` --- ## ๐Ÿ›ก๏ธ Security - โœ… No hardcoded credentials or API keys - โœ… Environment-based configuration supported - โœ… Follows Smart AI Bridge security patterns - โœ… No external dependencies or API calls - โœ… Configurable logging (can be disabled) - โœ… Passed comprehensive security audit --- ## ๐Ÿ‘ Backward Compatibility **Zero Breaking Changes**: - All existing APIs remain unchanged - Existing configurations continue to work - Dynamic token scaling is automatic and transparent - No required configuration updates **Optional Enhancements**: - Customize token limits via `DynamicTokenManager` if desired - Existing hardcoded `maxTokens` values still respected - Fallback behavior preserved for edge cases --- ## ๐Ÿ“ Documentation Updates - โœ… README.md: Added Dynamic Token Scaling section - โœ… CONFIGURATION.md: Token configuration guide - โœ… EXAMPLES.md: Usage examples with different request types - โœ… API documentation: DynamicTokenManager class reference --- ## ๐Ÿงช Migration Guide ### From v1.1.x to v1.2.0 **No action required** - dynamic token scaling works automatically! **Optional Customization**: ```javascript // In your Smart AI Bridge initialization import { DynamicTokenManager } from './dynamic-token-manager.js'; const tokenManager = new DynamicTokenManager({ // Override defaults if needed unity_generation_tokens: 20000, complex_request_tokens: 10000 }); // Use in request handling const optimalTokens = tokenManager.calculateDynamicTokenLimit( userPrompt, selectedBackend ); ``` --- ## โš–๏ธ Use Cases ### 1. Unity Game Development **Before v1.2.0**: - Fixed token limits regardless of script size - May truncate large MonoBehaviour scripts - Manual token adjustment required **With v1.2.0**: - Automatic 16K token allocation for Unity scripts - Handles large character controllers, AI systems - No manual intervention needed **Example**: ```javascript const prompt = "Create a Unity C# script for third-person character movement with camera controls"; // Automatically allocates 16,384 tokens ``` ### 2. Complex Code Generation **Before v1.2.0**: - Same token allocation for simple and complex requests - Inefficient resource usage **With v1.2.0**: - 8K tokens for complex multi-file generation - 2K tokens for simple queries - Optimized performance and cost **Example**: ```javascript const complexPrompt = "Generate a complete REST API with authentication, database models, and tests"; // Allocates 8,192 tokens const simplePrompt = "What is a closure?"; // Allocates 2,048 tokens (efficient!) ``` ### 3. Backend-Specific Optimization **Before v1.2.0**: - May request more tokens than backend supports - Potential errors or truncation **With v1.2.0**: - Respects backend limits automatically - Intelligent fallback to maximum available **Example**: ```javascript const unityPrompt = "Create Unity player controller"; // Requests 16K tokens // DeepSeek backend: Limited to 8K (backend max) // Local backend: Full 16K allocated ``` --- ## ๐Ÿ’ก Performance Impact **Improvements**: - โœ… Simple queries: ~75% reduction in token usage (2K vs 8K) - โœ… Unity generation: +100% token allocation (16K vs 8K) - โœ… Resource optimization: Better cost efficiency - โœ… Response time: Faster for simple queries **Benchmarks** (estimated): - Simple query ("What is X?"): 2K tokens, ~0.5s faster - Complex generation: 8K tokens, same performance - Unity script: 16K tokens, complete output (no truncation) --- ## ๐Ÿ”— Related Changes This release builds on Smart AI Bridge v1.1.1 features: - Conversation threading and continuity - Usage analytics and cost tracking - Local AI service auto-discovery - Multi-backend smart routing - Security-hardened architecture **All existing features preserved and enhanced.** --- ## ๐Ÿš€ Future Roadmap Potential enhancements for v1.3.0+: - Machine learning-based complexity detection - User-specific token preference profiles - Dynamic timeout scaling (similar to token scaling) - Per-user token usage analytics - Adaptive learning from success rates --- ## ๐Ÿ’ฌ Feedback We'd love to hear your experience with dynamic token scaling! - GitHub Issues: Report bugs or request features - GitHub Discussions: Share use cases and best practices - Pull Requests: Contribute improvements --- ## ๐Ÿ™ Credits **Development**: Claude Code automation **Testing**: Integration test suite **Security**: Automated security audit **Documentation**: Comprehensive guides and examples --- **Enjoy Smart AI Bridge v1.2.0! ๐ŸŽ‰**

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Platano78/Smart-AI-Bridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server