Implement hosted gpt-image-2-compatible image provider #21

Closed
opened 2026-10-27 13:34:37 +00:00 by sam · 0 comments
Owner

Scope

Implement the hosted image provider behind the image capability contract, targeting the practical baseline of the OpenAI gpt-image-2 API.

Cover text-to-image and image editing where supported by the API, prompt and image inputs, size/quality/background/output-format/compression-style options exposed by the baseline, response decoding, and provider error mapping. Do not claim unsupported parity: document exact API version/endpoint assumptions and any deliberate differences.

Acceptance criteria

  • Uses the existing HTTP/auth/configuration patterns rather than a one-off client.
  • Request serialization and response decoding are covered with httptest fixtures.
  • Provider failures, malformed responses, timeouts, oversized inputs, and cancellation are handled without panics or leaked secrets.
  • No live API key is needed for tests.
  • A small runnable example shows the request shape and configuration.

Design

See docs/prds/image-capability-contract.md#hosted-provider-498 for the settled design: generation via ai-sdk/image, edit via a direct HTTP client (ai-sdk has no edit/mask support), plus the full provider-error-mapping table. Do not re-derive this from the acceptance criteria alone.

Suggested /council lenses

lens-contract, lens-operator -- run /council --lenses contract,operator once gate-clean, before opening the PR.

Notes

Leverage github.com/samcharles93/ai-sdk's existing image.Provider/core.GenerateImage/registry.RegisterImage for the generate path (azure/togetherai/xai already implement it; OpenAI does not yet) instead of writing a raw HTTP client -- same adapter pattern curatorLLMRunner uses for chat. Gap: ai-sdk's GenerateImageRequest has no input-image/mask fields, so editing needs either an upstream ai-sdk change or a separate direct client for the edit endpoint. Decide which at this bead's own design step. See docs/prds/image-capability-contract.md's closing note.

Close reason

Closed


Imported from beads archie-core-1786748942169-3-ae7cfaea · GitHub #498 · type task · priority P2 · created 2026-08-14 · closed 2026-10-03

## Scope Implement the hosted image provider behind the image capability contract, targeting the practical baseline of the OpenAI `gpt-image-2` API. Cover text-to-image and image editing where supported by the API, prompt and image inputs, size/quality/background/output-format/compression-style options exposed by the baseline, response decoding, and provider error mapping. Do not claim unsupported parity: document exact API version/endpoint assumptions and any deliberate differences. ## Acceptance criteria - Uses the existing HTTP/auth/configuration patterns rather than a one-off client. - Request serialization and response decoding are covered with httptest fixtures. - Provider failures, malformed responses, timeouts, oversized inputs, and cancellation are handled without panics or leaked secrets. - No live API key is needed for tests. - A small runnable example shows the request shape and configuration. ## Design See docs/prds/image-capability-contract.md#hosted-provider-498 for the settled design: generation via ai-sdk/image, edit via a direct HTTP client (ai-sdk has no edit/mask support), plus the full provider-error-mapping table. Do not re-derive this from the acceptance criteria alone. ## Suggested /council lenses lens-contract, lens-operator -- run `/council --lenses contract,operator` once gate-clean, before opening the PR. ### Notes Leverage github.com/samcharles93/ai-sdk's existing image.Provider/core.GenerateImage/registry.RegisterImage for the generate path (azure/togetherai/xai already implement it; OpenAI does not yet) instead of writing a raw HTTP client -- same adapter pattern curatorLLMRunner uses for chat. Gap: ai-sdk's GenerateImageRequest has no input-image/mask fields, so editing needs either an upstream ai-sdk change or a separate direct client for the edit endpoint. Decide which at this bead's own design step. See docs/prds/image-capability-contract.md's closing note. ### Close reason Closed --- _Imported from beads `archie-core-1786748942169-3-ae7cfaea` · GitHub #498 · type task · priority P2 · created 2026-08-14 · closed 2026-10-03_
sam added the mediumtask labels 2026-10-27 13:34:37 +00:00
sam self-assigned this 2026-10-27 13:34:37 +00:00
sam closed this issue 2026-10-27 13:34:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#21