Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add image generation route with reference image support#15

Open
d-sket wants to merge 5 commits into
EvanZhouDev:main from
d-sket:main
Open

Add image generation route with reference image support #15
d-sket wants to merge 5 commits into
EvanZhouDev:main from
d-sket:main

Conversation

@d-sket

@d-sket d-sket commented May 14, 2026

Copy link
Copy Markdown

Summary

Adds an OpenAI-compatible /v1/images/generations route backed by a swappable ImageGenerationGateway interface.

The default gateway uses the existing Codex /responses transport with the image_generation tool, then converts streamed image events into OpenAI-style image generation JSON with b64_json.

This also adds optional reference image support through a project-specific images field.

Changes

  • Add ImageGenerationGateway interface for deployment-specific image generation backends
  • Add CodexResponsesImageGenerationGateway default implementation
  • Add /v1/images/generations server route
  • Convert Codex image generation SSE image events into OpenAI-style JSON responses
  • Add optional images?: string[] request field for reference images
  • Map reference images into upstream input_image blocks
  • Preserve image data URLs and wrap raw base64 as data:image/png;base64,...
  • Cap generated image count and reference image count at 10
  • Export image generation gateway types
  • Add deployment examples for Docker, systemd, and reverse proxy usage
  • Document text-to-image and reference-image request/response usage
  • Add tests for custom gateway routing, SSE conversion, reference image mapping, and invalid image lists

Verification

  • bun run --filter openai-oauth test -- server.test.ts
  • bun run typecheck
  • Targeted Biome check for changed files

Notes

The images field is a project-specific extension to /v1/images/generations, intended for reference images such as character consistency, style reference, and image-guided editing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /