Skip to content

feat: image inputs for OpenAI Decisions and Cloudflare Clef - #9

Merged
schainks merged 1 commit into
mainfrom
feat/image-inputs
Oct 13, 2026
Merged

schainks merged 1 commit into
mainfrom
feat/image-inputs

Conversation

@schainks

Copy link
Copy Markdown
Owner

Closes #3.

Adds an images: option: a list of base64 data URLs, with SystemOneClient.image_data_url/2 to build one from bytes. It works with the two providers whose APIs accept images, and both see the images before the state.

Provider How images are sent
:openai input becomes one user message: input_image parts, then the state as input_text
:cloudflare Clef's top-level images array next to state (schema)
:typesafe, :openrouter, :compatible {:error, {:unsupported_option, :images, provider}}, no request sent

SystemOneClient.Images validates before any request: data URLs only, since neither API accepts remote URLs. For Clef it also enforces the documented limits of 4 PNG, JPEG or WebP images, 4 MiB each and 8 MiB in total once decoded. Telemetry metadata gains image_count, never image data.

Testing

  • 24 new tests (79 total, including 3 new doctests): validation rules, both request shapes through Req.Test, local rejection, and telemetry.
  • credo --strict, Dialyzer (0 errors), docs --warnings-as-errors, format, warnings-as-errors.
  • OpenAI, live: a red PNG came back red (0.97) and a blue PNG blue (1.0); two images in one request came back red_then_blue (0.96), so order is preserved. Each image costs about 300 input tokens. A remote URL was rejected locally.
  • Cloudflare, not yet live: tested against Clef's documented schema only. A live check is pending a Workers AI token.

Version 0.3.0, README section, CHANGELOG (unreleased).

🤖 Generated with Claude Code

https://claude.ai/code/session_01GCRzC1xV9gCW4bf7LzBGcB

New images: option, a list of base64 data URLs (SystemOneClient.image_data_url/2
builds one from bytes). Both providers see the images before the state:

- openai: input becomes one user message with input_image parts followed by the
  state as input_text
- cloudflare: the top-level images array, Clef's extension to System One

SystemOneClient.Images validates before any request: data URLs only (no remote
URLs), Clef's 4-image / PNG-JPEG-WebP / 4 MiB each / 8 MiB total limits, and
{:unsupported_option, :images, provider} for providers without image support.
Telemetry adds image_count. Version 0.3.0.

Closes #3.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GCRzC1xV9gCW4bf7LzBGcB
@schainks
schainks merged commit 4545209 into main Oct 13, 2026
5 checks passed
@schainks
schainks deleted the feat/image-inputs branch October 13, 2026 17:39
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.

OpenAI Decisions: support image inputs

1 participant