name: t2i version: 1.2.1 description: 'Use the t2i CLI to generate AI images from text prompts via Microsoft Foundry providers (FLUX.2, MAI-Image-2). Activate when the user asks to generate images, automate image creation in scripts, or set up image generation for CI/CD.' author: Bruno Capuano bruno@elbruno.com license: MIT tags: - text-to-image - image-generation - foundry - ai - cli - dotnet-tool - dotnet inputs: - prompt: string, required, text description of the image to generate - provider: string, optional, image generation provider (foundry-flux2 or foundry-mai2), default foundry-flux2 - output: string, optional, output file path for the generated image - width: integer, optional, image width in pixels, default 512 - height: integer, optional, image height in pixels, default 512 - steps: integer, optional, number of inference steps, default 20 outputs: - image: PNG file saved to specified output path or auto-generated filename - status: generation success/failure with error details on failure requirements: - dotnet-tool: ElBruno.Text2Image.Cli >=1.2.0 - runtime: '.NET 8.0 or .NET 10.0' entrypoint: t2i
t2i — Text-to-Image CLI Skill
This skill teaches AI agents (GitHub Copilot, Claude Code, and MCP-aware assistants) how to use the t2i command-line tool for image generation. Learn the commands, workflows, and best practices for automating text-to-image tasks in scripts and terminal environments.
When to Use This Skill
Activate this skill when:
- User asks to generate an image from a text prompt
- User mentions text-to-image, image generation, or AI images
- User wants to automate image generation in a script or pipeline
- User needs batch image generation across multiple prompts
- User is setting up image generation for CI/CD or deployment workflows
- User requests help with t2i command syntax or configuration
Quick Reference
| Command | Purpose |
|---|---|
t2i config |
Interactive setup wizard (provider, API keys) |
t2i "<prompt>" |
Generate one image from a text prompt |
t2i "<prompt>" --provider <p> --output <file> |
Generate with specific provider and filename |
t2i providers |
List available image generation providers |
t2i secrets set <provider> |
Configure or rotate API credentials securely |
t2i secrets list |
Show stored secrets (redacted) |
t2i doctor |
Run diagnostics (config, API connectivity, secrets) |
t2i version |
Show version and commit SHA |
t2i init |
Write .github/skills/t2i/SKILL.md and .claude/skills/t2i/SKILL.md to current repo |
Providers
Two cloud providers available in the Lite edition:
| Provider | Model | Use For |
|---|---|---|
foundry-flux2 |
FLUX.2 Pro | High-quality images, fine-grained control, batch jobs |
foundry-mai2 |
MAI-Image-2 | Fast iteration, rich prompt understanding, synchronous API |
Default: foundry-flux2 if user doesn't specify --provider.
Common Workflows
1. First-Time Setup
# Step 1: Interactive config
t2i config
# Step 2: Enter API credentials when prompted
# (CLI stores securely via DPAPI on Windows, encrypted on macOS/Linux)
# Step 3: Verify connection
t2i doctor
# Step 4: Generate your first image
t2i "a robot painting a landscape"
Agent tip: If user skips t2i config, they'll get a "not configured" error. Always suggest running it first.
2. Generate One Image
# Basic: uses default provider and outputs to current directory
t2i "a cyberpunk city at night, neon lights"
# With custom filename
t2i "a robot waving" --output my-robot.png
# Specific provider and dimensions
t2i "minimalist line art of a cat" \
--provider foundry-mai2 \
--width 1024 \
--height 1024 \
--output cat.png
3. Batch Generate via Shell Loop
Bash:
#!/bin/bash
prompts=(
"a robot painting a landscape"
"a cyberpunk city at night"
"a watercolor painting of a castle"
)
for prompt in "${prompts[@]}"; do
echo "Generating: $prompt"
t2i "$prompt" --output "image-$(date +%s).png"
sleep 2 # rate limiting
done
PowerShell:
$prompts = @(
"a robot painting a landscape",
"a cyberpunk city at night",
"a watercolor painting of a castle"
)
foreach ($prompt in $prompts) {
Write-Host "Generating: $prompt"
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
& t2i $prompt --output "image-$timestamp.png"
Start-Sleep -Seconds 2 # rate limiting
}
Important Rules for Agents
Always verify config first — Before suggesting any image generation command, check if the user has run
t2i config. If they haven't, suggest it: "Runt2i configfirst to set up your provider and credentials."Never expose API keys — Do not include API keys, tokens, or secrets in code examples, commit messages, or logs. Always direct users to
t2i secrets setfor credential management.Use environment variables in CI/CD — For GitHub Actions, Azure Pipelines, or other CI systems, prefer setting
T2I_FOUNDRY_FLUX2_API_KEYorT2I_FOUNDRY_MAI2_API_KEYas secrets, not hardcoded in scripts.Default to foundry-flux2 — If the user doesn't specify a provider, use
foundry-flux2. It offers the best quality and control. Only suggestfoundry-mai2if the user prefers speed or has specific MAI compatibility needs.Use
--output <file>for predictable filenames — When scripting batch jobs, always specify--outputto ensure consistent, parseable filenames. Without it, images go togenerated_<random>.png.Run
t2i doctorto diagnose issues — If the user reports generation failures or API errors, always suggestt2i doctorfirst. It checks config, secrets, API connectivity, and permission issues in one command.Suggest
t2i initfor new repos — When onboarding a new project or repo, offer to runt2i initso future AI agents (Copilot, Claude Code) working on that repo will know how to use t2i.
Secrets & Security
Storage Priority (checked in this order):
- Environment variables —
T2I_<PROVIDER>_<FIELD>(best for CI/CD) - DPAPI (Windows) —
%LOCALAPPDATA%\t2i\secrets.dpapiencrypted per-user - Plaintext file (macOS/Linux) —
~/.config/t2i/secrets.jsonwith0600permissions
In CI/CD:
# GitHub Actions example
env:
T2I_FOUNDRY_FLUX2_API_KEY: ${{ secrets.T2I_API_KEY }}
T2I_FOUNDRY_FLUX2_ENDPOINT: ${{ secrets.T2I_ENDPOINT }}
steps:
- run: t2i "your prompt" --output image.png
For local development:
- Run
t2i secrets set foundry-flux2to store credentials securely - Never commit secrets files — add
~/.config/t2i/and%APPDATA%\t2i\to.gitignore
More Info
- Full documentation: docs/cli-tool.md
- GitHub repository: elbruno/ElBruno.Text2Image
- Package: NuGet: ElBruno.Text2Image.Cli
- Report issues: GitHub Issues