openai-python
or openai-node
) with Neosantara AI’s base_url
, the library maps its methods to our API endpoints. While both v1/responses
and v1/chat/completions
can hold a conversation, how you interact with them through the SDK is fundamentally different.
For new projects, we strongly recommend using the client.responses.create()
method.
If you want use
Function Calling
please use the v1/chat/completions instead for working with functionwe will fixed in v1/response
soon for supported function callingKey SDK Differences
1. The Method You Call
The most direct difference is the method you invoke on the client object.- Chat Completions uses the nested
chat.completions.create()
method. - Responses uses the top-level
responses.create()
method, reflecting its status as a primary, modern API.
2. Accessing the AI’s Reply
This is a critical difference. The structure of the returned object in the SDK reflects the underlying API response.- Chat Completions: The response is always nested inside a
choices
array. To get the text, you must accessresponse.choices[0].message.content
. - Responses: The SDK provides a convenient helper property called
output_text
that directly gives you the concatenated text. However, the most reliable way is to access theoutput
array and get the.text
from the first element, asoutput
can also contain other types of content like function calls.
3. Managing Conversation History
The Responses API was built to make multi-turn conversations easier, and this is reflected in the SDK usage.- Chat Completions: You are fully responsible for managing the conversation. You must manually create a list, append the assistant’s response, append the next user message, and send the entire list back every time.
- Responses: You can let the API manage the state. After the first turn, you simply pass the
previous_response_id
to continue the conversation. The SDK and your backend handle the rest.
Complete Migration Example
Here’s how you would migrate from Chat Completions to Responses:Recommendation
If you are… | You should use… | Why? |
---|---|---|
Starting a new project | client.responses.create() | It’s simpler, more powerful, and offers state management, advanced reasoning, and strict structured outputs. |
Migrating an existing app | client.chat.completions.create() | It provides a seamless, drop-in replacement for code already written for the OpenAI chat/completions endpoint. |