openai-php / openai-php/client
[Bug]: Warning: undefined array key 'id' using chat()
Open
Nobody has claimed this yet.
bug
Non-OpenAI Model
- Dominant language
- PHP
- Stars
- 5.8k
- Forks
- 679
- Avg merge
- 19m
- Merged PRs (30d)
- 2
Description
Description
Another error with using the client to interact with Gemini - once again, Google doesn't provide a field (id) that the client expects to be present in the response.
Steps To Reproduce
return $client->chat()->create([
'model' => 'gemini-2.0-flash',
'messages' => [
['role' => 'user', 'content' => $text],
],
]);
OpenAI PHP Client Version
v0.10.3
PHP Version
8.4
Notes
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the chat()->create() entry point and trace how the Gemini response is processed after the request in the reproduction. Check where the response's id field is accessed, then run the reported example against Gemini to verify the warning is gone and the returned chat result remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100