Skip to main content

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

ProviderModelAPI EndpointNotes
OpenAIDALL-E 3api.openai.com/v1/images/generations1024x1024, returns URL + revised prompt
xAIGrok 2 Imageapi.x.ai/v1/images/generationsReturns URL or base64 data
OpenRouterVariousopenrouter.ai/api/v1/images/generationsAccess to multiple image generation models
info

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:

PatternRegexExample
/image command/^\/image\s+/i/image a mountain landscape at dawn
"generate image"/^generate\s+(?:an?\s+)?image\s+(?:of\s+)?/igenerate an image of a robot
"draw"/^draw\s+/idraw a dragon flying over a castle
"create image"/^create\s+(?:an?\s+)?image\s+(?:of\s+)?/icreate 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.

tip

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) and X-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:

  1. The image appears inline in the chat as an <img> tag in the assistant's response
  2. If the provider returned a revised prompt (DALL-E 3 does this), it is displayed above the image
  3. 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.

warning

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:

ErrorCauseFix
"Set your API key for provider"No API key configuredAdd 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 providerSwitch to OpenAI, xAI, or OpenRouter
warning

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:

  1. Per-bot key from the profile system (AIS.Profiles.resolveApiKey())
  2. 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

  1. Be specific: "A golden retriever puppy playing in autumn leaves, warm sunlight, shallow depth of field" produces better results than "a dog"
  2. Specify style: Add art style descriptors like "oil painting", "watercolor", "photorealistic", "3D render", "pixel art"
  3. Include composition details: Mention lighting, angle, mood, and background
  4. Describe what you want, not what you don't want: Positive descriptions work better than "no X" or "without Y"
  5. Use the revised prompt: DALL-E 3 shows its revised interpretation -- use it to understand how to write better prompts

Provider Comparison

FeatureDALL-E 3 (OpenAI)Grok 2 Image (xAI)OpenRouter
Resolution1024x1024VariesModel-dependent
Revised PromptYesNoNo
Text in ImagesGoodVariesModel-dependent
PhotorealismExcellentGoodModel-dependent
API KeyOpenAI key requiredxAI key requiredOpenRouter key required