# Websearch in ChatCompletion API

**URL:** <https://community.openai.com/t/websearch-in-chatcompletion-api/1268537>\
**Category:** API\
**Created:** [May 25, 2025, 5:45pm UTC](https://community.openai.com/t/websearch-in-chatcompletion-api/1268537 "2025-05-25T17:45:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![max.lavrenov](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/max.lavrenov/32/167018_2.png) [@max.lavrenov](https://community.openai.com/u/max.lavrenov)\
**Post date:** [May 25, 2025, 5:45pm UTC](https://community.openai.com/t/websearch-in-chatcompletion-api/1268537/1 "2025-05-25T17:45:25Z")

</div>

In the doc [https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses)  
it says that the WebSearch tool is available via the Response API as well as via the ChatCompletion API

 ![The image is a comparison table showing the capabilities supported by the Chat Completions API and the Responses API, with some features like File search, Computer use, and Code interpreter not yet available for either API, and Audio and Code interpreter labeled as "Coming soon" for the Responses API. (Captioned by AI)](https://us1.discourse-cdn.com/openai1/original/4X/1/8/2/1820e790aecbc1b4beda5a0e0a3a2a34032108c7.png)

But how exactly does it work via ChatCompletion? I am always getting an error in the response.

---

<div class="post-metadata">

**Author:** ![aprendendo.next](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/aprendendo.next/32/721758_2.png) [@aprendendo.next](https://community.openai.com/u/aprendendo.next)\
**Post date:** [May 25, 2025, 5:47pm UTC](https://community.openai.com/t/websearch-in-chatcompletion-api/1268537/2 "2025-05-25T17:47:44Z")

</div>

On completions you use [specialized models](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat) for compatibility:

- `gpt-4o-search-preview`
- `gpt-4o-mini-search-preview`
