Polyglot is a PHP library that provides a unified API to access various LLM API providers.
Polyglot is a PHP library that provides a unified API for interacting with various Large Language Model (LLM) providers. It allows developers to build applications that use LLMs without being locked into a specific provider or having to rewrite code when switching between providers.The core philosophy behind Polyglot is to create a consistent, provider-agnostic interface that abstracts away the differences between LLM APIs, while still allowing access to provider-specific features when needed. This enables developers to:
Write code once and use it with any supported LLM provider
Easily switch between providers without changing application code
Use different providers in different environments (development, testing, production)
Fall back to alternative providers if one becomes unavailable
Polyglot was developed as part of the Instructor for PHP library, which focuses on structured outputs from LLMs, but can also be used as a standalone library for general LLM interactions.
Polyglot is designed to work with any PHP framework or even in plain PHP applications. It does not depend on any specific framework, making it easy to integrate into existing projects.
Compatible with Laravel, Symfony, CodeIgniter, and others