Download the PHP package octopus-llm/php without Composer

On this page you can find all versions of the php package octopus-llm/php. 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 php

Octopus LLM PHP Gateway

Packagist Version PHP Version License Downloads

OpenAI-compatible AI gateway with multi-key rotation, circuit breaker, and zero-cost free tier management for production usage.

Overview

Octopus-LLM is a robust PHP gateway that acts as a wrapper around the openai-php/client library. It automatically handles API key rotation using least-recently-used (LRU) patterns across multiple AI providers (like Groq, Cerebras, and OpenRouter), falls back to secondary providers if primary keys fail, protects your application using a configurable circuit breaker, and exposes events for recovery monitoring – all without needing a complicated infrastructure database.

Zero-Cost Free Tier Strategy

Octopus-LLM is designed to maximize free tier API quotas across providers. With enough keys, you can run production AI workloads at zero cost:

Provider Free Limit Keys needed for ~1k req/day
Groq 14,400 req/day 1
Cerebras ~14,400 req/day 1
OpenRouter Varies by model 1–3

Register multiple free accounts → add all keys to the pool → Octopus-LLM handles rotation automatically.

Installation

You can install this package easily via Composer:

Quick Start

Configuration

The OctopusLLM constructor requires an array configuration.

API Reference

chat(array $messages, array $options = []): ChatResponse

Sends a chat request using the gateway configurations. Supports standard array options for overriding defaults (stream, maxTokens, temperature, forceProvider).

getStatus(): StatusResponse

Returns a unified DTO of all available providers, detailing active keys, inactive keys, and total stats.

ping(string $providerId, int $keyIndex): bool

Checks if a specific inactive key logic has recovered by pinging the configured baseURL/models endpoint. Returns boolean success.

runRecovery(): RecoveryReport

A utility method to scan all inactive keys that passed the cooldown timeframe. Automatically checks if they are recovered and re-activates them if successful.

on(string $event, callable $callback): self

Attach event listeners such as when fallback happens or a key goes bad.

Streaming

You can enable native streaming via the options array, passing the onChunk callback:

Error Handling

Octopus-LLM uses explicit granular exceptions under OctopusLLM\Gateway\Exceptions\* namespace:

Events

You can hook into real-time health events using $llm->on(string $event, callable $callback):

CI4 Integration

If you intend to use this package with CodeIgniter 4, follow these steps:

  1. Register the Service: Add an octopus() method to app/Config/Services.php:

  2. Register the Recovery Command: CI4 does not auto-discover commands from vendor packages. Create a wrapper at app/Commands/OctopusRecover.php:

  3. Schedule Recovery: Run via CI4 Tasks or crontab every minute:

  4. Usage:

Custom Storage

OctopusLLM exposes OctopusLLM\Gateway\Contracts\StorageInterface which requires two methods: load(): array and save(array $state): void. Implement your own persistent storage logic (e.g. Redis, MySQL) for horizontal web-scaling deployments.

Non-Goals

This version 1.x library explicitly does NOT aim to support:


All versions of php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
guzzlehttp/guzzle Version ^7.0
openai-php/client Version ^0.10
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 octopus-llm/php contains the following files

Loading the files please wait ...