Download the PHP package tigusigalpa/monica-api-php without Composer

On this page you can find all versions of the php package tigusigalpa/monica-api-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 monica-api-php

Monica AI API PHP Client/SDK

PHP Version License: MIT Latest Version

Monica AI PHP SDK

A powerful and elegant PHP client (SDK) library for Monica API Platform - your unified gateway to multiple AI models from leading providers.

πŸš€ Features

πŸ“‹ Supported AI Models

Provider Model Description Image Input Support
OpenAI gpt-5 GPT-5 (Latest flagship model) βœ… Yes
gpt-4.1 GPT-4.1 (Main model) βœ… Yes
gpt-4.1-mini GPT-4.1 Mini (Lightweight) βœ… Yes
gpt-4.1-nano GPT-4.1 Nano (Ultra-light) βœ… Yes
gpt-4o GPT-4o (With image support) βœ… Yes
gpt-4o-mini GPT-4o Mini (Lightweight) βœ… Yes
Anthropic claude-sonnet-4-20250514 Claude 4 Sonnet βœ… Yes
claude-opus-4-20250514 Claude 4 Opus βœ… Yes
claude-3-7-sonnet-latest Claude 3.7 Sonnet βœ… Yes
claude-3-5-sonnet-latest Claude 3.5 Sonnet βœ… Yes
claude-3-5-haiku-latest Claude 3.5 Haiku ❌ No
Google gemini-2.5-pro Gemini 2.5 Pro Preview βœ… Yes
gemini-2.5-flash Gemini 2.5 Flash βœ… Yes
DeepSeek deepseek-reasoner DeepSeek V3 Reasoner ❌ No
deepseek-chat DeepSeek V3 Chat ❌ No
Meta meta-llama/llama-3-8b-instruct Meta: Llama 3 8B Instruct ❌ No
meta-llama/llama-3.1-8b-instruct Meta: Llama 3.1 8B Instruct ❌ No
Grok x-ai/grok-3-beta Grok 3 Beta ❌ No
NVIDIA nvidia/llama-3.1-nemotron-70b-instruct NVIDIA: Llama 3.1 Nemotron 70B ❌ No
Mistral mistralai/mistral-7b-instruct Mistral: Mistral 7B Instruct ❌ No

πŸ“ Note: Only OpenAI, Anthropic (Claude), and Google (Gemini) models support image input in chat requests. Other providers will return an error if images are included in the request.

🎨 Supported Image Generation Models

FLUX Models

Stable Diffusion Models

DALLΒ·E Models

Playground Models

Ideogram Models

πŸ›  Installation

Install via Composer:

πŸ”§ Requirements

πŸš€ Quick Start

πŸ“– Usage Examples

Basic Chat Completion

Advanced Configuration

Conversation with Multiple Messages

Understanding Chat Methods: chat() vs chatWithMessages()

MonicaAPI provides two main methods for chat interactions, each designed for different use cases:

Method Comparison

Feature chat() chatWithMessages()
Input Type string (simple text) ChatMessage[] (array of messages)
Use Case Single message Multiple messages in one request
Message Structure βœ… Auto-creates user message βœ… Full control over message roles
Image Support ❌ Text only βœ… Multimodal (text + images)
System Messages βœ… Via options parameter βœ… As separate ChatMessage objects
Complexity 🟒 Simple and quick 🟑 More setup required
Flexibility 🟑 Limited customization 🟒 Full control over message structure
Best For Quick queries, testing Complex messages, image analysis

When to Use chat()

Perfect for simple, standalone interactions:

When to Use chatWithMessages()

Essential for complex message structures:

Migration Guide

If you need to upgrade from chat() to chatWithMessages():

Chat with Images (Vision Models)

Vision-capable models like GPT-5 and GPT-4o can analyze and discuss images. Here are examples of how to upload images to chat:

Upload Image from File

Upload Image from URL

Upload Multiple Images

Upload Image from Base64

Advanced Image Chat Example

Working with Image Details

Supported Vision Models

The following models support image analysis:

Creating Messages from Array Data

You can create ChatMessage instances directly from array data using the fromArray() method. This is particularly useful when working with pre-structured message data or when integrating with existing systems that use OpenAI-compatible message formats.

Basic Usage

Multimodal Messages with Mixed Content

Working with Conversation Arrays

Helper Function for Batch Processing

Supported Array Structure

The fromArray() method supports the following message structure:

🎨 Image Generation Usage

Simple Image Generation

Advanced Image Generation

Model-Specific Examples

DALLΒ·E 3 with Quality Options

Ideogram V2 for Text and Logos

Playground V2.5 with Multiple Outputs

Model Management

Error Handling

Working with Response Data

πŸ”§ Configuration Options

Chat Completion Parameters

Parameter Type Description Range
system string System message to set AI behavior -
temperature float Controls randomness in responses 0.0 - 2.0
max_tokens int Maximum tokens in response 1 - model limit
top_p float Nucleus sampling parameter 0.0 - 1.0
frequency_penalty float Reduces repetition of frequent tokens -2.0 - 2.0
presence_penalty float Reduces repetition of any tokens -2.0 - 2.0

Example with All Parameters

πŸ— Laravel Integration

Service Provider Registration

Service Provider Example

Configuration

Environment Variables

Controller Example

πŸ§ͺ Testing

Run the test suite:

Run with coverage:

πŸ“š API Reference

MonicaClient

Constructor

Methods

ChatMessage

Static Constructors

Methods

ChatCompletionResponse

Methods

ImageGeneration

Constructor

Methods

ImageGenerationResponse

Methods

πŸ“ Changelog

[Unreleased]

Added

Changed

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

  1. Clone the repository
  2. Install dependencies: composer install
  3. Run tests: composer test
  4. Check code style: composer cs-check
  5. Fix code style: composer cs-fix

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ”— Links

πŸ’¬ Support

If you have any questions or need help, please:

  1. Check the documentation
  2. Search existing GitHub issues
  3. Create a new issue if needed

πŸ™ Acknowledgments


All versions of monica-api-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.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 tigusigalpa/monica-api-php contains the following files

Loading the files please wait ....