openai-php / openai-php/client

[Bug]: Undefined array key "status" in Responses endpoint for Openrouter API

Open
#726 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
5.8k
Forks
679
Avg merge
19m
Merged PRs (30d)
2

Description

Description

OpenAI-like Openrouter API doesn't return status field in response data, but the client require this field.

Error

Warning: Undefined array key "status" in vendor/openai-php/client/src/Responses/Responses/CreateResponse.php on line 125

Steps To Reproduce
$client = OpenAI::factory()
    ->withBaseUri('https://openrouter.ai/api/v1')
    ->withApiKey('KEY')
    ->make();
$response = $client->responses()->create([
  'model' => 'openai/o4-mini',
  'input' => [
      [
          'role' => 'user',
          'content' => 'My Prompt'
      ]
  ],
]);
OpenAI PHP Client Version

v0.18.0

PHP Version

8.2

Notes

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with vendor/openai-php/client/src/Responses/Responses/CreateResponse.php around line 125 and reproduce the Openrouter request shown in the issue using PHP 8.2 and client v0.18.0. Trace how the response data is read when status is absent, then verify the request no longer emits an undefined-array-key warning while handling the Openrouter response.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.