Skip to content

client.chat.completions.list() not working #2703

@RyanLoil

Description

@RyanLoil

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.chac.completions.list() raised Exception:

openai.APIStatusError: Error code: 405 - {'error': {'message': 'Only POST requests are accepted.', 'type': 'invalid_request_error', 'param': None, 'code': 'method_not_supported'}}

BTW: How could it possible that no one notice this bug since 1.31.0?

To Reproduce

Completely follow the tutorial in OpenAI API Reference:

from openai import OpenAI client = OpenAI(api_key="your_key") completions = client.chat.completions.list()

Code snippets

OS

Windows 11

Python version

Python 3.12.2

Library version

openai v1.31.0 & openai 2.6.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