Skip to content

Conversation

@christian-bromann
Copy link
Member

Add Image Generation Tool for OpenAI Responses API

Summary

This PR adds a new imageGeneration tool for the OpenAI provider, enabling models to generate and edit images using text prompts via the Responses API.

Usage

import { ChatOpenAI, tools } from "@langchain/openai";

const model = new ChatOpenAI({ model: "gpt-4o" });

const response = await model.invoke(
  "Generate an image of a sunset over mountains",
  {
    tools: [tools.imageGeneration({
      size: "1536x1024",
      quality: "high",
      outputFormat: "jpeg",
    })]
  }
);

Supported Models

gpt-4o, gpt-4o-mini, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, o3

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

🦋 Changeset detected

Latest commit: 5bc2c23

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@langchain/openai Minor
@langchain/classic Patch
@langchain/community Patch
@langchain/deepseek Patch
@langchain/xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@christian-bromann christian-bromann force-pushed the cb/openai-file-search branch 2 times, most recently from 99a25ce to d63a505 Compare December 8, 2025 23:35
@christian-bromann christian-bromann force-pushed the cb/openai-image-generation branch from aa9636d to 8aaef8c Compare December 8, 2025 23:40
@christian-bromann christian-bromann force-pushed the cb/openai-image-generation branch from 83d519c to 62eff6b Compare December 8, 2025 23:41
@christian-bromann christian-bromann merged commit 5bc2c23 into cb/openai-file-search Dec 9, 2025
53 of 55 checks passed
@christian-bromann christian-bromann deleted the cb/openai-image-generation branch December 9, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants