Image Generation
Image generation lets Anyy create an image from a prompt and return it as a scoped artifact and native attachment.
The model-visible tool is image_generate in the optional media_generation
toolset. Provider and model selection are resolved by Anyy configuration,
not by tool arguments.
Configuration
Enable image generation with an image-capable auxiliary or main model:
auxiliary_models:
image_generation:
- provider_id: openai-responses-provider
model: image-model
media_generation:
image:
enabled: true
default_aspect_ratio: square
timeout_ms: 120000
max_bytes: 5242880
The setup helper writes the same sections with defaults:
| Field | Default |
|---|---|
media_generation.image.default_aspect_ratio | square |
media_generation.image.timeout_ms | 120000 |
media_generation.image.max_bytes | 5242880 |
The selected provider must have an API mode compatible with OpenAI Responses and
the selected model must advertise image_generation capability.
Tool Availability
image_generate is available only when:
| Requirement | Behavior |
|---|---|
media_generation.image.enabled | Must be true. |
| Model selection | Uses the first enabled auxiliary_models.image_generation entry, otherwise falls back to the main model if it supports image generation. |
| Provider | Must exist and be enabled. |
| Credential | Provider credential_ref or api_key_ref must resolve to a non-empty value. |
| Toolset | media_generation must be selected for the turn. |
Provider Routing
Routing order:
- First configured
auxiliary_models.image_generationentry. main_model.- Compatibility
default_modelshorthand ifmain_modelis not set.
If no selected model has image_generation capability, runtime startup returns a
configuration error when image generation is enabled.
The tool accepts:
| Argument | Values |
|---|---|
prompt | Required non-empty image prompt. |
aspect_ratio | square, portrait, or landscape; defaults to configured policy or square. |
Metadata
On success, the tool returns JSON containing:
| Field | Meaning |
|---|---|
artifact_ref | Canonical artifact ref such as artifact://artifact/<id>. |
artifact_id | Artifact id when available. |
content_type | Generated image content type. |
filename | Suggested filename. |
presentation_text | Short text used for message delivery. |
Provider id, model id, channel binding, content metadata, prompt hash, and digest are stored in the generated attachment/artifact metadata.
Artifacts
Generated images are stored through the artifact store and can be listed or pinned with the Artifacts tools.
The image bytes are delivered as a native attachment on supported messaging surfaces. If a channel cannot render images natively, Anyy still has the artifact record and attachment metadata for the session.
Failure Modes
| Status | Meaning |
|---|---|
blocked_unavailable | Image generation service or provider is not available. |
blocked_invalid | Prompt, session, turn, or aspect-ratio input is invalid. |
error | Provider generation failed after configuration was accepted. |