PHPackages                             byjg/llm-api-objects - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. byjg/llm-api-objects

ActiveLibrary[API Development](/categories/api)

byjg/llm-api-objects
====================

Strongly-typed PHP objects for LLM API request payloads

6.0.0(3mo ago)0331MITPHPPHP &gt;=8.3CI failing

Since Mar 6Pushed 3mo agoCompare

[ Source](https://github.com/byjg/php-llm-api-objects)[ Packagist](https://packagist.org/packages/byjg/llm-api-objects)[ GitHub Sponsors](https://github.com/byjg)[ RSS](/packages/byjg-llm-api-objects/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (1)

   sidebar\_key llm-api-objects   tags    php

 ai

    LLM API Objects
===============

[](#llm-api-objects)

Strongly-typed PHP model layer for building OpenAI Chat Completions API request payloads. Works with both OpenAI and Ollama (via the `/v1` OpenAI-compatible endpoint) using the [`openai-php/client`](https://github.com/openai-php/client).

[![Sponsor](https://camo.githubusercontent.com/fab14b7f7f475072ada0473f193d6f322561fd4a2958e0cc89910d053347cf27/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d2532336561346161613f6c6f676f3d67697468756273706f6e736f7273266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d306431313137)](https://github.com/sponsors/byjg)[![Build Status](https://github.com/byjg/llm-api-objects/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/llm-api-objects/actions/workflows/phpunit.yml)[![Opensource ByJG](https://camo.githubusercontent.com/425c1bbccc0f292bf4d20569ae74a6b2e384fd648f1af8911bc61de9a8dcfc0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e736f757263652d62796a672d737563636573732e737667)](http://opensource.byjg.com)[![GitHub source](https://camo.githubusercontent.com/88e61eb211719144efdd570290a0456b6e13099c2df8d973f1bb43fe33bf0039/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769746875622d736f757263652d696e666f726d6174696f6e616c3f6c6f676f3d676974687562)](https://github.com/byjg/llm-api-objects/)[![GitHub license](https://camo.githubusercontent.com/fa432d439fc6d6aef7c8b2b9f806614e1fda4dc3afae18341a01963d1413cda2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62796a672f6c6c6d2d6170692d6f626a656374732e737667)](https://opensource.byjg.com/opensource/licensing.html)[![GitHub release](https://camo.githubusercontent.com/d55ee3b2a37e1a822675848082bc8f11f809f001fcdc1d5d25b12b8ab5ada66f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f62796a672f6c6c6d2d6170692d6f626a656374732e737667)](https://github.com/byjg/llm-api-objects/releases/)

Features
--------

[](#features)

- Strongly-typed models for Chat Completions requests
- Full support for function calling (tools): `Tool`, `ToolFunction`, `ToolParameter`, `ToolChoice`
- Multi-turn conversations with `role=tool` messages and `tool_call_id`
- Automatic message splitting when content exceeds a token limit
- Delimiter-based message partitioning
- Compatible with OpenAI and Ollama (`/v1` endpoint)
- Ollama model tuning parameters via `ModelFileParameters`
- Jira XML/RSS importers to seed conversation context

Documentation
-------------

[](#documentation)

- [Getting Started](docs/getting-started.md) — Installation and first request
- [Chat Model](docs/chat.md) — Building and sending chat requests
- [Messages](docs/messages.md) — Roles, content, `tool_call_id`, `tool_calls`
- [Tools](docs/tools.md) — Function calling: Tool, ToolFunction, ToolParameter, ToolChoice
- [Model Parameters](docs/model-parameters.md) — Ollama model tuning parameters
- [Importers](docs/importers.md) — Jira XML/RSS importers

Quick Examples
--------------

[](#quick-examples)

### Basic chat with OpenAI

[](#basic-chat-with-openai)

```
