feat: Add Nano Banana 2 support with three-tier quality presets#57
Merged
feat: Add Nano Banana 2 support with three-tier quality presets#57
Conversation
Define ImageQuality = 'fast' | 'balanced' | 'quality' preset type for the new quality tier system. Extend AspectRatio with 4 new ratios (1:4, 1:8, 4:1, 8:1) and ImageSize with 2 new sizes (512px, 1K) supported by Nano Banana 2. Add optional quality field to GenerateImageParams. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add imageQuality field to Config interface, read from IMAGE_QUALITY env var (default: 'fast'), and validate against allowed values (fast, balanced, quality). Update existing config tests to include the new required field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 5 test cases covering imageQuality config: valid values accepted, invalid values rejected with helpful error, default 'fast' when env var unset, env var reading, and invalid env var rejection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hardcoded model name with dynamic selection based on quality preset: fast/balanced use gemini-3.1-flash-image-preview (Nano Banana 2), quality uses gemini-3-pro-image-preview (Nano Banana Pro). Add thinkingConfig with thinkingLevel 'high' for balanced preset. Constructor accepts defaultQuality from config with per-request override. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add quality parameter validation against supported values (fast, balanced, quality). Extend SUPPORTED_ASPECT_RATIOS with 4 new ratios (1:4, 1:8, 4:1, 8:1) supported by Nano Banana 2. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update geminiClient tests: change expected model to gemini-3.1-flash-image-preview, add 5 tests for quality presets (fast/balanced/quality model selection, thinking_config, per-request override, constructor default). Update inputValidator tests: fix 4:1 ratio test (now valid), add new aspect ratio tests, add quality validation tests. Total: 155 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add quality preset parameter (fast/balanced/quality) to generate_image tool schema with descriptive text for AI agents. Update aspectRatio enum with 4 new ratios (1:4, 1:8, 4:1, 8:1) and imageSize enum with 2 new sizes (512px, 1K). Pass quality through to geminiClient. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update GeminiAPIError suggestion text to mention both gemini-3.1-flash-image-preview and gemini-3-pro-image-preview instead of only the Pro model. Add error suggestion tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update all test fixtures and mocks from gemini-3-pro-image-preview to gemini-3.1-flash-image-preview. Add tests for quality parameter schema, imageSize enum (4 values), and verify aspectRatio enum (14 values). Total: 161 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- #1: Extract model names to GEMINI_MODELS constants in types/mcp.ts - #2: Unify quality values list to IMAGE_QUALITY_VALUES constant - #3: Fix unsafe as ImageQuality cast order in getConfig() - #4,#8: Remove contextMethod/features from mock (not in interface) - #5: Use !== undefined for quality passthrough consistency - #6: Add tools to GeminiClientInstance interface - #7: Sort aspect ratio enum consistently across files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
512px is only supported by Nano Banana 2 (Flash) and would cause API errors when used with the Pro model quality preset. Keep 1K which is supported by both models. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- quality: Replace internal model names with user-facing decision criteria (speed/fidelity tradeoff and use cases) - purpose: Clarify effect on output (lighting, composition, detail) - fileName: Remove implementation detail (IMAGE_OUTPUT_DIR) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bump version 0.7.0 -> 0.8.0 in package.json, package-lock.json, server.json - Remove 512px from README imageSize parameter (removed from implementation) - Improve quality parameter description to prevent LLM from overriding server default - Add user-friendly per-request quality override instructions in README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nano-banana-2 tag Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gemini-3.1-flash-image-preview) as the default image generation model, replacing the previous Pro-only setupIMAGE_QUALITYenv var) allowing users to choose between speed and fidelity:gemini-3-pro-image-preview) — highest fidelity for final deliverablesqualitytool parameter, designed to only activate when the user explicitly requests it (server default is respected otherwise)1:4,1:8,4:1,8:1) supported by Nano Banana 2imageSizeoptions to1K,2K,4K(removed512pxwhich is Flash-only and incompatible with Pro model)Test plan
npm test)npm run buildsucceedsIMAGE_QUALITYenv var when quality is not explicitly requested🤖 Generated with Claude Code