Skip to content

Response API image generation tool number of image paramater: {'error': {'message': "Unknown parameter: 'tools[0].n'.", 'type': 'invalid_request_error', 'param': 'tools[0].n', 'code': 'unknown_parameter'}} #2481

@ayseozgun

Description

@ayseozgun

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

Hi,

I am using response api with image generation tool. I want to limit number of images as 1. But could not find the correct parameter for the response api tool. Is there any parameter that limits the number of images while using response api?

https://platform.openai.com/docs/guides/image-generation?image-generation-model=gpt-image-1#customize-image-output

Thanks,

To Reproduce

Create a Azure Openai client.
run client with responses api.

Code snippets

from openai import OpenAI
client = OpenAI()
response = client.responses.create(
                        model="gpt-4.1-mini",
                        input=input_data,
                        tools=[{"type": "image_generation", "quality": "medium", "size":"1024x1024",  "n": 1 }],
                    )

OS

Windows

Python version

3.12

Library version

1.95.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions