Skip to main content

Overview

Tool identifier image_generate. image_generate generates images from text. For image-to-image editing, see image_edit. Import path: from veadk.tools.builtin_tools.image_generate import image_generate

Environment & prerequisites

Requirements:
  1. Configure the API key for the agent’s reasoning model.
  2. Configure the image-generation model name (MODEL_IMAGE_NAME).
Environment variables:
  • MODEL_IMAGE_API_KEY: API key for the image-generation model; falls back to MODEL_AGENT_API_KEY and then to model.api_key from the config file when unset
  • MODEL_AGENT_API_KEY: API key for the agent’s reasoning model
  • MODEL_IMAGE_NAME: image-generation model name
  • MODEL_IMAGE_API_BASE: image-generation model API endpoint; defaults to the ModelArk endpoint
Credentials are resolved at tool execution time, not at import time. Importing the tool module does not initialize a client or require credentials to be present.
config.yaml keys:
config.yaml
For BytePlus, explicitly configure the media model name, API base URL, and key for your enabled service. Do not assume CLOUD_PROVIDER overrides media configuration. Capabilities and parameter limits depend on the selected model service. MODEL_IMAGE_API_BASE is read at import time; configure it before starting the process.

Usage

examples/tools/image_generate/agent.py

Notes

image_generate is the canonical import name. from veadk.tools.builtin_tools.generate_image import image_generate still works, but the generate_image module is deprecated — use image_generate instead.

Parameters and results

Each task supports these fields. Omitted optional request fields use model-service defaults. Set dimensions or watermark behavior explicitly when they matter. Generation mode follows image and sequential_image_generation; task_type alone does not fill the other fields. This request explicitly allows up to three images:
Results contain status, success_list, error_list, and error_detail_list. Each success item maps an image name to a URL. A batch may partly succeed, so inspect error lists as well. With b64_json, the tool attempts to upload the image to TOS and return a URL, requiring writable object storage configuration; it does not return raw Base64 unchanged as the final tool result.
Last modified on September 19, 2026