Download the PHP package hojabbr/laravel-cliproxy without Composer

On this page you can find all versions of the php package hojabbr/laravel-cliproxy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-cliproxy

laravel-cliproxy

CLIProxyAPI for Laravel.

CLIProxyAPI is a self-hosted AI gateway. It serves the common API formats on one endpoint and routes each model to whatever you configure behind it: API keys, OpenAI-compatible providers, and the logins its panel supports, with pools, cooldowns and fallbacks. This package makes that gateway a first-class citizen of a Laravel application:

The package is vendor-neutral. It speaks the gateway's wire protocols, never an upstream's; which vendor serves a model is decided in your gateway, not here.

Requirements

Install

Publish the config when you want to change a default, and the migration when you use batches:

Text and images through laravel/ai

The package registers a cliproxy entry under ai.providers when you have not declared one. Its URL and key come from cliproxy.url and cliproxy.key when the provider is first resolved, so values your application sets during boot are honoured.

Model names are whatever your gateway serves (often an alias you defined in its panel). To give the provider defaults, and to pick its wire protocol, declare the entry yourself in config/ai.php:

Choosing a protocol

The gateway accepts both and translates either to the upstream that serves the model.

chat-completions (default) messages
Endpoint /v1/chat/completions /v1/messages
Text, streaming, tools, images yes yes
Structured output yes depends on the upstream (see below)
Documents (PDF) as file parts as document blocks, depends on the upstream
Explicit prompt-cache breakpoints no (upstreams that cache do so on the prefix) yes, including #[CacheInstructions] and the moving breakpoint below

Known gateway limit (CLIProxyAPI v7.3.18). A messages request bound for an openai-compatibility upstream loses its document blocks and its structured-output format without an error; text, images, tools and streaming survive. chat-completions carries both to every upstream. Run cliproxy:probe for each model and protocol you depend on; the package's scheduled live suite tracks this against the newest gateway.

A cache breakpoint that follows the conversation

On the messages protocol, an agent loop re-sends the whole conversation every step. Ask for a breakpoint on the last message and each step's cache becomes a prefix of the next:

The option never reaches the wire. The trait behind it, Ai\Concerns\CachesTrailingMessage, works on any subclass of laravel/ai's gateway for this format.

Images

Images use chat/completions with the image modality (the OpenRouter convention), which the gateway forwards to an openai-compatibility upstream flagged image: true.

Failover

A gateway failure that another provider could answer (no connection, 429, 500, 502, 503, 504) raises laravel/ai's failover exceptions, so a provider map moves on:

The gateway answers 500 when every credential in a pool failed, so this package treats 500 as a failover where laravel/ai's own gateways do not.

Routing: gateway first, fallback of your choice

A route decides, per call, whether the gateway takes it: only when the route is on and the gateway currently serves the model. Otherwise the call goes to the fallback.

A route that is on for a model the gateway does not list, with no fallback, still goes to the gateway, so you see the gateway's own error. A route that is off with no fallback throws RouteUnavailable.

Readiness

The answer comes from /v1/models and is cached for cliproxy.readiness.ttl seconds (60), so a route decision costs a cache read and a dead gateway is asked once a minute.

The management API

Answers are arrays exactly as the gateway sends them: this API moves with CLIProxyAPI's releases.

Batches

CLIProxyAPI has no batch endpoint. CliProxy::batches() keeps one row per request and runs each as a queued call in cliproxy.batches.protocol, with the lifecycle you know from vendor batch APIs:

There is no batch discount to be had through a gateway: a batch costs what its calls cost.

Commands

The probe checks listing, text, streaming, tools, structured output, image input, PDF input and caching (advisory), and optionally a long answer and image generation. It exits non-zero when a required check fails, so it can gate a deploy.

Testing your application

Fake the calls themselves with Http::fake() or laravel/ai's own fakes.

Running a gateway

docs/deploy/ has two examples with the recommended first config:

With PGSTORE_DSN set, CLIProxyAPI copies config.example.yaml into Postgres only while its config table is empty, so mount your seed at that path: from the first boot on, the panel owns the config and a restart never overwrites an edit.

Versioning

Semantic Versioning. Below 1.0.0 a breaking change lands in a new minor, so pin with ^0.1 and read CHANGELOG.md before moving between minors.

License

MIT. See LICENSE.md.


All versions of laravel-cliproxy with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/console Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/queue Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
laravel/ai Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hojabbr/laravel-cliproxy contains the following files

Loading the files please wait ...