Skip to content

Image Generation

Tarsk’s AI agent can create and find images during conversations. Switch to Image mode in the chat mode selector for image-focused tasks, or ask the agent directly in Build mode.

Ask the agent to create an image, and it will use the generate_image tool:

“Generate a hero image of a mountain landscape at sunset and save it to assets/hero.png”

The agent:

  1. Selects the first enabled image-capable model (or you can specify one)
  2. Sends the prompt to the image generation API
  3. Saves the resulting image to the file path you specified
  4. Returns the file path so you can reference it in your code

Image generation requires a model that supports image output. When browsing models in Provider Settings, use the Tools filter to identify compatible models. Supported models include:

  • DALL-E 3 (OpenAI)
  • GPT Image 1 (OpenAI)
  • OpenRouter image models (various providers)
  • Any model listed with image generation capability

Generated images are saved directly to your project directory. The save_to_file parameter specifies the relative path (e.g. assets/logo.png). Parent directories are created automatically.

If you want the media to appear directly in the conversation area, have the agent return the saved file path or a media URL plainly in its final response. The chat UI can render supported media inline.

If no image models are enabled, the agent automatically falls back to searching for a stock photo matching your prompt. This provides a reasonable alternative without requiring additional API keys.

You can also ask the agent to find an existing image instead of generating one:

“Find a stock photo of a team collaboration and save it to public/team.jpg”

The find_images tool searches a stock image API and returns matching results. You can specify the size:

SizeDescription
originalFull resolution
large2xExtra large (2x)
largeLarge
mediumMedium (default)
smallSmall
portraitPortrait orientation
landscapeLandscape orientation
tinyThumbnail size

Generated images in chat can be:

  • Copied to clipboard — for pasting into design tools or documents
  • Saved to a file — choose a destination path in the project

These options are available from the image preview actions in the chat.

  • App assets — “Generate an app icon with a blue gradient and white logo, save to public/icon.png”
  • Documentation — “Find a diagram showing microservices architecture, save to docs/architecture.png”
  • Marketing — “Generate a banner image for the landing page, save to assets/banner.jpg”
  • Mockups — “Generate a mockup of a mobile app login screen, save to design/login-mockup.png”
  • Be specific in your prompts for better results — describe colors, style, composition, and mood
  • If generation fails, check that you have an image-capable model enabled in Settings
  • Stock image search works without any API keys, making it a reliable fallback
  • Always specify the save_to_file path so images end up in the right directory