[suggest] Some third-party models Response do not have 'object' and 'model'
data: {"code":0,"message":"Success","sid":"cha000b2c02@dx198a6451bd69a4b532","id":"cha000b2c02@dx198a6451bd69a4b532","created":1755136204,"choices":[{"delta":{"role":"assistant","content":"hello"},"index":0}]}
https://github.com/openai-php/client/commit/127635870cfec1aae681d513d4e3fb6195332b2e
Can it be merged into the project?
I'm torn because you cause everything downstream to require handling nulls, so that's my hesitancy. These are fields that been there for many years at this point - I'm more curious why 3rd parties who are aiming for drop-in replacement aren't matching parity.
So at the moment I'm leaning towards no. We don't have a plugin system or response classes typed based on the provider so any change has consequences.
I missed that this was the streaming payload on first peek. Do you have name of the non-OpenAI provider and the API call you are making?
I presume this is legacy chat completion.
I missed that this was the streaming payload on first peek. Do you have name of the non-OpenAI provider and the API call you are making?
I presume this is legacy chat completion.
Thank you for your attention to this issue. The provider is xfyun Spark4.0 Ultra.
The complete API request is as follows:
POST https://spark-api-open.xf-yun.com/v1/chat/completions HTTP/1.1 Content-Length: 140 User-Agent: GuzzleHttp/7 Host: spark-api-open.xf-yun.com Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Content-Type: application/json Connection: close
{"model":"4.0Ultra","messages":[{"role":"system","content":"你是一个智能机器人"},{"role":"user","content":"你好"}],"stream":true}
HTTP/1.1 200 OK Content-Type: text/event-stream Connection: close Access-Control-Allow-Origin: * Cache-Control: no-cache Date: Mon, 25 Aug 2025 06:24:46 GMT X-Kong-Upstream-Latency: 476 X-Kong-Proxy-Latency: 1 Via: kong/1.3.0 Content-Length: 1896
data: {"code":0,"message":"Success","sid":"cha000b21bd@dx198dfe68e78b894532","id":"cha000b21bd@dx198dfe68e78b894532","created":1756103086,"choices":[{"delta":{"role":"assistant","content":"你好"},"index":0}]}
data: {"code":0,"message":"Success","sid":"cha000b21bd@dx198dfe68e78b894532","id":"cha000b21bd@dx198dfe68e78b894532","created":1756103086,"choices":[{"delta":{"role":"assistant","content":"呀!"},"index":0}]}
data: {"code":0,"message":"Success","sid":"cha000b21bd@dx198dfe68e78b894532","id":"cha000b21bd@dx198dfe68e78b894532","created":1756103086,"choices":[{"delta":{"role":"assistant","content":"很高兴为你服务"},"index":0}]}
data: {"code":0,"message":"Success","sid":"cha000b21bd@dx198dfe68e78b894532","id":"cha000b21bd@dx198dfe68e78b894532","created":1756103086,"choices":[{"delta":{"role":"assistant","content":",无论是回答问题、"},"index":0}]}
data: {"code":0,"message":"Success","sid":"cha000b21bd@dx198dfe68e78b894532","id":"cha000b21bd@dx198dfe68e78b894532","created":1756103086,"choices":[{"delta":{"role":"assistant","content":"提供建议还是陪你聊天"},"index":0}]}
data: {"code":0,"message":"Success","sid":"cha000b21bd@dx198dfe68e78b894532","id":"cha000b21bd@dx198dfe68e78b894532","created":1756103086,"choices":[{"delta":{"role":"assistant","content":",我随时都在这儿~"},"index":0}]}
data: {"code":0,"message":"Success","sid":"cha000b21bd@dx198dfe68e78b894532","id":"cha000b21bd@dx198dfe68e78b894532","created":1756103087,"choices":[{"delta":{"role":"assistant","content":"你有什么想了解或者需要帮忙的吗"},"index":0}]}
data: {"code":0,"message":"Success","sid":"cha000b21bd@dx198dfe68e78b894532","id":"cha000b21bd@dx198dfe68e78b894532","created":1756103087,"choices":[{"delta":{"role":"assistant","content":"?"},"index":0}],"usage":{"prompt_tokens":5,"completion_tokens":29,"total_tokens":34}}
data: [DONE]