openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.56k stars 466 forks source link

Set default index of 0 if not defined by API server (e.g. OpenRouter) #361

Open giltotherescue opened 3 months ago

giltotherescue commented 3 months ago

What:

Description:

By setting a different baseUri, this package is fully compatible with OpenRouter.ai, a service that supports many different AI models through a common interface (OpenAI's).

However, OpenRouter does not provide an "index" property in its responses, which causes the response to fail. Setting a default index of 0 fixes this problem.