happycapy-ai/happycapy-skills/generate-image
Claude Code and agent skill by happycapy-ai/happycapy-skills
- community
Checking that the SKILL.md file is still in the repository.
Generate and transform images using AI Gateway API. Use when the user asks to create, generate, produce, or transform images, or work with image generation.
Install
npx vskill@latest install happycapy-ai/happycapy-skills/generate-imageSKILL.md
Image Generation Skill
Generate images from text prompts and transform existing images using the AI Gateway API with support for multiple AI models including Google Gemini, Byteplus Seedream, and OpenAI GPT-Image.
Overview
This Skill enables Claude to generate images from text descriptions and transform existing images with AI-powered modifications. It uses the AI Gateway API which routes requests to appropriate providers based on the model selected.
Prerequisites
Required Environment Variable:
AI_GATEWAY_API_KEY: Your AI Gateway API key
If this environment variable is not set, the scripts will fail with an error message asking you to provide it.
Quick Start
Generate an Image from Text
Use the bundled script to generate images from text descriptions:
Transform an Existing Image
Apply transformations to existing images using reference URLs:
Supported Models
Image Generation Models
| Model | Provider | Best For | |
|---|---|---|---|
google/gemini-3.1-flash-image-preview | Google Vertex AI | Latest fast image generation with improved quality | |
google/gemini-3-pro-image-preview | Google Vertex AI | High-quality photorealistic images | |
google/gemini-2.5-flash-image | Google Vertex AI | Fast image generation | |
byteplus/seedream-4-5 | Byteplus Seedream | Creative artistic styles | |
byteplus/seedream-4-0 | Byteplus Seedream | General purpose image generation | |
openai/gpt-image-1 | OpenAI | Advanced image synthesis | |
openai/gpt-image-1-mini | OpenAI | Quick image generation | |
openai/gpt-image-1.5 | OpenAI | Enhanced image synthesis | |
openai/gpt-image-2 | OpenAI | Latest generation, multi-aspect ratio support |
API Parameters
Image Generation
prompt(required): Text description of the desired imagemodel(required): Model to use for generationimages(optional): Array of reference image URLs for image-to-image transformationresponse_format(optional): "url" (default) or "b64_json"n(optional): Number of images to generate (default: 1)size(optional): Image dimensions (e.g., "1024x1024", "1792x1024", "1024x1792", "1536x1024", "1024x1536")aspectRatio(optional): Aspect ratio — alternative tosize. Supported values:"1:1","16:9","9:16","3:2","2:3","4:3","3:4","3:1","1:3"background(optional, OpenAI models only):"transparent"|"opaque"|"auto"— controls background transparencyuser(optional): User identifier for tracking
OpenAI gpt-image-2 / gpt-image-1.5 Parameters
These models support the full parameter set above. Key notes:
- Supports all aspect ratios via
aspectRatiofield - Supports
background: "transparent"for PNG output with transparency - Use
response_format: "b64_json"to receive raw image data; use"url"for a hosted URL - Image editing (passing
images) routes to the/images/editsendpoint automatically
Bundled Scripts
1. generate_image.py
Generate images from text prompts with customizable parameters.
Usage:
Options:
--model: Model to use (default: google/gemini-3.1-flash-image-preview)--output: Output file path (default: generated_image.png)--format: Response format - "url" or "b64_json" (default: b64_json)
Example:
2. transform_image.py
Transform existing images using AI with text instructions.
Usage:
Example:
3. batch_generate.py
Generate multiple images in batch.
Usage:
Example prompts.txt:
Implementation Notes
When implementing image generation tasks:
- Always use JavaScript for API calls when writing custom code
- Check for API Key at the start:
``javascript const apiKey = process.env.AI_GATEWAY_API_KEY; if (!apiKey) { throw new Error('AI_GATEWAY_API_KEY environment variable is required. Please set it with your AI Gateway API key.'); } ``
- Use the bundled Python scripts for quick generation tasks rather than writing custom code
- Include Origin header in all API requests: Set
Origin: https://trickle.soheader for proper request routing
- Handle both streaming and non-streaming responses appropriately
- Save generated images to appropriate file paths and inform the user
JavaScript Implementation Template
When you need to write custom JavaScript code for image generation:
Error Handling
All scripts include comprehensive error handling for:
- Missing API key
- Network failures
- Invalid responses
- File I/O errors
Errors will include helpful messages to guide troubleshooting.
Best Practices
- Be Specific in Prompts: Include style, mood, lighting, and composition details
- Use Appropriate Models: Choose models based on your quality vs. speed requirements
- Reference Images: Use image-to-image transformation for style transfer or modifications
- Batch Processing: Use the batch script for multiple generations to save time
- Save Outputs: Always specify meaningful output file names for organization
Troubleshooting
"AI_GATEWAY_API_KEY environment variable is required"
Set the environment variable before running scripts:
Network Errors
Check your internet connection and verify the API Gateway is accessible.
Invalid Model Errors
Ensure you're using a valid model name from the supported models list above.
Additional Resources
For more details on API parameters and response formats, see the API documentation at the AI Gateway repository.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/generate-image/SKILL.md
Popularity
- Repository stars
- 137
- Repository forks
- 30
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/happycapy-ai/happycapy-skills/generate-image)