Generate Image logo

Generate Image

Community
happycapy-ai
generate-image

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.

Overview

Publisherhappycapy-ai
RepositoryHappycapy-skills
Skill namegenerate-image
Stars
138
Forks
30
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by happycapy-ai on GitHub. Read the source before you install it.

Installation

Install the Generate Image AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/happycapy-ai/Happycapy-skills.git /tmp/Happycapy-skills
mkdir -p .claude/skills
cp -r /tmp/Happycapy-skills/skills/generate-image .claude/skills/generate-image
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Generate Image in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Generate Image on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Generate Image is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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:

bash
python3 scripts/generate_image.py "A serene landscape with mountains and a lake at sunset, photorealistic style"

Transform an Existing Image

Apply transformations to existing images using reference URLs:

bash
python3 scripts/transform_image.py "Make this image more vibrant and add dramatic lighting" "https://example.com/image.jpg"

Supported Models

Image Generation Models

ModelProviderBest For
google/gemini-3.1-flash-image-previewGoogle Vertex AILatest fast image generation with improved quality
google/gemini-3-pro-image-previewGoogle Vertex AIHigh-quality photorealistic images
google/gemini-2.5-flash-imageGoogle Vertex AIFast image generation
byteplus/seedream-4-5Byteplus SeedreamCreative artistic styles
byteplus/seedream-4-0Byteplus SeedreamGeneral purpose image generation
openai/gpt-image-1OpenAIAdvanced image synthesis
openai/gpt-image-1-miniOpenAIQuick image generation
openai/gpt-image-1.5OpenAIEnhanced image synthesis
openai/gpt-image-2OpenAILatest generation, multi-aspect ratio support

API Parameters

Image Generation

  • prompt (required): Text description of the desired image
  • model (required): Model to use for generation
  • images (optional): Array of reference image URLs for image-to-image transformation
  • response_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 to size. 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 transparency
  • user (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 aspectRatio field
  • 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/edits endpoint automatically

Bundled Scripts

1. generate_image.py

Generate images from text prompts with customizable parameters.

Usage:

bash
python3 scripts/generate_image.py "prompt" [--model MODEL] [--output OUTPUT] [--format FORMAT]

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:

bash
python3 scripts/generate_image.py \
  "A futuristic city with flying cars at night, cyberpunk style" \
  --model "google/gemini-3.1-flash-image-preview" \
  --output "city.png"

2. transform_image.py

Transform existing images using AI with text instructions.

Usage:

bash
python3 scripts/transform_image.py "prompt" "image_url" [--model MODEL] [--output OUTPUT]

Example:

bash
python3 scripts/transform_image.py \
  "Make this image more vibrant and add dramatic sunset lighting" \
  "https://example.com/original.jpg" \
  --output "enhanced.png"

3. batch_generate.py

Generate multiple images in batch.

Usage:

bash
python3 scripts/batch_generate.py prompts.txt [--model MODEL]

Example prompts.txt:

A sunset over the ocean
A mountain landscape at dawn
A bustling city street at night

Implementation Notes

When implementing image generation tasks:

  1. Always use JavaScript for API calls when writing custom code

  2. 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.');
    }
  3. Use the bundled Python scripts for quick generation tasks rather than writing custom code

  4. Include Origin header in all API requests: Set Origin: https://trickle.so header for proper request routing

  5. Handle both streaming and non-streaming responses appropriately

  6. 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:

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.');
}

const API_BASE = `${process.env.AI_GATEWAY_BASE_URL}/api/v1`;

async function generateImage(prompt, model = 'google/gemini-3.1-flash-image-preview') {
  const response = await fetch(`${API_BASE}/images/generations`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${apiKey}`,
      'Origin': 'https://trickle.so'
    },
    body: JSON.stringify({
      model,
      prompt,
      response_format: 'url'
    })
  });

  if (!response.ok) {
    throw new Error(`API request failed: ${response.status} ${response.statusText}`);
  }

  return await response.json();
}

// Use the function
const result = await generateImage('A beautiful sunset over mountains');
console.log('Generated image URL:', result.data[0].url);

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

  1. Be Specific in Prompts: Include style, mood, lighting, and composition details
  2. Use Appropriate Models: Choose models based on your quality vs. speed requirements
  3. Reference Images: Use image-to-image transformation for style transfer or modifications
  4. Batch Processing: Use the batch script for multiple generations to save time
  5. 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:

bash
export AI_GATEWAY_API_KEY="your-api-key-here"

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.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Generate Image AI skill do?

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.

Why use Generate Image on TypingMind?

Because you install it once and use it with any model. Generate Image is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Generate Image in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/happycapy-ai/Happycapy-skills/tree/main/skills/generate-image. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Generate Image?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Generate Image?

As many as you like. As long as a model supports skills, you can use Generate Image with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Generate Image AI skill free?

Yes. It is published on GitHub by happycapy-ai under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇