Expand description
BP-3 (catalog row “Image generation tool”, cx§1’s image_gen feature):
a client-issued call to the PROVIDER’s image endpoint.
The row’s semantics is “provider-executed image creation”: the provider
renders the image, and this tool is the client side of that call — the
OpenAI-compatible POST {base_url}/images/generations every
OpenAI-shaped endpoint (including the one crate::Config::base_url
already points the chat provider at) exposes. The bytes come back
base64-encoded, are written into the working directory through the same
ToolContext::check_write sandbox check every other write-capable
tool passes, and the model gets the path.
UnsupportedAction is a real answer. Not every OpenAI-compatible gateway implements the images route. When the endpoint answers 404 / 405 / 501, the tool says so in exactly those terms — “unsupported_action: this provider exposes no image endpoint” — rather than retrying, falling back to another vendor, or inventing a file. Nothing here reaches for a provider the session was not already configured with.
Structs§
- Image
GenTool image_gen— generate an image through the session’s own provider.
Constants§
- DEFAULT_
IMAGE_ MODEL - The image model used when neither the call nor the config names one.
- IMAGE_
GEN - Registered name of the image tool (Codex’s own spelling).