openai-php/client
An OpenAI API client library for PHP that supports connecting to OpenAI and third-party LLM services compatible with the /v1 endpoint.
Timeline (last 90 days)
openai-php/client and openai-php/laravel can connect to the /v1 endpoints of vLLM, LiteLLM and Ollama, or to any hosted gateway.
When the caller does not explicitly pass an HTTP client, openai-php/client attempts to discover an available client via PSR-18 implementations.
openai-php/client only cleans the base URI by appending a trailing / and adding https:// when the protocol is missing, then concatenates the relative path; a trailing slash causes double slashes in the request path and returns 404.
When using openai-php/client, if the base URI does not fully specify http://, a local plain-HTTP service will fail with a TLS error, producing cURL error 35: wrong version number.
When openai-php/client's factory finds Guzzle through the PSR-18 discovery mechanism, it sets no timeout by default.
openai-php/client maps HTTP 429 to RateLimitException, the raw response is available via $e->response, and the Retry-After header can be read.
openai-php/client maps 5xx to ServerException, other 4xx with a JSON error body to ErrorException, and network failures and timeouts to TransporterException.
openai-php/client's ErrorException::getErrorCode() returns the server's code field as a string, and you should compare HTTP status codes rather than this value when making decisions.
The openai-php/client library itself has no built-in retry mechanism; retries should target only RateLimitException, ServerException and TransporterException, and should honor the Retry-After header first.
openai-php/client's createStreamed() automatically sets stream: true; after enabling include_usage, the choices of the last chunk is an empty array, so you must check with isset before reading it.
1 more timeline events
All Facts (12)
openai-php/client 由 Nuno Maduro 等 PHP 社区知名开发者发起并持续维护
90%Unverifiedopenai-php/client and openai-php/laravel can connect to the /v1 endpoints of vLLM, LiteLLM and Ollama, or to any hosted gateway.
50%UnverifiedWhen the caller does not explicitly pass an HTTP client, openai-php/client attempts to discover an available client via PSR-18 implementations.
50%Unverifiedopenai-php/client only cleans the base URI by appending a trailing / and adding https:// when the protocol is missing, then concatenates the relative path; a trailing slash causes double slashes in the request path and returns 404.
50%UnverifiedWhen using openai-php/client, if the base URI does not fully specify http://, a local plain-HTTP service will fail with a TLS error, producing cURL error 35: wrong version number.
50%UnverifiedWhen openai-php/client's factory finds Guzzle through the PSR-18 discovery mechanism, it sets no timeout by default.
50%Unverifiedopenai-php/client maps HTTP 429 to RateLimitException, the raw response is available via $e->response, and the Retry-After header can be read.
50%Unverifiedopenai-php/client maps 5xx to ServerException, other 4xx with a JSON error body to ErrorException, and network failures and timeouts to TransporterException.
50%Unverifiedopenai-php/client's ErrorException::getErrorCode() returns the server's code field as a string, and you should compare HTTP status codes rather than this value when making decisions.
50%UnverifiedThe openai-php/client library itself has no built-in retry mechanism; retries should target only RateLimitException, ServerException and TransporterException, and should honor the Retry-After header first.
50%Unverifiedopenai-php/client's createStreamed() automatically sets stream: true; after enabling include_usage, the choices of the last chunk is an empty array, so you must check with isset before reading it.
50%Unverifiedopenai-php/client uses Guzzle's stream option to make streaming requests, and neither Guzzle 7 nor 8's timeout can intercept a stream that takes longer than the timeout value.
50%