Skip to content

TypeScript type error: ResponseInputImage.detail should be optional & documentation example does not match type definitions #1695

@princeaden1

Description

@princeaden1

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

The detail parameter was marked as required in the TypeScript interface despite the comment indicating it has a default value of 'auto'. When the detail is omitted from the code, the openai api perform as expected but IDE will always flag detail as required (typescript). From all the examples provided on openai documentation pages, detail is optional. ChatGPT example is also reflecting what is on OpenAI documentation page.

I have created two PRs on this:

  1. [The first PR solved the] (fix: make detail parameter optional in ResponseInputImage interface fix: make detail parameter optional in ResponseInputImage interface #1575)
  2. better documentation on this: add vision example using image URL docs: add vision example using image URL #1571

To Reproduce

Copy and paste this in the IDE, the input will throw type error which

import OpenAI from "openai";
const client = new OpenAI();

const response = await client.responses.create({
    model: "gpt-5",
    input: [
        {
            role: "user",
            content: [
                {
                    type: "input_text",
                    text: "What is in this image?",
                },
                {
                    type: "input_image",
                    image_url: "https://openai-documentation.vercel.app/images/cat_and_otter.png",
                },
            ],
        },
    ],
});

console.log(response.output_text);

Code snippets

OS

MacOS

Node version

Node.js v18.20.8

Library version

"openai": "^6.7.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions