litellm - ✅(Solved) Fix [Bug]: gpt-5.4-pro does not work with the v1/chat/completions endpoint [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#23014Fetched 2026-04-08 00:38:53
View on GitHub
Comments
2
Participants
2
Timeline
12
Reactions
2
Participants
Timeline (top)
labeled ×3commented ×2cross-referenced ×2subscribed ×2

Error Message

Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new LiteLLM.Info: If you need to debug this error, use `litellm._turn_on_debug()'.

Traceback (most recent call last): File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 845, in completion raise e File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 773, in completion ) = self.make_sync_openai_chat_completion_request( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ openai_client=openai_client, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... logging_obj=logging_obj, ^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/logging_utils.py", line 344, in sync_wrapper result = func(*args, **kwargs) File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 502, in make_sync_openai_chat_completion_request raise e File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 477, in make_sync_openai_chat_completion_request raw_response = openai_client.chat.completions.with_raw_response.create( **data, timeout=timeout ) File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_legacy_response.py", line 364, in wrapped return cast(LegacyAPIResponse[R], func(*args, **kwargs)) ~~~~^^^^^^^^^^^^^^^^^ File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_utils/_utils.py", line 286, in wrapper return func(*args, **kwargs) File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 1192, in create return self._post( ~~~~~~~~~~^ "/chat/completions", ^^^^^^^^^^^^^^^^^^^^ ...<47 lines>... stream_cls=Stream[ChatCompletionChunk], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1294, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1067, in request raise self._make_status_error_from_response(err.response) from None openai.NotFoundError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2609, in completion raise e File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2581, in completion response = openai_chat_completions.completion( model=model, ...<16 lines>... shared_session=shared_session, ) File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 856, in completion raise OpenAIError( ...<4 lines>... ) litellm.llms.openai.common_utils.OpenAIError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "<python-input-6>", line 1, in <module> completion(model="gpt-5.4-pro", messages=[{"role": "user", "content": "hello, what day is today?"}]) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1749, in wrapper raise e File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1570, in wrapper result = original_function(*args, **kwargs) File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 4320, in completion raise exception_type( ~~~~~~~~~~~~~~^ model=model, ^^^^^^^^^^^^ ...<3 lines>... extra_kwargs=kwargs, ^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2398, in exception_type raise e File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 451, in exception_type raise BadRequestError( ...<6 lines>... ) litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?

Fix Action

Fixed

PR fix notes

PR #22954: feat(openai): add gpt-5.4-pro to model map

Description (problem / solution / changelog)

Summary

Adds GPT-5.4 pro to the LiteLLM model map.

Changes

  • gpt-5.4-pro – main model
  • gpt-5.4-pro-2026-03-05 – snapshot

Model specs

PropertyValue
Input$30/1M tokens
Output$180/1M tokens
Context window1,050,000 tokens
Max output tokens128,000
Priority pricing (>272K input)2x input, 1.5x output
Reasoning effortmedium, high, xhigh
EndpointsChat Completions, Batch, Responses
ModalitiesText, image (input); text (output)
Structured outputsNot supported

Made with Cursor

Changed files

  • litellm/model_prices_and_context_window_backup.json (modified, +78/-0)
  • model_prices_and_context_window.json (modified, +78/-0)

Code Example

from litellm import completion

completion(model="gpt-5.4-pro", messages=[{"role": "user", "content": "hello, what day is today?"}])

---

Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm._turn_on_debug()'.

Traceback (most recent call last):
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 845, in completion
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 773, in completion
    ) = self.make_sync_openai_chat_completion_request(
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        openai_client=openai_client,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        logging_obj=logging_obj,
        ^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/logging_utils.py", line 344, in sync_wrapper
    result = func(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 502, in make_sync_openai_chat_completion_request
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 477, in make_sync_openai_chat_completion_request
    raw_response = openai_client.chat.completions.with_raw_response.create(
        **data, timeout=timeout
    )
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_legacy_response.py", line 364, in wrapped
    return cast(LegacyAPIResponse[R], func(*args, **kwargs))
                                      ~~~~^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_utils/_utils.py", line 286, in wrapper
    return func(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 1192, in create
    return self._post(
           ~~~~~~~~~~^
        "/chat/completions",
        ^^^^^^^^^^^^^^^^^^^^
    ...<47 lines>...
        stream_cls=Stream[ChatCompletionChunk],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1294, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1067, in request
    raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2609, in completion
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2581, in completion
    response = openai_chat_completions.completion(
        model=model,
    ...<16 lines>...
        shared_session=shared_session,
    )
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 856, in completion
    raise OpenAIError(
    ...<4 lines>...
    )
litellm.llms.openai.common_utils.OpenAIError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<python-input-6>", line 1, in <module>
    completion(model="gpt-5.4-pro", messages=[{"role": "user", "content": "hello, what day is today?"}])
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1749, in wrapper
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1570, in wrapper
    result = original_function(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 4320, in completion
    raise exception_type(
          ~~~~~~~~~~~~~~^
        model=model,
        ^^^^^^^^^^^^
    ...<3 lines>...
        extra_kwargs=kwargs,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2398, in exception_type
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 451, in exception_type
    raise BadRequestError(
    ...<6 lines>...
    )
litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?

---

from litellm import completion

completion(model="gpt-5.4-pro", messages=[{"role": "user", "content": "hello, what day is today?"}])

---

Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm._turn_on_debug()'.

Traceback (most recent call last):
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 845, in completion
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 773, in completion
    ) = self.make_sync_openai_chat_completion_request(
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        openai_client=openai_client,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        logging_obj=logging_obj,
        ^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/logging_utils.py", line 344, in sync_wrapper
    result = func(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 502, in make_sync_openai_chat_completion_request
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 477, in make_sync_openai_chat_completion_request
    raw_response = openai_client.chat.completions.with_raw_response.create(
        **data, timeout=timeout
    )
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_legacy_response.py", line 364, in wrapped
    return cast(LegacyAPIResponse[R], func(*args, **kwargs))
                                      ~~~~^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_utils/_utils.py", line 286, in wrapper
    return func(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 1192, in create
    return self._post(
           ~~~~~~~~~~^
        "/chat/completions",
        ^^^^^^^^^^^^^^^^^^^^
    ...<47 lines>...
        stream_cls=Stream[ChatCompletionChunk],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1294, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1067, in request
    raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2609, in completion
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2581, in completion
    response = openai_chat_completions.completion(
        model=model,
    ...<16 lines>...
        shared_session=shared_session,
    )
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 856, in completion
    raise OpenAIError(
    ...<4 lines>...
    )
litellm.llms.openai.common_utils.OpenAIError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<python-input-6>", line 1, in <module>
    completion(model="gpt-5.4-pro", messages=[{"role": "user", "content": "hello, what day is today?"}])
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1749, in wrapper
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1570, in wrapper
    result = original_function(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 4320, in completion
    raise exception_type(
          ~~~~~~~~~~~~~~^
        model=model,
        ^^^^^^^^^^^^
    ...<3 lines>...
        extra_kwargs=kwargs,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2398, in exception_type
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 451, in exception_type
    raise BadRequestError(
    ...<6 lines>...
    )
litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

The gpt-5.4-pro is not currently working with the completion API.

When running the following code snippet using litellm==1.82.0:

from litellm import completion

completion(model="gpt-5.4-pro", messages=[{"role": "user", "content": "hello, what day is today?"}])

I got the error saying that litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?.

<details> <summary>Full stacktrace</summary>
Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm._turn_on_debug()'.

Traceback (most recent call last):
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 845, in completion
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 773, in completion
    ) = self.make_sync_openai_chat_completion_request(
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        openai_client=openai_client,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        logging_obj=logging_obj,
        ^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/logging_utils.py", line 344, in sync_wrapper
    result = func(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 502, in make_sync_openai_chat_completion_request
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 477, in make_sync_openai_chat_completion_request
    raw_response = openai_client.chat.completions.with_raw_response.create(
        **data, timeout=timeout
    )
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_legacy_response.py", line 364, in wrapped
    return cast(LegacyAPIResponse[R], func(*args, **kwargs))
                                      ~~~~^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_utils/_utils.py", line 286, in wrapper
    return func(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 1192, in create
    return self._post(
           ~~~~~~~~~~^
        "/chat/completions",
        ^^^^^^^^^^^^^^^^^^^^
    ...<47 lines>...
        stream_cls=Stream[ChatCompletionChunk],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1294, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1067, in request
    raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2609, in completion
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2581, in completion
    response = openai_chat_completions.completion(
        model=model,
    ...<16 lines>...
        shared_session=shared_session,
    )
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 856, in completion
    raise OpenAIError(
    ...<4 lines>...
    )
litellm.llms.openai.common_utils.OpenAIError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<python-input-6>", line 1, in <module>
    completion(model="gpt-5.4-pro", messages=[{"role": "user", "content": "hello, what day is today?"}])
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1749, in wrapper
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1570, in wrapper
    result = original_function(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 4320, in completion
    raise exception_type(
          ~~~~~~~~~~~~~~^
        model=model,
        ^^^^^^^^^^^^
    ...<3 lines>...
        extra_kwargs=kwargs,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2398, in exception_type
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 451, in exception_type
    raise BadRequestError(
    ...<6 lines>...
    )
litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?
</details>

Steps to Reproduce

  1. Install the latest version of litellm (I used 1.82.0)
  2. Use gpt-5.4-pro with the completion API:
from litellm import completion

completion(model="gpt-5.4-pro", messages=[{"role": "user", "content": "hello, what day is today?"}])

Relevant log output

Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm._turn_on_debug()'.

Traceback (most recent call last):
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 845, in completion
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 773, in completion
    ) = self.make_sync_openai_chat_completion_request(
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        openai_client=openai_client,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        logging_obj=logging_obj,
        ^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/logging_utils.py", line 344, in sync_wrapper
    result = func(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 502, in make_sync_openai_chat_completion_request
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 477, in make_sync_openai_chat_completion_request
    raw_response = openai_client.chat.completions.with_raw_response.create(
        **data, timeout=timeout
    )
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_legacy_response.py", line 364, in wrapped
    return cast(LegacyAPIResponse[R], func(*args, **kwargs))
                                      ~~~~^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_utils/_utils.py", line 286, in wrapper
    return func(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 1192, in create
    return self._post(
           ~~~~~~~~~~^
        "/chat/completions",
        ^^^^^^^^^^^^^^^^^^^^
    ...<47 lines>...
        stream_cls=Stream[ChatCompletionChunk],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1294, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1067, in request
    raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2609, in completion
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 2581, in completion
    response = openai_chat_completions.completion(
        model=model,
    ...<16 lines>...
        shared_session=shared_session,
    )
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 856, in completion
    raise OpenAIError(
    ...<4 lines>...
    )
litellm.llms.openai.common_utils.OpenAIError: Error code: 404 - {'error': {'message': 'This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<python-input-6>", line 1, in <module>
    completion(model="gpt-5.4-pro", messages=[{"role": "user", "content": "hello, what day is today?"}])
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1749, in wrapper
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/utils.py", line 1570, in wrapper
    result = original_function(*args, **kwargs)
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/main.py", line 4320, in completion
    raise exception_type(
          ~~~~~~~~~~~~~~^
        model=model,
        ^^^^^^^^^^^^
    ...<3 lines>...
        extra_kwargs=kwargs,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2398, in exception_type
    raise e
  File "/Users/mohammad/Turing/agentic-vet/gdm-agent-vet/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 451, in exception_type
    raise BadRequestError(
    ...<6 lines>...
    )
litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?

What part of LiteLLM is this about?

SDK (litellm Python package)

What LiteLLM version are you on ?

1.82.0

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

The error message indicates that the gpt-5.4-pro model is not supported in the v1/chat/completions endpoint. To fix this issue, you can use the v1/completions endpoint instead.

Here are the steps to fix the issue:

  • Update the completion function to use the v1/completions endpoint for non-chat models.
  • Modify the code to handle non-chat models separately.

Example code:

from litellm import completion

# Check if the model is a chat model
def is_chat_model(model):
    # Add chat models to this list
    chat_models = ["gpt-3.5-turbo"]
    return model in chat_models

# Use v1/completions endpoint for non-chat models
def completion_api(model, messages):
    if is_chat_model(model):
        return completion(model=model, messages=messages)
    else:
        # Use v1/completions endpoint
        return completion(model=model, prompt=messages[0]["content"])

# Test the function
model = "gpt-5.4-pro"
messages = [{"role": "user", "content": "hello, what day is today?"}]
response = completion_api(model, messages)
print(response)

Note: You need to modify the is_chat_model function to include all chat models.

Verification

To verify that the fix worked, you can test the completion_api function with different models and messages. If the function returns a response without any errors, it means the fix is working correctly.

Extra Tips

  • Make sure to handle errors and exceptions properly in your code.
  • Keep the list of chat models up to date in the is_chat_model function.
  • You can also add more functionality to the completion_api function to handle different types of models and messages.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING