Download the PHP package jazz-max/yandex-ai-laravel without Composer

On this page you can find all versions of the php package jazz-max/yandex-ai-laravel. 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 yandex-ai-laravel

Yandex AI Laravel SDK

Laravel SDK for Yandex AI Studio — text generation (Responses API), Vision OCR, and Embeddings.

Installation

Publish config:

Add to .env:

Quick Start

API Clients

Responses API

Method Description
create(array $params) Text generation
stream(array $params, Closure $onDelta) Streaming generation
continue(string $prevId, array $input) Multi-turn dialog
submitToolOutput(string $prevId, string $callId, string $output) Function calling follow-up
createBackground(array $params) Background async task
retrieve(string $id) Get background task status
poll(string $id, int $timeout) Poll until complete
formatModel(string $model) Add gpt://folder_id/ prefix
supportsReasoning(string $model) Check Pro model
calculateCostRub(...) Cost in RUB

Vision OCR

Method Description
recognizeText(string $data, OcrModel $model) Sync image OCR
recognizeDocument(string $pdfData, OcrModel $model) Async PDF OCR

Available models (OcrModel enum):

Embeddings

Method Description
embedDocument(string $text) Document vector (for indexing)
embedQuery(string $text) Query vector (for searching)
cosineSimilarity(array $a, array $b) Vector similarity

Function Calling

Note: Yandex models sometimes return function calls as plain text instead of proper function_call items. The SDK includes a fallback parser that automatically extracts them. Check $response->isFallbackFunctionCall to detect this. Disable via YANDEX_AI_FUNCTION_CALL_FALLBACK=false.

Known Gotchas

See docs/GOTCHAS.md for production-tested pitfalls:

  1. Tool descriptions must be short (< 15 words, English) or models write calls as text
  2. Never use empty properties — always include a dummy property
  3. Auth header is Api-Key, not Bearer
  4. Models require URI format: gpt://folder_id/model
  5. Only gemma-3-27b-it supports images, and only via base64
  6. Prices are RUB per 1000 tokens, not USD per 1M
  7. Cached tokens cost 50% of prompt price
  8. Async OCR returns JSON Lines, not JSON array
  9. handwritten/table models only support ru/en

Configuration

All options in config/yandex-ai.php:

Key Default Description
api_key API key
folder_id Cloud folder ID
base_url https://ai.api.cloud.yandex.net/v1 API base URL
ocr_base_url https://ocr.api.cloud.yandex.net/ocr/v1 OCR API URL
timeout 120 HTTP timeout (seconds)
proxy null HTTP proxy URL
default_model yandexgpt-5-lite Default generation model
pricing RUB per 1000 tokens per model
ocr_pricing RUB per image per OCR model

Examples

See examples/ directory:

Claude Code Skill

If you use Claude Code, install the companion skill (jazz-max/yandex-ai-laravel-skill) for expert guidance on this SDK:

The skill provides full API reference, code examples, and knows all Yandex API gotchas.

Example prompts that activate the skill:

Add YandexGPT text generation to my Laravel app with streaming support

Build a document recognition feature using Yandex Vision OCR for passports and driver licenses

Implement semantic search with Yandex Embeddings and cosine similarity

Set up function calling with Yandex AI Studio in my Laravel project

Подключи Yandex AI Studio к моему Laravel-проекту и сделай artisan-команду для генерации текста через YandexGPT

Добавь распознавание документов через Yandex Vision OCR с поддержкой паспортов и водительских удостоверений

Реализуй семантический поиск по базе статей с помощью Yandex Embeddings

License

MIT


All versions of yandex-ai-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
guzzlehttp/guzzle Version ^7.0
illuminate/support Version ^11.0|^12.0|^13.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 jazz-max/yandex-ai-laravel contains the following files

Loading the files please wait ...