[KongchangAI]
Productopenai-php

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)

Oct 17

openai-php/client and openai-php/laravel can connect to the /v1 endpoints of vLLM, LiteLLM and Ollama, or to any hosted gateway.

Unverified50%
Oct 17

When the caller does not explicitly pass an HTTP client, openai-php/client attempts to discover an available client via PSR-18 implementations.

Unverified50%
Oct 17

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.

Unverified50%
Oct 17

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.

Unverified50%
Oct 17

When openai-php/client's factory finds Guzzle through the PSR-18 discovery mechanism, it sets no timeout by default.

Unverified50%
Oct 17

openai-php/client maps HTTP 429 to RateLimitException, the raw response is available via $e->response, and the Retry-After header can be read.

Unverified50%
Oct 17

openai-php/client maps 5xx to ServerException, other 4xx with a JSON error body to ErrorException, and network failures and timeouts to TransporterException.

Unverified50%
Oct 17

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.

Unverified50%
Oct 17

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.

Unverified50%
Oct 17

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.

Unverified50%

1 more timeline events

All Facts (12)

Unverified

openai-php/client 由 Nuno Maduro 等 PHP 社区知名开发者发起并持续维护

90%
Unverified

openai-php/client and openai-php/laravel can connect to the /v1 endpoints of vLLM, LiteLLM and Ollama, or to any hosted gateway.

50%
Unverified

When the caller does not explicitly pass an HTTP client, openai-php/client attempts to discover an available client via PSR-18 implementations.

50%
Unverified

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.

50%
Unverified

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.

50%
Unverified

When openai-php/client's factory finds Guzzle through the PSR-18 discovery mechanism, it sets no timeout by default.

50%
Unverified

openai-php/client maps HTTP 429 to RateLimitException, the raw response is available via $e->response, and the Retry-After header can be read.

50%
Unverified

openai-php/client maps 5xx to ServerException, other 4xx with a JSON error body to ErrorException, and network failures and timeouts to TransporterException.

50%
Unverified

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.

50%
Unverified

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.

50%
Unverified

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.

50%
Unverified

openai-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%

Source Articles