Skip to content

feat(ai): add image generation domain #37713

Description

@opencode-agent

Summary

Add image generation as a separate semantic domain in @opencode-ai/ai, while keeping conversational image generation in the existing LLM interaction model.

Initial scope

  • Add provider-neutral ImageRequest, ImageModel, ImageResponse, and Image.generate(...) APIs.
  • Implement direct OpenAI Images generation through POST /v1/images/generations.
  • Expose OpenAI's hosted image_generation tool through the Responses route for conversational generation and editing.
  • Normalize generated image output while preserving provider metadata and usage.

Protocol direction

There is no ecosystem-wide image wire protocol comparable to Chat Completions. OpenAI, xAI, Together, and DeepInfra share a useful /images/generations compatibility subset, but Google, Stability, BFL, Replicate, fal, and Fireworks use materially different multimodal, multipart, or asynchronous job protocols.

Treat OpenAI Images as a reusable provider-family adapter, not as the package's universal image model. Keep the public request semantic and add provider adapters underneath it.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions