Skip to content

client.chat.completions.create works with neither messages or input #2560

@tsoernes

Description

@tsoernes

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

client.chat.completions.create works with neither messages or input

To Reproduce

When using

import json
import os
import random

from dotenv import load_dotenv
from openai import AzureOpenAI
from pydantic import BaseModel, Field

load_dotenv()

client = AzureOpenAI(
    api_version="2025-03-01-preview",
    azure_endpoint=os.getenv("AZURE_ENDPOINT"),
    api_key=os.getenv("AZURE_GPT5_KEY"),
)


input_list = [
    {
        "role": "user",
        "content": "What's today's horoscope for Aquarius and weather in Paris & Tokyo?",
    }
]

response = client.chat.completions.create(
    model="gpt-5",  # Use your actual deployment name
    input=input_list,
    tools=tools,
    tool_choice="auto",
)

It yields error:

Traceback (most recent call last):
  File "/home/torstein.sornes/code/kg-text-to-graph-experiments/experiment2-parallell-tool-calling/main.py", line 66, in <module>
    response = client.chat.completions.create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/torstein.sornes/code/kg-text-to-graph-experiments/.venv/lib/python3.12/site-packages/openai/_utils/_utils.py", line 286, in wrapper
    raise TypeError(msg)
TypeError: Missing required arguments; Expected either ('messages' and 'model') or ('messages', 'model' and 'stream') arguments to be given

But when using

response = client.chat.completions.create(
    model="gpt-5",  # Use your actual deployment name
    messages=input_list,
    tools=tools,
    tool_choice="auto",
)

It yields error

Traceback (most recent call last):
  File "/home/torstein.sornes/code/kg-text-to-graph-experiments/experiment2-parallell-tool-calling/par.py", line 176, in <module>
    print(run_conversation())
          ^^^^^^^^^^^^^^^^^^
  File "/home/torstein.sornes/code/kg-text-to-graph-experiments/experiment2-parallell-tool-calling/par.py", line 121, in run_conversation
    response = client.chat.completions.create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/torstein.sornes/code/kg-text-to-graph-experiments/.venv/lib/python3.12/site-packages/openai/_utils/_utils.py", line 287, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/torstein.sornes/code/kg-text-to-graph-experiments/.venv/lib/python3.12/site-packages/openai/resources/chat/completions/completions.py", line 1150, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/torstein.sornes/code/kg-text-to-graph-experiments/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1259, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/torstein.sornes/code/kg-text-to-graph-experiments/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1047, in request
    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "Unsupported parameter: 'messages'. In the Responses API, this parameter has moved to 'input'. Try again with the new parameter. See the API documentation for more information: https://platform.openai.com/docs/api-reference/responses/create.", 'type': 'invalid_request_error', 'param': None, 'code': 'unsupported_parameter'}}

Code snippets

OS

Linux

Python version

Python 3.12

Library version

1.99.9

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