Skip to content

Conversation

@Kemel91
Copy link
Contributor

@Kemel91 Kemel91 commented Jan 28, 2026

What:

  • Bug Fix
  • New Feature

Description:

Add support for the reasoning_content field in chat completions API responses. This field is added at the same level as content in both streaming and non-streaming requests. The field is marked as optional to handle cases where it's not present in the API response.

Related:

fixes #517

@iBotPeaches
Copy link
Collaborator

Am I blind? I can't find that property on the API reference: https://platform.openai.com/docs/api-reference/chat/object

@Kemel91
Copy link
Contributor Author

Kemel91 commented Jan 28, 2026

Am I blind? I can't find that property on the API reference: https://platform.openai.com/docs/api-reference/chat/object

The reasoning_content field is indeed not yet listed in the official OpenAI API reference.

However, this field is currently being returned by the API when using certain experimental or yet-to-be-documented features (e.g., when the reasoning option is enabled in the request).

We added support for it in the library to:

Avoid data loss: If the API does return this field, the library will now parse it correctly.

Stay ahead of future updates: New fields often appear in the API before they are officially documented.

Support users already experimenting with the feature: Some developers are already using unreleased capabilities, and the library shouldn’t break or ignore the data.

This is a common practice in SDKs to maintain compatibility with potential API changes before they are formally announced.

@iBotPeaches
Copy link
Collaborator

Okay, update/create some tests and I think we are good to go.

@iBotPeaches iBotPeaches merged commit 05c406e into openai-php:main Jan 28, 2026
14 checks passed
@Cyrille37
Copy link

Thanks, guys! 💌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Incompatible with the the DeepSeek R1 model's reasoning_content field

3 participants