PHPackages                             kolasai/clean-talk-php-client - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kolasai/clean-talk-php-client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kolasai/clean-talk-php-client
=============================

Official Clean Talk client for PHP applications.

1.0.1(8mo ago)11Apache-2.0PHPPHP &gt;=7.1

Since Aug 20Pushed 8mo agoCompare

[ Source](https://github.com/kolasai/clean-talk-php-client)[ Packagist](https://packagist.org/packages/kolasai/clean-talk-php-client)[ Docs](https://kolas.ai/clean-talk/)[ RSS](/packages/kolasai-clean-talk-php-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Clean Talk PHP Client for Kolas.Ai Public API
=============================================

[](#clean-talk-php-client-for-kolasai-public-api)

Welcome to the **Kolas.Ai Public API** documentation! This repository hosts the PHP client for Kolas.Ai's Clean Talk public API, making it easy for developers to integrate Kolas.Ai’s machine learning services into your applications.

Overview
--------

[](#overview)

Clean Talk API is designed to classify message categories based on a trained dataset within a configured project. Use this API to accurately categorize messages into types like "Neutral", "Insult", "Spam" , etc. We support different languages, including English, Russian, Ukrainian, and we can add any languages by request (message to ).

### Key Features

[](#key-features)

- **Predict Message Categories**: Use the `/predictions/predict` endpoint to sync classify messages based on your project-specific datasets and `/predictions/asyncPredict` endpoint to async classify messages.
- **High Accuracy**: Predictions include probability scores, giving you confidence in the classification results.
- **OAuth2 Authentication**: Secure access via OAuth2 client credentials flow.

Usage
-----

[](#usage)

The Kolas.Ai API follows the OpenAPI 3.1 standard. To get started:

1. Create a new account on the [Kolas.Ai platform](https://app.kolas.ai/register).
2. Create a new project [Clean Talk](https://app.kolas.ai/projects/create) and configure your datasets.
3. **Authentication**: Obtain an access token using OAuth2 client credentials.
4. **Make Predictions**: Send a POST request to `/predictions/predict` (or `/predictions/asyncPredict`) with your `projectId` and messages.
5. **Receive Predictions**: Retrieve predicted categories and their probabilities in the API response.

Installation
------------

[](#installation)

You can install the CleanTalk PHP client via Composer. Run the following command in your project directory:

```
composer require kolasai/clean-talk-php-client
```

Authentication
--------------

[](#authentication)

This API uses **OAuth2 client credentials** for secure access. You’ll need to request a token using your client credentials from the Kolas.Ai platform.

```
use CleanTalk\KolasAiOAuthClient;

$oauthClient = new KolasAiOAuthClient();
$authResult = $oauthClient->auth(YOUR_CLIENT_ID, YOUR_CLIENT_SECRET);
```

`$authResult` contains the access token and expires\_in information, which you will use to authenticate your API requests. You need to update token after its expiration.

### Example for Sync Request

[](#example-for-sync-request)

Once you have your access token, you can make a request like this:

```
use CleanTalk\CleanTalkPredictionClient;
use CleanTalk\Request\Message;
use CleanTalk\Request\PredictRequest;

$client = new CleanTalkPredictionClient($authResult->getAccessToken());

$response = $client->predict(
    new PredictRequest(
        YOUR_PROJECT_ID,
        [
            new Message('11177c92-1266-4817-ace5-cda430481111', 'Hello world!'),
            new Message('22277c92-1266-4817-ace5-cda430482222', 'Good buy world!'),
        ]
    )
);

foreach ($response->getPredictions() as $prediction) {
echo "MessageId: {$prediction->getMessageId()}\n";
echo "Message: {$prediction->getMessage()}\n";
echo "Prediction: {$prediction->getPrediction()}\n";
echo "Probability: {$prediction->getProbability()}\n";
echo "Categories: " . implode(', ', $prediction->getCategories()) . "\n";
```

### Example Response

[](#example-response)

```
MessageId: 11177c92-1266-4817-ace5-cda430481111
Message: Hello world!
Prediction: Neutral
Probability: 0.9036153107882
Categories: Insult, Neutral, Spam

MessageId: 22277c92-1266-4817-ace5-cda430482222
Message: Good buy world!
Prediction: Neutral
Probability: 0.99374455213547
Categories: Insult, Neutral, Spam
```

### Example for Async Request

[](#example-for-async-request)

Once you have your access token, you can make a request like this:

```
use CleanTalk\CleanTalkPredictionClient;
use CleanTalk\Request\Message;
use CleanTalk\Request\PredictRequest;

$client = new CleanTalkPredictionClient($authResult->getAccessToken());
$client->asyncPredict(new PredictRequest(
    YOUR_PROJECT_ID,
    [
        new Message('11177c92-1266-4817-ace5-cda430481111', 'Hello world!'),
        new Message('22277c92-1266-4817-ace5-cda430482222', 'Good buy world!'),
    ]
));
```

Responses will be sent to the configured webhook URL in your project settings.

Documentation Links
-------------------

[](#documentation-links)

- [Kolas.Ai OpenAPI schema](https://github.com/kolasai/public-openapi): Explore our OpenAPI specification.
- [Kolas.Ai Platform Documentation](https://kolas.ai/documentation/): Learn more about configuring projects and using Kolas.Ai’s platform.

License
-------

[](#license)

This API specification is released under the **Apache 2.0 License**. See the [LICENSE](https://www.apache.org/licenses/LICENSE-2.0.html) for more details.

\_\_

Feel free to explore, test, and integrate Kolas.Ai's API, and reach out with any questions!

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance58

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

2

Last Release

268d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fc78fe34da199464a2f8c9578b788cb87a6b76f33f045ddfa252696f8cb3e297?d=identicon)[kolasai](/maintainers/kolasai)

---

Top Contributors

[![kolasai](https://avatars.githubusercontent.com/u/180081888?v=4)](https://github.com/kolasai "kolasai (8 commits)")

---

Tags

aiclassificationclassifieranti-spamartificial intelligencekolasaianti-insultclean talk

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kolasai-clean-talk-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/kolasai-clean-talk-php-client/health.svg)](https://phpackages.com/packages/kolasai-clean-talk-php-client)
```

###  Alternatives

[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.4M28](/packages/rubix-ml)[maestroerror/laragent

Power of AI Agents in your Laravel project

630106.4k](/packages/maestroerror-laragent)[ardagnsrn/ollama-php

This is a PHP library for Ollama. Ollama is an open-source project that serves as a powerful and user-friendly platform for running LLMs on your local machine. It acts as a bridge between the complexities of LLM technology and the desire for an accessible and customizable AI experience.

20755.8k](/packages/ardagnsrn-ollama-php)[soukicz/llm

LLM client with support for cache, tools and async requests

445.6k](/packages/soukicz-llm)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
