Download the PHP package latentkit/latentkit-php without Composer
On this page you can find all versions of the php package latentkit/latentkit-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package latentkit-php
LatentKit PHP SDK
Official PHP 8.1+ client for LatentKit's canonical, route-based /v1 API.
The application sends the task. The API key's assigned published route selects the provider and model. Do not send model, provider, route, or policy; the SDK rejects those route-control fields before making a request.
Install
Install the current beta from Packagist:
For repository development, run composer install inside sdk/php and load vendor/autoload.php.
Quickstart
Set the key server-side:
Client options
apiKeyfalls back toLATENTKIT_API_KEY.baseUrlfalls back toLATENTKIT_BASE_URL, thenhttps://ai.latentkit.com, and is normalized to/v1.headersadds or overrides request headers.transportaccepts anyTransportInterfaceimplementation.toolSlugandtoolVersionset LatentKit tool-attribution headers.appIdis only for a credential that supports explicit app context.
Keep the client and API key in server-side PHP. Never render the raw key into HTML or JavaScript.
Inspect the connected route
Use the typed context when an integration needs connection, route, model, or recent request status:
The latest request reports the model that won that request. It is not a fixed model: the assigned route can choose another eligible model or use a fallback on the next call. Runtime SDK credentials cannot change the route.
When a compatible gateway returns the ordered models list without a separate
model_count, the typed context derives the count from the returned models.
This avoids presenting a populated route as unavailable or empty.
$client->me->retrieve() remains available when raw associative arrays are
preferred.
Supported resources in 0.1
Chat streaming, completions, speech, transcription, translation, video, control-plane helpers, IDE auth, and agent sessions are not part of PHP 0.1. JavaScript and Python remain the full-surface SDKs while PHP parity expands.
Queue is enqueue-only
LatentKit currently exposes POST /v1/queue but no public per-job result endpoint. The PHP SDK deliberately has no queue->retrieve() method. WordPress, Drupal, Laravel, and commerce plugins that need a result must run their own background job and call the synchronous SDK method from that job.
Errors and request IDs
AuthenticationException, RateLimitException, and ValidationException extend ApiException. Network/client failures throw TransportException; malformed successful API responses throw InvalidResponseException.
HTTP transports
The default CurlTransport has no concrete HTTP-library dependency and requires ext-curl.
Framework applications may inject an existing PSR-18 client plus PSR-17 request/stream factories:
Configure timeouts on the injected PSR-18 client. PSR-18 does not standardize timeout configuration or streaming.
Development
The tests use an in-memory transport and never contact LatentKit.
All versions of latentkit-php with dependencies
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0