Download the PHP package 0xmergen/zai-laravel-sdk without Composer

On this page you can find all versions of the php package 0xmergen/zai-laravel-sdk. 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 zai-laravel-sdk

ZAI Laravel SDK

Latest Version Total Downloads PHP Laravel

A powerful, elegant Laravel SDK for Z.AI (Zhipu AI) API. Integrate advanced AI capabilities including chat completion, image generation, and OCR layout parsing into your Laravel applications with type-safe DTOs, fluent interfaces, and comprehensive error handling.

Features

Requirements

Installation

Install the package via Composer:

Configuration

Publish the configuration file:

Add your API key to your .env file:

You can obtain an API key from https://api.z.ai

Optional Configuration

All configuration options in config/zai-sdk.php have sensible defaults:

Usage

Chat Completion

Basic Chat

With Parameters

Streaming Responses

Thinking Mode

Enable reasoning for complex tasks (supported models only):

Function / Tool Calling

JSON Mode

Force JSON output:

Image Generation

Basic Image Generation

Custom Size and Quality

Multiple Images

OCR / Layout Parsing

Extract structured data from PDFs and images:

Dependency Injection

Artisan Command

Check your SDK configuration:

Output:

Available Models

Chat Models

Model Context Max Tokens Thinking Tools Vision
glm-4.7 128K 131,072
glm-4.7-flash 128K 131,072
glm-4.7-flashx 128K 131,072
glm-4.6 200K 131,072
glm-4.6v-flash 128K 131,072
glm-4.5 128K 98,304
glm-4.5-air 128K 98,304
glm-4.5-x 128K 98,304
glm-4.5-airx 128K 98,304
glm-4.5-flash 128K 98,304
glm-4-32b-0414-128k 128K 16,384

Image Models

Model Default Size Max Size HD Quality
glm-image 1280x1280 2048x2048
cogview-4-250304 1024x1024 2048x2048

OCR Models

Model Supported Formats Max Pages
glm-ocr PDF, JPG, PNG 100

Error Handling

The SDK provides structured exceptions for different error scenarios:

Testing

The package includes Pest tests. Run them with:

Or via Pest directly:

Changelog

Please see CHANGELOG.md for recent changes.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see LICENSE for more information.

Author

Made with ❤️ by 0xmergen


All versions of zai-laravel-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/support Version ^12.0
illuminate/contracts Version ^12.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 0xmergen/zai-laravel-sdk contains the following files

Loading the files please wait ...