Image Generation
AI Supreme Council can generate images from text descriptions using AI image generation models. Describe what you want, and the model creates an image directly in your chat.
Supported Providers
| Provider | Model | API Endpoint | Notes |
|---|---|---|---|
| OpenAI | DALL-E 3 | api.openai.com/v1/images/generations | 1024x1024, returns URL + revised prompt |
| xAI | Grok 2 Image | api.x.ai/v1/images/generations | Returns URL or base64 data |
| OpenRouter | Various | openrouter.ai/api/v1/images/generations | Access to multiple image generation models |
You need an API key for the provider you want to use for image generation. The key is the same one used for chat -- no separate image generation key is needed.
How It Works
The platform automatically detects image generation requests from your message text. The AIS.ImageGen module checks every outgoing message against a set of trigger patterns before it reaches the LLM provider.
Trigger Patterns
Four regex patterns are checked against the start of your message:
| Pattern | Regex | Example |
|---|---|---|
/image command | /^\/image\s+/i | /image a mountain landscape at dawn |
| "generate image" | /^generate\s+(?:an?\s+)?image\s+(?:of\s+)?/i | generate an image of a robot |
| "draw" | /^draw\s+/i | draw a dragon flying over a castle |
| "create image" | /^create\s+(?:an?\s+)?image\s+(?:of\s+)?/i | create an image of a cozy cabin |
The patterns are case-insensitive and match from the start of the trimmed message. The optional words "a", "an", and "of" are handled gracefully in the generate/create patterns.
If your message is not being detected as an image request, prefix it with /image to ensure it triggers image generation. This is the most reliable trigger.
The /image Command
The explicit /image command is the recommended way to generate images:
/image a serene Japanese garden with cherry blossoms in spring
Everything after /image becomes the prompt sent to the image generation API. The /image prefix itself is stripped before the prompt is sent.
Provider-Specific Behavior
OpenAI (DALL-E 3)
The platform sends a request to OpenAI's images endpoint:
- Model:
dall-e-3(hardcoded) - Size:
1024x1024 - Count: 1 image per request
- Authentication: Bearer token (your OpenAI API key)
- Response: Returns a URL to the generated image and a
revised_prompt-- OpenAI's rewritten version of your prompt
The revised prompt is displayed above the image in the chat so you can see how DALL-E interpreted your request. This is useful for learning to write better prompts.
xAI (Grok 2 Image)
The platform sends a request to xAI's images endpoint:
- Model:
grok-2-image - Count: 1 image per request
- Format: Requests URL format (
response_format: 'url') - Authentication: Bearer token (your xAI API key)
- Response: Returns either a URL or base64-encoded PNG data. If base64 is returned, the platform converts it to a data URL for inline display.
OpenRouter
The platform sends a request to OpenRouter's images endpoint:
- Count: 1 image per request
- Headers: Includes
HTTP-Referer(your origin) andX-Title: aiscouncil - Authentication: Bearer token (your OpenRouter API key)
- Response: Returns a URL to the generated image
Generated Images
When an image is generated successfully:
- The image appears inline in the chat as an
<img>tag in the assistant's response - If the provider returned a revised prompt (DALL-E 3 does this), it is displayed above the image
- The image is stored in chat history and will appear when you reload the conversation
Downloading Images
Right-click (or long-press on mobile) the generated image and select "Save image as..." to download it. Generated images are standard web images (PNG or JPEG) served from the provider's CDN.
Image URLs from providers may expire. DALL-E 3 URLs are temporary. If you need to keep the image, download it soon after generation.
Error Handling
If image generation fails, an error message is thrown and displayed in the chat. Common issues:
| Error | Cause | Fix |
|---|---|---|
"Set your API key for provider" | No API key configured | Add your API key in Settings or the config panel |
"provider image status" | API returned an error (rate limit, content policy, etc.) | Check the error details, wait and retry, or rephrase the prompt |
"provider does not support image generation" | Using Anthropic, Gemini, Ollama, or another unsupported provider | Switch to OpenAI, xAI, or OpenRouter |
Image generation is only available when your bot's active provider is OpenAI, xAI, or OpenRouter. If you are using Anthropic, Gemini, DeepSeek, or Ollama, image generation commands will not work. The platform checks the current bot's provider and throws an error for unsupported providers.
API Key Resolution
The ImageGen module resolves API keys in this order:
- Per-bot key from the profile system (
AIS.Profiles.resolveApiKey()) - Global provider key from
localStorage(AIS.Auth.getApiKey())
If neither is found, the generation fails with a clear error message indicating which provider needs a key.
Tips for Effective Prompts
- Be specific: "A golden retriever puppy playing in autumn leaves, warm sunlight, shallow depth of field" produces better results than "a dog"
- Specify style: Add art style descriptors like "oil painting", "watercolor", "photorealistic", "3D render", "pixel art"
- Include composition details: Mention lighting, angle, mood, and background
- Describe what you want, not what you don't want: Positive descriptions work better than "no X" or "without Y"
- Use the revised prompt: DALL-E 3 shows its revised interpretation -- use it to understand how to write better prompts
Provider Comparison
| Feature | DALL-E 3 (OpenAI) | Grok 2 Image (xAI) | OpenRouter |
|---|---|---|---|
| Resolution | 1024x1024 | Varies | Model-dependent |
| Revised Prompt | Yes | No | No |
| Text in Images | Good | Varies | Model-dependent |
| Photorealism | Excellent | Good | Model-dependent |
| API Key | OpenAI key required | xAI key required | OpenRouter key required |