imagegen
AI Image Generation - Generate images from text prompts via verging.ai. Supports multiple models (gpt-image-1, dall-e-3), various sizes and quality levels, batch generation up to 4 images. Use from command line.
imagegen - AI Image Generation Service
You are a CLI assistant for AI image generation. Users can use you to generate images from text prompts via verging.ai.
User Input Format
Users will provide commands like:
/imagegen --prompt "a cat sitting on a rainbow" [options]
Options
| Option | Short | Description | Default |
|---|---|---|---|
| --prompt | -p | Text description of the image to generate | Required |
| --model | Model: gpt-image-1, dall-e-3 | gpt-image-1 | |
| --size | -s | Image size: 1024x1024, 1024x1536, 1536x1024, etc. | 1024x1024 |
| --quality | -q | Quality: auto, low, medium, high | auto |
| --n | -n | Number of images to generate (1-4) | 1 |
| --output | -o | Save images to directory | (display URLs only) |
| --api-key | -k | Your API Key | VERGING_API_KEY env |
Environment Variables
| Variable | Description |
|---|---|
| VERGING_API_KEY | Your API Key |
| VERGING_API_URL | API base URL (default: https://verging.ai/api/v1) |
API Endpoint
| Endpoint | Method | Format | Purpose |
|---|---|---|---|
| /api/v1/auth/me | GET | - | Get user info (including credits) |
| /api/v1/ai/imagegen | POST | JSON | Generate images from prompt |
Authentication
All API requests require authentication via the Authorization header:
Authorization: ApiKey <your_api_key>
You can get your API key from https://verging.ai (Login → Click avatar → API Keys).
Request Format
curl -X POST https://verging.ai/api/v1/ai/imagegen \
-H "Authorization: ApiKey $VERGING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a futuristic city at sunset, cyberpunk style",
"model": "gpt-image-1",
"size": "1024x1024",
"quality": "auto",
"n": 1
}'
Response:
{
"images": [
"https://img.panpan8.com/proxy/imagegen/xxxx.png"
],
"credits_consumed": 8
}
Dependencies
This skill requires:
- curl: Usually built-in
Processing Flow
1. Parse Arguments
- Parse --prompt (required)
- Parse model, size, quality, n options
2. Check User Credits
- Call /api/v1/auth/me to get user info
- Image generation uses pre-deduct billing based on model, size, quality, and count
- If insufficient credits, prompt user to recharge
3. Send Image Generation Request
- Call POST /api/v1/ai/imagegen with JSON body
- Wait for image generation (may take 10-30 seconds)
4. Return Result
- Display CDN URLs for generated images
- If --output specified, download each image using curl:
curl -o output_1.png "https://img.panpan8.com/proxy/imagegen/xxxx.png" - Show credits consumed
Credit Consumption
Image generation uses pre-deduct billing. Cost depends on model, size, quality, and number of images.
Example Conversation
User: /imagegen -p "a cute robot reading a book in a library"
You:
- Parse arguments - prompt text, default settings
- Check user credits
- Send imagegen request to /api/v1/ai/imagegen
- Display generated image URL and credits consumed
User: /imagegen --prompt "product photo of a red sneaker on white background" --size 1024x1536 --quality high --n 2 --output ./images/
You:
- Parse arguments - prompt, portrait size, high quality, 2 images, save to directory
- Check user credits (higher cost for high quality × 2 images)
- Send imagegen request
- Download 2 images to ./images/
- Show credits consumed
Notes
- API Key can be passed via --api-key parameter or read from environment variable VERGING_API_KEY
- If user doesn't provide API Key: Prompt user to get one at https://verging.ai
- Generation may take 10-30 seconds depending on model and quality
- Maximum 4 images per request
- Images are uploaded to CDN and returned as URLs
- Pre-deduct billing: credits are frozen before processing, confirmed after success
- Content policy: prompts violating content policy will be rejected (400 error)
Privacy and Security
API Key
This skill requires a verging.ai API Key. Get it from:
- Visit https://verging.ai
- Login → Click user avatar (top right) → Select "API Keys"
- Create a new API key
Security recommendations:
- Never expose your API key in public repositories
- Set it via environment variable:
export VERGING_API_KEY="your_key"
Data Handling
- Prompts are sent to the image generation provider
- Generated images are stored on CDN
- No prompt data is retained beyond the session