@apresai/gimage-mcp 1.2.61 → 1.2.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/README.md ADDED
@@ -0,0 +1,833 @@
1
+ # Gimage - AI-Powered Image Generation and Processing
2
+
3
+ **Gimage** is a powerful tool for generating AI images and processing them with ease. Built with pure Go for maximum portability.
4
+
5
+ ## 🚀 Three Ways to Use Gimage
6
+
7
+ ### 1. Command-Line Tool (CLI)
8
+ A single binary with zero dependencies for local image operations on your computer.
9
+
10
+ ### 2. MCP Server for AI Assistants
11
+ Run as an MCP (Model Context Protocol) server for seamless integration with Claude Desktop and other AI assistants.
12
+
13
+ ### 3. Cloud API (AWS Lambda)
14
+ Production-ready serverless REST API for web applications and remote processing.
15
+
16
+ ## What Can You Do with Gimage?
17
+
18
+ ### 🎨 AI Image Generation
19
+ - Generate stunning images from text prompts using Google Gemini, Vertex AI, or AWS Bedrock
20
+ - Multiple AI models: Gemini 2.5 Flash, Imagen 3, Imagen 4, Nova Canvas
21
+ - Control size, style, quality, and use negative prompts
22
+ - Reproducible results with seed values
23
+
24
+ ### 🛠️ Image Processing
25
+ - **Resize** - Change image dimensions with high-quality resampling
26
+ - **Scale** - Scale images by factor (2x, 0.5x, etc.)
27
+ - **Crop** - Extract specific regions from images
28
+ - **Compress** - Reduce file size while maintaining quality
29
+ - **Convert** - Transform between formats (PNG, JPG, WebP, GIF, TIFF, BMP)
30
+
31
+ ### ⚡ Batch Processing (MCP Server Only)
32
+ - Process multiple images concurrently via MCP server
33
+ - Optimized for AI assistants (Claude Desktop)
34
+ - CLI users: use shell scripts or `find` + `xargs`
35
+
36
+ ### 🔌 Integration Options
37
+ - **Claude Desktop**: Run as MCP server
38
+ - **Web Applications**: REST API via AWS Lambda
39
+ - **Serverless**: AWS Lambda on ARM64/Graviton2
40
+
41
+ ## Quick Start - CLI
42
+
43
+ ### 1. Installation
44
+
45
+ #### Homebrew (macOS/Linux) - Recommended
46
+
47
+ ```bash
48
+ # Install gimage (tap is added automatically)
49
+ brew install apresai/tap/gimage
50
+ ```
51
+
52
+ #### Upgrade via Homebrew
53
+
54
+ ```bash
55
+ brew upgrade apresai/tap/gimage
56
+ ```
57
+
58
+ #### Manual Installation
59
+
60
+ Download the latest release for your platform:
61
+
62
+ ```bash
63
+ # macOS (Intel)
64
+ curl -L https://github.com/apresai/gimage/releases/latest/download/gimage-darwin-amd64 -o gimage
65
+ chmod +x gimage
66
+ sudo mv gimage /usr/local/bin/
67
+
68
+ # macOS (Apple Silicon)
69
+ curl -L https://github.com/apresai/gimage/releases/latest/download/gimage-darwin-arm64 -o gimage
70
+ chmod +x gimage
71
+ sudo mv gimage /usr/local/bin/
72
+
73
+ # Linux
74
+ curl -L https://github.com/apresai/gimage/releases/latest/download/gimage-linux-amd64 -o gimage
75
+ chmod +x gimage
76
+ sudo mv gimage /usr/local/bin/
77
+ ```
78
+
79
+ ### 2. Setup Authentication
80
+
81
+ **Quick Start** (recommended for most users):
82
+
83
+ ```bash
84
+ # Get a free Gemini API key from https://aistudio.google.com/app/apikey
85
+ # Then run the interactive setup:
86
+ gimage auth setup gemini
87
+
88
+ # Or use environment variable (more secure):
89
+ export GEMINI_API_KEY="your-api-key-here"
90
+ gimage generate "test sunset"
91
+ ```
92
+
93
+ **Check your configuration:**
94
+
95
+ ```bash
96
+ # Check current authentication status
97
+ gimage auth status
98
+
99
+ # List all configured providers with pricing
100
+ gimage auth list
101
+
102
+ # Test your credentials
103
+ gimage auth test gemini
104
+ ```
105
+
106
+ **Get API Keys:**
107
+ - **Gemini API**: https://aistudio.google.com/app/apikey (FREE tier: 1500 requests/day, no credit card)
108
+ - **Vertex AI**: https://cloud.google.com/vertex-ai (3 auth modes: Express Mode/Service Account/Application Default Credentials)
109
+ - **AWS Bedrock**: https://console.aws.amazon.com/bedrock (4 auth modes: Bearer Token/Access Keys/Profile/IAM Role)
110
+
111
+ ### 3. Generate Your First Image
112
+
113
+ ```bash
114
+ gimage generate "a sunset over mountains with vibrant colors"
115
+ ```
116
+
117
+ That's it! Your image will be saved as `generated_<timestamp>.png`
118
+
119
+ ## Examples
120
+
121
+ ### Image Generation
122
+
123
+ ```bash
124
+ # Basic generation (positional prompt - most common)
125
+ gimage generate "futuristic city at night"
126
+
127
+ # Specify size and style
128
+ gimage generate "abstract art" --size 1024x1024 --style photorealistic
129
+
130
+ # Use Vertex AI Imagen 4 (auto-detects vertex API)
131
+ gimage generate "beautiful landscape" --model imagen-4
132
+
133
+ # Use AWS Bedrock Nova Canvas with premium quality
134
+ gimage generate "futuristic robot" --model nova-canvas --quality premium
135
+
136
+ # Use negative prompts to avoid unwanted elements
137
+ gimage generate "forest scene" --negative "people, buildings"
138
+
139
+ # Reproducible results with seed
140
+ gimage generate "random pattern" --seed 12345
141
+
142
+ # Control creativity with CFG scale (Nova Canvas)
143
+ gimage generate "abstract art" --model nova-canvas --cfg-scale 10
144
+
145
+ # List all available models with pricing
146
+ gimage generate --list-models
147
+
148
+ # Or use explicit --prompt flag if preferred
149
+ gimage generate --prompt "your prompt here"
150
+ ```
151
+
152
+ ### Image Processing
153
+
154
+ All image processing commands use explicit flags for clarity:
155
+
156
+ ```bash
157
+ # Resize to specific dimensions
158
+ gimage resize --input photo.jpg --width 800 --height 600
159
+
160
+ # Scale to 50% size
161
+ gimage scale --input photo.jpg --factor 0.5
162
+
163
+ # Crop a region
164
+ gimage crop --input photo.jpg --x 100 --y 100 --width 800 --height 600
165
+
166
+ # Compress with custom quality (supports JPG and WebP)
167
+ gimage compress --input photo.jpg --quality 85
168
+
169
+ # Convert format
170
+ gimage convert --input photo.png --format jpg
171
+
172
+ # Use --output to specify custom output path
173
+ gimage resize --input photo.jpg --width 800 --height 600 --output resized.jpg
174
+
175
+ # Add --verbose for detailed progress
176
+ gimage convert --input photo.png --format webp --verbose
177
+ ```
178
+
179
+ ### Batch Processing
180
+
181
+ **Batch operations are available only through the MCP server** for use with AI assistants like Claude.
182
+
183
+ For CLI users who need batch processing:
184
+ - Use shell scripts with loops
185
+ - Use `find` + `xargs` for parallel processing
186
+ - Example: `find photos/ -name "*.jpg" | xargs -P 4 -I {} gimage resize --input {} --width 800 --height 600`
187
+
188
+ MCP server batch tools (for AI assistants):
189
+ - `batch_resize` - Concurrent image resizing
190
+ - `batch_compress` - Concurrent compression
191
+ - `batch_convert` - Concurrent format conversion
192
+
193
+ See [MCP documentation](#mcp-server-for-ai-assistants) for details.
194
+
195
+ ## Configuration
196
+
197
+ ### Authentication Priority (Highest to Lowest)
198
+ 1. **Command-line flags** (highest priority)
199
+ 2. **Environment variables** (`GEMINI_API_KEY`, `VERTEX_API_KEY`, etc.)
200
+ 3. **Config file** (`~/.gimage/config.md`)
201
+ 4. **Default values** (lowest priority)
202
+
203
+ **Recommended**: Use environment variables for sensitive keys. Config file stores keys in **plaintext**.
204
+
205
+ ### Config File
206
+
207
+ Location: `~/.gimage/config.md` (created automatically by `gimage auth` commands)
208
+
209
+ **Security Notes**:
210
+ - File permissions: 0600 (only you can read/write)
211
+ - Contains PLAINTEXT API keys
212
+ - **NEVER commit to version control**
213
+ - **PREFER environment variables** over config file
214
+ - Use `gimage auth status` to check for conflicting credentials
215
+
216
+ Format (markdown with `**key**: value`):
217
+ ```markdown
218
+ # Gimage Configuration
219
+
220
+ ⚠️ SECURITY WARNING ⚠️
221
+ This file contains SENSITIVE API KEYS stored in PLAINTEXT.
222
+
223
+ **gemini_api_key**: your-gemini-key
224
+ **vertex_api_key**: your-vertex-key
225
+ **vertex_project**: your-gcp-project
226
+ **vertex_location**: us-central1
227
+ **vertex_credentials_path**: /path/to/service-account.json
228
+ **aws_access_key_id**: AKIA...
229
+ **aws_secret_access_key**: wJalr...
230
+ **aws_region**: us-east-1
231
+ **aws_profile**: default
232
+ **aws_bedrock_api_key**: bearer-token
233
+ **default_api**: gemini
234
+ **default_model**: gemini-2.5-flash-image
235
+ **default_size**: 1024x1024
236
+ **log_level**: info
237
+ ```
238
+
239
+ ### Environment Variables (Recommended)
240
+
241
+ **Gemini API**:
242
+ ```bash
243
+ export GEMINI_API_KEY="your-key"
244
+ ```
245
+
246
+ **Vertex AI** (3 authentication modes):
247
+ ```bash
248
+ # Option 1: Express Mode (REST) - Simplest
249
+ export VERTEX_API_KEY="your-key"
250
+ export VERTEX_PROJECT="your-project-id"
251
+ export VERTEX_LOCATION="us-central1"
252
+
253
+ # Option 2: Service Account - Production
254
+ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
255
+ export VERTEX_PROJECT="your-project-id"
256
+
257
+ # Option 3: Application Default Credentials - gcloud SDK
258
+ # No env vars needed - uses gcloud auth
259
+ ```
260
+
261
+ **AWS Bedrock** (4 authentication modes):
262
+ ```bash
263
+ # Option 1: REST API with Bearer Token
264
+ export AWS_BEARER_TOKEN_BEDROCK="your-bearer-token"
265
+ export AWS_REGION="us-east-1"
266
+
267
+ # Option 2: SDK with Access Keys (supports both long-term and short-term credentials)
268
+ export AWS_ACCESS_KEY_ID="AKIA..." # Long-term access key ID
269
+ export AWS_SECRET_ACCESS_KEY="wJalr..." # Long-term secret access key
270
+ export AWS_SESSION_TOKEN="FwoGZXIvYXd..." # Optional: for short-term credentials
271
+ export AWS_REGION="us-east-1"
272
+
273
+ # Option 3: SDK with Named Profile
274
+ export AWS_PROFILE="your-profile-name"
275
+ export AWS_REGION="us-east-1"
276
+
277
+ # Option 4: SDK with IAM Role (Lambda/EC2/ECS - no credentials needed)
278
+ # Instance/task role automatically provides credentials
279
+ export AWS_REGION="us-east-1" # Optional, defaults to instance region
280
+ ```
281
+
282
+ **Check credential conflicts**:
283
+ ```bash
284
+ gimage auth status # Shows which credentials are active and their sources
285
+ ```
286
+
287
+ ## Available Models
288
+
289
+ ### Gemini API (Google AI Studio) - FREE Tier
290
+ - **`gemini-2.5-flash-image`** (default, recommended)
291
+ - FREE: 1500 requests/day, no credit card required
292
+ - Resolution: up to 1024x1024
293
+ - Fast generation (~2-3 seconds)
294
+ - Best for: Quick iterations, development, testing
295
+
296
+ - **`gemini-2.0-flash-preview-image-generation`**
297
+ - FREE: 1500 requests/day
298
+ - Preview model with experimental features
299
+
300
+ ### Vertex AI (Google Cloud) - Paid
301
+ - **`imagen-3.0-generate-002`** (Imagen 3)
302
+ - Pricing: ~$0.02-0.04/image
303
+ - Resolution: up to 1536x1536
304
+ - High quality, production-ready
305
+
306
+ - **`imagen-4`** (newest, highest quality)
307
+ - Pricing: ~$0.04/image
308
+ - Resolution: up to 2048x2048
309
+ - Best for: Professional work, final production images
310
+
311
+ ### AWS Bedrock - Paid
312
+ - **`amazon.nova-canvas-v1:0`** (Nova Canvas)
313
+ - Resolution: up to 1408x1408
314
+ - Standard quality: 50 steps, $0.04/image
315
+ - Premium quality: 100 steps, $0.08/image
316
+ - Best for: AWS-integrated applications
317
+
318
+ **View all models with live pricing:**
319
+ ```bash
320
+ gimage generate --list-models
321
+ # or
322
+ gimage auth list # Shows configured providers
323
+ ```
324
+
325
+ ## Image Formats Supported
326
+
327
+ **Input & Output**: PNG, JPEG, WebP, GIF, TIFF, BMP
328
+
329
+ All processing operations preserve format by default, or you can specify output format with `--output` flag or use the `convert` command.
330
+
331
+ ## Advanced Features
332
+
333
+ ### Styles (Generation)
334
+ - `photorealistic` - Realistic photos
335
+ - `artistic` - Artistic interpretations
336
+ - `anime` - Anime/manga style
337
+
338
+ ### Quality Settings
339
+ - Compression quality: 1-100 (default: 90)
340
+ - Resampling: Lanczos algorithm (highest quality)
341
+ - Transparency: Preserved for PNG, white background for JPEG
342
+
343
+ ### Batch Processing
344
+ - Default: 4 parallel workers
345
+ - Configurable with `--workers` flag
346
+ - Processes entire directories
347
+ - Preserves directory structure with `--output`
348
+
349
+ ## Use Cases
350
+
351
+ ### For Designers & Artists
352
+ - Rapid prototyping of visual concepts
353
+ - Generate variations of ideas
354
+ - Quick image editing and optimization
355
+ - Batch resize for different platforms
356
+
357
+ ### For Developers
358
+ - Generate placeholder images for apps
359
+ - Automate image processing pipelines
360
+ - Integrate AI generation into workflows
361
+ - Test with reproducible images (seeds)
362
+
363
+ ### For Content Creators
364
+ - Create social media graphics
365
+ - Generate blog post illustrations
366
+ - Batch optimize images for web
367
+ - Convert formats for different platforms
368
+
369
+ ### For AI/ML Engineers
370
+ - Generate training data
371
+ - Create synthetic datasets
372
+ - Automate image augmentation
373
+ - Integrate with Claude via MCP server
374
+
375
+ ## MCP Server for AI Assistants
376
+
377
+ Gimage can run as an MCP (Model Context Protocol) server, enabling AI assistants like Claude to generate and process images directly. The server communicates over stdio using the MCP protocol and exposes 10 tools for image generation and processing.
378
+
379
+ ### Installation Methods
380
+
381
+ There are two ways to install gimage for use with Claude Desktop. Choose based on your use case:
382
+
383
+ #### Method 1: Homebrew (Recommended - macOS/Linux only)
384
+
385
+ **Use this if:** You want both CLI access AND MCP server functionality from a single installation.
386
+
387
+ **Step 1: Install gimage via Homebrew**
388
+ ```bash
389
+ brew install apresai/tap/gimage
390
+ gimage --version # Verify installation
391
+ ```
392
+
393
+ **Step 2: Configure Claude Desktop MCP**
394
+
395
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `~/.config/Claude/claude_desktop_config.json` (Linux):
396
+
397
+ ```json
398
+ {
399
+ "mcpServers": {
400
+ "gimage": {
401
+ "command": "gimage",
402
+ "args": ["serve"]
403
+ }
404
+ }
405
+ }
406
+ ```
407
+
408
+ **Why this method?**
409
+ - ✅ Single installation serves both CLI and MCP
410
+ - ✅ Easy updates: `brew upgrade apresai/tap/gimage`
411
+ - ✅ Directly calls the `gimage` binary in your PATH
412
+ - ✅ Smaller total footprint (one binary)
413
+
414
+ #### Method 2: npm Package (Cross-platform alternative)
415
+
416
+ **Use this if:** You're on Windows, don't use Homebrew, or only want MCP functionality (no CLI needed).
417
+
418
+ **Step 1: Install via npm**
419
+ ```bash
420
+ npm install -g @apresai/gimage-mcp
421
+ ```
422
+
423
+ **Step 2: Configure Claude Desktop MCP**
424
+
425
+ Edit your Claude Desktop config file:
426
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
427
+ - **Linux**: `~/.config/Claude/claude_desktop_config.json`
428
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
429
+
430
+ ```json
431
+ {
432
+ "mcpServers": {
433
+ "gimage": {
434
+ "command": "npx",
435
+ "args": ["-y", "@apresai/gimage-mcp"]
436
+ }
437
+ }
438
+ }
439
+ ```
440
+
441
+ **Why this method?**
442
+ - ✅ Works on Windows (Homebrew method doesn't)
443
+ - ✅ npm-based workflow (familiar to Node.js users)
444
+ - ✅ `npx` automatically downloads/runs the correct version
445
+ - ⚠️ Note: npm installs gimage ONLY for MCP use (hidden in npm global directory)
446
+ - ⚠️ If you want CLI access too, you'll need to install via Homebrew separately
447
+
448
+ **Configuration difference explained:**
449
+ - **Homebrew**: Uses `"command": "gimage"` - directly calls the binary in your PATH
450
+ - **npm**: Uses `"command": "npx"` - npx finds and runs the npm-installed package
451
+
452
+ ### Setup Authentication
453
+
454
+ Before using the MCP server, configure your API credentials:
455
+
456
+ ```bash
457
+ # Quick start with Gemini (FREE tier)
458
+ gimage auth setup gemini
459
+
460
+ # Or use environment variable (more secure):
461
+ export GEMINI_API_KEY="your-api-key-here"
462
+
463
+ # Verify configuration
464
+ gimage auth status
465
+ gimage auth test gemini
466
+ ```
467
+
468
+ The MCP server automatically uses credentials from:
469
+ 1. **Environment variables** - `GEMINI_API_KEY`, `VERTEX_API_KEY`, `AWS_ACCESS_KEY_ID`, etc. (RECOMMENDED for security)
470
+ 2. **Config file** - `~/.gimage/config.md` (created by `gimage auth setup` commands)
471
+
472
+ **Best Practice**: Use environment variables for production - they're more secure than storing credentials in config files.
473
+
474
+ ### Start Using with Claude
475
+
476
+ After installation and authentication, restart Claude Desktop. You can then use natural language:
477
+
478
+ ```
479
+ "Generate an image of a sunset over mountains"
480
+ "Resize photo.jpg to 800x600"
481
+ "Compress all images in the photos directory to 85% quality"
482
+ "Create a 2048x2048 photorealistic image of a wise old wizard"
483
+ ```
484
+
485
+ ### Available MCP Tools
486
+
487
+ The MCP server exposes 10 tools for AI assistants:
488
+
489
+ | Tool | Purpose |
490
+ |------|---------|
491
+ | `generate_image` | AI image generation from text |
492
+ | `resize_image` | Resize to specific dimensions |
493
+ | `scale_image` | Scale by factor (maintain aspect ratio) |
494
+ | `crop_image` | Crop to specific region |
495
+ | `compress_image` | Reduce file size with quality control |
496
+ | `convert_image` | Convert between formats |
497
+ | `batch_resize` | Resize multiple images concurrently |
498
+ | `batch_compress` | Compress multiple images |
499
+ | `batch_convert` | Convert multiple images to new format |
500
+ | `list_models` | List available AI models |
501
+
502
+ ### Troubleshooting MCP Server
503
+
504
+ If the MCP server isn't working in Claude Desktop:
505
+
506
+ 1. **Verify gimage is installed and in PATH:**
507
+ ```bash
508
+ which gimage
509
+ gimage --version
510
+ ```
511
+
512
+ 2. **Test the serve command directly:**
513
+ ```bash
514
+ gimage serve --verbose
515
+ ```
516
+ This will show detailed logging to stderr. Press Ctrl+C to stop.
517
+
518
+ 3. **Verify API credentials are configured:**
519
+ ```bash
520
+ gimage auth status # Check all configured credentials
521
+ ```
522
+
523
+ 4. **Test image generation works outside MCP:**
524
+ ```bash
525
+ gimage generate "test image"
526
+ ```
527
+
528
+ 5. **Check Claude Desktop logs** for error messages:
529
+ - **macOS**: `~/Library/Logs/Claude/`
530
+ - **Linux**: `~/.config/Claude/logs/`
531
+
532
+ 6. **Ensure config file exists and has correct permissions:**
533
+ ```bash
534
+ ls -la ~/.gimage/config.md
535
+ ```
536
+ Should be readable (permissions: `-rw-------` or `-rw-r--r--`)
537
+
538
+ ### Environment Variables
539
+
540
+ The MCP server respects the same environment variables as the CLI. See [Configuration](#configuration) for complete list of supported variables for all authentication modes (Gemini, Vertex AI, AWS Bedrock).
541
+
542
+ ### MCP Documentation
543
+
544
+ For comprehensive guides and examples:
545
+
546
+ - **Usage Guide**: [docs/MCP_USAGE.md](docs/MCP_USAGE.md) - Complete setup and usage
547
+ - **Tool Reference**: [docs/MCP_TOOLS.md](docs/MCP_TOOLS.md) - Detailed tool documentation
548
+ - **Examples**: [docs/MCP_EXAMPLES.md](docs/MCP_EXAMPLES.md) - Real-world workflows
549
+ - **Implementation Plan**: [mcp.md](mcp.md) - Complete MCP architecture and implementation details
550
+
551
+ ## Command Reference
552
+
553
+ See [COMMANDS.md](COMMANDS.md) for complete command reference and detailed usage examples.
554
+
555
+ **Available commands**:
556
+ - `generate` - AI image generation from text prompts
557
+ - `resize` - Resize images to specific dimensions
558
+ - `scale` - Scale images by a factor
559
+ - `crop` - Crop images to specific regions
560
+ - `compress` - Compress images to reduce file size (JPG, WebP)
561
+ - `convert` - Convert images between formats
562
+ - `auth` - Configure and manage API credentials (setup, status, list, test)
563
+ - `serve` - Start MCP server for Claude Desktop (includes batch operations)
564
+ - `tui` - Launch interactive terminal UI
565
+
566
+ **Removed commands** (use alternatives):
567
+ - `batch` - Use MCP server or shell scripts (see [Batch Processing](#batch-processing))
568
+ - `config` - Use `auth` commands for configuration
569
+
570
+ Run `gimage [command] --help` for detailed usage of any command.
571
+
572
+ ---
573
+
574
+ ## Go SDK
575
+
576
+ A type-safe Go SDK is auto-generated from the OpenAPI specification.
577
+
578
+ ### Installation
579
+
580
+ ```bash
581
+ go get github.com/apresai/gimage/sdk/go
582
+ ```
583
+
584
+ ### Usage
585
+
586
+ ```go
587
+ import gimage "github.com/apresai/gimage/sdk/go"
588
+
589
+ // Create client with API key authentication
590
+ client, _ := gimage.NewClient(
591
+ "https://your-api.execute-api.us-east-1.amazonaws.com/production",
592
+ gimage.WithRequestEditorFn(func(ctx context.Context, req *http.Request) error {
593
+ req.Header.Set("x-api-key", "your-api-key")
594
+ return nil
595
+ }),
596
+ )
597
+
598
+ // Generate image
599
+ resp, _ := client.GenerateImage(ctx, gimage.GenerateImageJSONRequestBody{
600
+ Prompt: "sunset over mountains",
601
+ Model: stringPtr("gemini-2.5-flash-image"),
602
+ Size: stringPtr("1024x1024"),
603
+ })
604
+ ```
605
+
606
+ ### Features
607
+
608
+ - ✅ **Type-safe**: All types generated from OpenAPI spec
609
+ - ✅ **Auto-complete**: Full IDE support with godoc
610
+ - ✅ **API Gateway ready**: Built-in API key authentication support
611
+ - ✅ **Easy to use**: Idiomatic Go patterns
612
+
613
+ ### Generating the SDK
614
+
615
+ The SDK is auto-generated from `openapi.yaml`:
616
+
617
+ ```bash
618
+ # One-time: Install oapi-codegen
619
+ make install-sdk-tools
620
+
621
+ # Generate SDK
622
+ make generate-sdk
623
+
624
+ # Clean generated files
625
+ make clean-sdk
626
+ ```
627
+
628
+ **Documentation**: See `sdk/go/README.md` for complete guide and examples.
629
+
630
+ ---
631
+
632
+ ## Lambda API Distribution
633
+
634
+ Deploy Gimage as a serverless REST API on AWS Lambda for web application integration.
635
+
636
+ ### Features
637
+
638
+ - **Serverless Architecture**: AWS Lambda on ARM64/Graviton2 (provided.al2023 runtime)
639
+ - **Auto-Scaling**: Handles 0 to thousands of requests automatically
640
+ - **Cost-Effective**: Pay only for what you use (~$0.25/month for 10K requests)
641
+ - **S3 Storage**: Automatic S3 bucket for image storage with presigned URLs
642
+ - **Production-Ready**: Full CORS, error handling, monitoring
643
+ - **API Gateway Integration**: Managed API keys, usage plans, rate limiting
644
+
645
+ ### Quick Deploy
646
+
647
+ **Option 1: Using gimage-deploy tool (Recommended)**
648
+
649
+ ```bash
650
+ # Build Lambda function
651
+ make build-lambda
652
+ make package-lambda
653
+
654
+ # Deploy using gimage-deploy (from sibling directory)
655
+ cd ../gimage-deploy
656
+ ./bin/gimage-deploy deploy \
657
+ --id production \
658
+ --stage production \
659
+ --region us-east-1 \
660
+ --lambda-code ../gimage/bin/lambda.zip \
661
+ --memory 512 \
662
+ --timeout 30
663
+
664
+ # Create API key
665
+ ./bin/gimage-deploy keys create --name prod-key --deployment production
666
+ ```
667
+
668
+ **Option 2: Manual deployment**
669
+
670
+ See [lambda.md](lambda.md) for manual deployment guide with AWS CLI.
671
+
672
+ ### Deployment Tool
673
+
674
+ The `gimage-deploy` CLI tool (separate project) provides complete deployment management:
675
+ - One-command deployment to AWS Lambda
676
+ - API Gateway configuration with API keys
677
+ - Monitoring (logs, metrics, health checks)
678
+ - Interactive TUI for management
679
+ - No hardcoded account IDs - works in any AWS account
680
+
681
+ See the `gimage-deploy` directory for the deployment management tool.
682
+
683
+ ### API Endpoints
684
+
685
+ All operations available via REST API:
686
+
687
+ | Endpoint | Method | Purpose |
688
+ |----------|--------|---------|
689
+ | `/generate` | POST | AI image generation |
690
+ | `/resize` | POST | Resize to dimensions |
691
+ | `/scale` | POST | Scale by factor |
692
+ | `/crop` | POST | Crop region |
693
+ | `/compress` | POST | Compress with quality |
694
+ | `/convert` | POST | Convert format |
695
+ | `/batch` | POST | Process multiple images |
696
+ | `/health` | GET | Health check |
697
+ | `/docs` | GET | **Interactive Swagger UI documentation** |
698
+ | `/openapi.yaml` | GET | OpenAPI specification |
699
+
700
+ **Try the API**: After deployment, visit `https://your-api-url/prod/docs` for interactive documentation!
701
+
702
+ ### Integration Examples
703
+
704
+ **TypeScript/JavaScript:**
705
+ ```typescript
706
+ const response = await fetch('https://your-api-url/generate', {
707
+ method: 'POST',
708
+ headers: { 'Content-Type': 'application/json' },
709
+ body: JSON.stringify({
710
+ prompt: 'a sunset over mountains',
711
+ size: '1024x1024',
712
+ response_format: 's3_url'
713
+ })
714
+ });
715
+
716
+ const result = await response.json();
717
+ console.log('Image URL:', result.s3_url);
718
+ ```
719
+
720
+ **Python:**
721
+ ```python
722
+ import requests
723
+
724
+ response = requests.post('https://your-api-url/resize', json={
725
+ 'image': base64_image,
726
+ 'width': 800,
727
+ 'height': 600
728
+ })
729
+
730
+ result = response.json()
731
+ print(f"Resized: {result['width']}x{result['height']}")
732
+ ```
733
+
734
+ **Go:**
735
+ ```go
736
+ client := gimage.NewClient("https://your-api-url", apiKey)
737
+ result, err := client.GenerateImage(gimage.GenerateRequest{
738
+ Prompt: "beautiful landscape",
739
+ Size: "1024x1024",
740
+ })
741
+ ```
742
+
743
+ ### Documentation
744
+
745
+ - **Deployment Guide**: [lambda.md](lambda.md) - Complete deployment and infrastructure setup
746
+ - **Integration Guide**: [INTEGRATION_GUIDE.md](INTEGRATION_GUIDE.md) - Client SDKs & examples
747
+ - **OpenAPI Spec**: [openapi.yaml](openapi.yaml) - Complete API reference
748
+
749
+ ### Architecture
750
+
751
+ ```
752
+ Client Request → API Gateway → Lambda (Go/ARM64) → {S3, Gemini, Vertex AI}
753
+
754
+ Small: base64 response
755
+ Large: S3 presigned URL
756
+ ```
757
+
758
+ **Runtime**: AWS Lambda provided.al2023 (Amazon Linux 2023)
759
+ **Architecture**: ARM64 (Graviton2 processors)
760
+ **Package Size**: 17MB compressed, 42MB uncompressed
761
+ **Memory**: 2GB (configurable)
762
+ **Timeout**: 5 minutes max
763
+
764
+ ---
765
+
766
+ ## Building from Source
767
+
768
+ ### CLI Binary
769
+
770
+ ```bash
771
+ git clone https://github.com/apresai/gimage.git
772
+ cd gimage
773
+ make build
774
+ ./bin/gimage --version
775
+ ```
776
+
777
+ ### Lambda Function
778
+
779
+ ```bash
780
+ # Build for AWS Lambda ARM64
781
+ make build-lambda
782
+
783
+ # Package as deployment zip
784
+ make package-lambda
785
+
786
+ # Output: bin/lambda.zip (17MB)
787
+ ```
788
+
789
+ ## Requirements
790
+
791
+ ### CLI
792
+ - **None!** Single static binary with zero dependencies
793
+ - Works on: macOS, Linux, Windows (x86_64, ARM64)
794
+ - No Python, no Node.js, no system libraries required
795
+
796
+ ### Lambda API
797
+ - AWS Account
798
+ - AWS CLI configured
799
+ - Node.js 20+ (for CDK deployment)
800
+ - Go 1.22+ (for building)
801
+
802
+ ## Support & Documentation
803
+
804
+ ### CLI
805
+ - **Full Command Reference**: [COMMANDS.md](COMMANDS.md)
806
+ - **Configuration Guide**: See `gimage auth --help`
807
+
808
+ ### Lambda API
809
+ - **OpenAPI Specification**: [openapi.yaml](openapi.yaml)
810
+ - **Integration Guide**: [INTEGRATION_GUIDE.md](INTEGRATION_GUIDE.md)
811
+ - **Deployment Guide**: [lambda.md](lambda.md)
812
+ - **Implementation Status**: [LAMBDA_STATUS.md](LAMBDA_STATUS.md)
813
+
814
+ ### Community
815
+ - **GitHub Issues**: https://github.com/apresai/gimage/issues
816
+ - **Discussions**: https://github.com/apresai/gimage/discussions
817
+
818
+ ## License
819
+
820
+ MIT License - see [LICENSE](LICENSE) file for details.
821
+
822
+ ## Credits
823
+
824
+ Built with:
825
+ - [Cobra](https://github.com/spf13/cobra) - CLI framework
826
+ - [Imaging](https://github.com/disintegration/imaging) - Image processing
827
+ - [Google Gen AI SDK](https://github.com/googleapis/go-genai) - Gemini API
828
+ - [Vertex AI SDK](https://cloud.google.com/go/vertexai) - Vertex AI
829
+ - [AWS SDK for Go](https://github.com/aws/aws-sdk-go-v2) - AWS Bedrock
830
+
831
+ ---
832
+
833
+ **Made with ❤️ for developers, designers, and AI enthusiasts**