Skip to content

Images: generic CallAPI port in the core; rich infographics by default; log each picture's kind - #38

Merged
robdevops merged 4 commits into
mainfrom
claude/busy-maxwell-jo5ojy
Nov 19, 2026
Merged

robdevops merged 4 commits into
mainfrom
claude/busy-maxwell-jo5ojy

Conversation

@robdevops

@robdevops robdevops commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

A generic core port instead of an image-shaped one

The core mirrored the image feature: ImageRequest, Host.GenerateImage, Info.MakesImage and model.Client.Image existed for imagegen alone, which breaks the port rule. They become one generic service:

  • Host.CallAPI(ctx, path, body): from a tool's Run, post a JSON body to an endpoint of the model's API, such as OpenRouter's /images, and get the response back.
  • What the core keeps:
    • It adds the key, so a feature never sees it.
    • On OpenRouter it merges provider.data_collection: deny into any provider settings the body has. A provider value that isn't an object is refused.
    • It retries once, and caps each call at 150s and 32 MB.
    • It adds the usage.cost the response reports to the reply, so DAILY_BUDGET counts it.
  • What it refuses: calls outside a tool's Run, /chat/completions, and any path that isn't a plain endpoint.
  • Info.Provider (openrouter or empty) replaces Info.MakesImage, which was set from ReportsCost().
  • imagegen now builds its own /images body and decodes the picture itself.
  • Guardrail and docs: the arch test now fails if imagegen, make_image or gpt-image appears in core code. CONTRIBUTING and TECHNICAL list CallAPI.

Rich infographics by default

A technical picture (diagram, cutaway, schematic, infographic, labelled or educational) came out as a plain technical drawing. Now, unless the user names a style:

  • The brief asks for a polished infographic: a bold title, a detailed main illustration, colour-coded sections, icons, callouts with the facts and figures given, and a legend.
  • The tool description tells the chat model to plan that content, giving every word and number, since the image model invents none.

A named style still wins, and the accuracy rules are unchanged.

Log the kind

Each picture logs image asked: technical, 5 requirements, 16:9, so the operator can see whether a request went technical or artistic. It never logs the prompt or the requirements' text.

Testing

  • go vet and go test -race ./..., with no tags and with -tags nosignal, -tags notelegram and -tags nocharts.
  • model.Client.Call:
    • the key and the data-collection merge, including provider settings of other Go types;
    • a nil body;
    • the cost counted toward the reply;
    • refusals outside a tool and at bad paths;
    • another API receiving the body as given.
  • imagegen: tested against a fake CallAPI, including the end-to-end scenario where the bot draws a picture.
  • Reviews: an independent review judged the modularity, and a security review checked CallAPI. Both bugs it confirmed (a nil body, and dropped provider settings) are fixed with tests.
  • Not yet tried against the real image model since the port change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN

…sked for

The default was a clean, plain technical drawing. With no style named,
the brief now asks for a polished infographic (bold title, detailed main
illustration, colour-coded sections, icons, callouts, legend), and the
tool tells the model to plan its title, callouts with key facts and
figures, and legend, as the image model invents no words or numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
So the log says whether a picture went technical or artistic. Never the
prompt or the requirements themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
The core mirrored the feature: ImageRequest, GenerateImage, MakesImage
and Client.Image existed for imagegen alone. They become one generic
service, Host.CallAPI(ctx, path, body): from a tool's Run, post to an
endpoint of the model's API. The core keeps the key, adds
data_collection deny on OpenRouter, caps size and time, refuses chat
completions and outside a tool, and counts usage.cost toward the reply.
Info.MakesImage becomes Info.Provider. imagegen builds its /images body
and decodes the picture itself. The arch guardrail now names imagegen,
make_image and gpt-image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
A nil body panicked on OpenRouter, and provider settings that weren't a
map[string]any were dropped for data_collection alone. The provider
value now goes through JSON before deny is merged in; one that isn't an
object is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
@robdevops robdevops changed the title Images: rich infographic by default for technical pictures; log each picture's kind Images: generic CallAPI port in the core; rich infographics by default; log each picture's kind Nov 19, 2026
@robdevops
robdevops merged commit 6805a1f into main Nov 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants