Image generation
An agent with the generate_image tool can produce an image from a text prompt. The result is saved as a PNG artifact and shows up in chat like any other attachment.
Setup
With a ChatGPT subscription, there is nothing to set up. When a ChatGPT (Plus/Pro) provider is signed in and no image model is picked, agents make images through that subscription. You do not need an OpenAI API key. The Image generation card shows ChatGPT (default).
To use a different image backend, pick it in Settings → AI Providers → Image generation:
gpt-image-2on an OpenAI provider. The key comes from that provider, or fromOPENAI_API_KEY.MiniMax H3 ImageorMiniMax H3 Image Highspeedon a MiniMax or MiniMax (CN) provider. The key comes from that provider, or fromMINIMAX_API_KEY(MINIMAX_CN_API_KEYfor CN). With no MiniMax provider yet, pick MiniMax to add one. After the key saves, the image model is set toMiniMax H3 Image.- A model of an OpenAI-compatible provider with a base URL, for example a self-hosted backend. See Self-hosted models.
- A specific ChatGPT account, when more than one is signed in. Each ChatGPT account is one choice: every ChatGPT model makes images with the same tool.
To turn image generation off, pick Off. Agents then say that image generation is turned off.
With no ChatGPT signed in and no model picked, the card shows Not configured, and the tool asks for a model. The card shows No image provider when no provider can make images.
New agents get the generate_image tool. Agents that existed before get it one time, when the server starts after the update. To stop one agent from making images, remove the tool in Agent → Tools. It stays removed. See Builtin tools.
Using it
Ask in plain language. The agent calls generate_image with a prompt and, optionally, a filename and a size.
To be explicit, type @ in the web chat composer, pick @image, and describe the picture. A message tagged @image tells the agent to call generate_image straight away. When the profile does not have the tool, the agent says so and points to the tool assignment and the Settings model instead of answering in text. The tag only counts at the start of a word, so an address such as me@image.dev stays plain text.
| Parameter | Required | Notes |
|---|---|---|
prompt | yes | What to draw |
filename | no | Output name under artifacts/, defaults to a generated .png |
size | no | 1024x1024 (default), 1024x1536, 1536x1024, or auto |
The model is deliberately not a parameter. It comes from AI Providers, so a prompt cannot talk the agent into a model the workspace has not allowlisted. An unsupported size is rejected with the allowed list rather than silently rounded to the nearest one.
Where the image goes
Each generated image is written under the profile workspace:
~/.nakama/orgs/{orgId}/profiles/{profileId}/artifacts/The image appears in Browse Files → Artifacts with its type, size, and timestamp detected automatically. When the call happens inside a chat session, the image is also saved as a session attachment, which makes it render inline in web chat. Web chat and channel bridges recognize generate_image output, so Telegram and Discord turns also get the picture. The tool refuses generated files over 5 MB.
Channel behavior follows each channel's artifact rules. Telegram receives a share link after the save and caps a native document attachment at 5 MB. Discord sends supported native attachments up to 8 MB and otherwise falls back to the share link. WhatsApp automatically sends the newly saved PNG as a native document up to 16 MB. See Artifacts on channels for the delivery details.
See Artifacts and files for previewing, editing, and publishing what comes out.
Cost
Every generation records usage through the same token pricing bridge as chat, so image spend shows up next to model spend rather than being invisible. When the API returns a usage breakdown, that is what gets recorded. When it does not, Nakama estimates: input tokens from the prompt length, output tokens from the requested size. Estimated figures are recorded as estimates, not passed off as measured.
Limits
- A ChatGPT subscription,
gpt-image-2on an OpenAI provider, a MiniMax H3 image model on a MiniMax provider, or a model of an OpenAI-compatible provider with a base URL that speaks the OpenAI Images API (see Self-hosted models). There is no Stability or Replicate path. - On a ChatGPT subscription, the size is a request. ChatGPT picks the final size, and the tool result tells the agent the size that came back.
- On MiniMax,
automakes an image of about 1024x1024 pixels. MiniMax picks the aspect ratio. - No image editing or variations. Generation from a prompt only.
- No streaming or progress. A generation is one tool call that returns when the image is ready. A provider that has not answered completely within 180 seconds fails with a timeout error, and stopping the chat aborts the request.
- One PNG per call, up to 5 MB, with
1024x1024,1024x1536,1536x1024, orautooutput size.