Skip to content

feat(providers/image): real gpt-image adapter (OpenAI Images API) #18

@wesleysimplicio

Description

@wesleysimplicio

Context

GptImageProvider at lib/providers/image.ts:40-42 is a mock. Per ROUTING-MATRIX.md, gpt-image is the default for quote cards, carousels, inpaint, and before/after — anywhere typography precision matters.

Goal

Real adapter calling OpenAI's images.generate (and images.edit for inpaint).

Acceptance criteria

  • Adapter uses openai SDK (gpt-image-1 model)
  • Maps aspect (1:1/4:5/9:16/16:9) to OpenAI sizes (1024x1024, 1024x1536, etc.) — fallback to closest supported with warning
  • Supports n (number of variants) and transparent_background flag (passed by gpt-image-prompt-builder skill)
  • Downloads bytes and saves to outputs/<client>/<date>/<piece-id>/<slot>-<seed>.png
  • Returns real paths in output: string[]
  • Real cost_usd from OpenAI pricing table (use shared lib/providers/cost.ts)
  • Retry + timeout via shared policy
  • Skipped when DRY_RUN=true
  • E2E spec with mocked HTTP

Files

  • lib/providers/image.ts:40-42
  • .skills/gpt-image-prompt-builder/SKILL.md (no code change — read-only reference)

Depends on

  • #provider-mocks-isolation, #policy-module

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions