labsllm/llm-wrapper

PHP library that integrates different LLM services (ChatGPT, Claude, Gemini) into a single wrapper

v2.5-alpha1.1 2025-05-22 16:30 UTC

README

A simple PHP library that provides a unified interface for interacting with various Large Language Models like OpenAI, Anthropic, and Google.

For complete documentation, visit labsllm.geanpedro.com.br

Install

composer require labsllm/llm-wrapper

Basic Usage

$execute = LabsLLM::text()
    ->using(new OpenAI('SK-***', 'gpt-4o-mini'))
    ->executePrompt('Your question here');

$response = $execute->getResponseData();

echo $response->response;

Switching Providers

Just change the provider in the using() method:

// Using Google
$execute = LabsLLM::text()
    ->using(new Google('API-KEY', 'gemini-pro'))
    ->executePrompt('Your question here');

// Using Anthropic
$execute = LabsLLM::text()
    ->using(new Anthropic('API-KEY', 'claude-3-opus'))
    ->executePrompt('Your question here');

Provider Support Status

Legend:

  • ✅ Supported
  • 🚧 In Development
  • 📅 Planned
  • ❌ Not Supported
Feature OpenAI Google Anthropic
Text Prompts 📅
System Instructions 📅
Chat 📅
Tools/Functions
Structure Output
Streaming
Embeddings 📅
Voice 📅
Image Generation 📅 📅