PHPackages                             savanto/ai-sdk - 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. savanto/ai-sdk

ActiveLibrary[API Development](/categories/api)

savanto/ai-sdk
==============

PHP SDK for the Savanto API — auto-generated from the OpenAPI spec

v1.0.0(1mo ago)00MITPHPPHP ^8.1

Since May 1Pushed 1mo agoCompare

[ Source](https://github.com/SavantoAI/ai-sdk-php)[ Packagist](https://packagist.org/packages/savanto/ai-sdk)[ Docs](https://github.com/SavantoAI/ai-sdk-php)[ RSS](/packages/savanto-ai-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

savanto/ai-sdk
==============

[](#savantoai-sdk)

Official PHP SDK for [Savanto](https://savanto.ai) — AI-powered search, chat, recommendations, and knowledge base management.

Auto-generated from the [Savanto OpenAPI spec](https://savanto.ai/docs/api) using [OpenAPI Generator](https://openapi-generator.tech).

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Guzzle &gt;= 7.3
- Extensions: `curl`, `json`, `mbstring`

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

[](#installation)

```
composer require savanto/ai-sdk
```

Quick Start
-----------

[](#quick-start)

```
use Savanto\AI\Api\ProductsApi;
use Savanto\AI\Api\ChatApi;
use Savanto\AI\Configuration;
use Savanto\AI\Model\ProductSearchRequest;
use GuzzleHttp\Client;

$config = Configuration::getDefaultConfiguration()
    ->setApiKey('Authorization', 'Bearer if_sk_your_secret_key');

$client = new Client();

// Search products
$api = new ProductsApi($client, $config);
$request = new ProductSearchRequest(['query' => 'warm jacket', 'limit' => 10]);
$result = $api->searchProducts($request);

// Chat
$chatApi = new ChatApi($client, $config);
$chatRequest = new \Savanto\AI\Model\ChatRequest([
    'message' => 'What shoes do you recommend?',
    'thread_id' => 'thread-1',
]);
$response = $chatApi->chat($chatRequest);
```

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

[](#authentication)

Pass your API key via the Configuration object:

```
$config = Configuration::getDefaultConfiguration()
    ->setApiKey('Authorization', 'Bearer if_sk_...');
```

Key TypePrefixUse**Secret**`if_sk_`Server-side only. Full access to all endpoints.**Publishable**`if_pk_`Safe for client-side. Limited to search, chat, feedback, and prompts.Available API Classes
---------------------

[](#available-api-classes)

ClassDescription`ProductsApi`CRUD, search, bulk operations for products`PostsApi`CRUD, search, bulk operations for posts`ChatApi`Send chat messages (supports NDJSON streaming)`PromptsApi`Manage conversation prompts`TaxonomiesApi`Manage taxonomy terms`FeedbackApi`Submit and query user feedback`ThreadsApi`Search, export, and manage threads`WebhooksApi`Create, list, test, and manage webhooks`AnalyticsApi`Search, chat, and feedback analytics`RecommendationsApi`AI-powered product recommendations`CrawlApi`Website crawling and configuration`ScrapeApi`Single-page scraping`APIKeysApi`Create, list, rotate, and revoke API keys`ProvisioningApi`Tenant provisioning and billingExamples
--------

[](#examples)

### Products

[](#products)

```
use Savanto\AI\Api\ProductsApi;
use Savanto\AI\Model\ProductInput;
use Savanto\AI\Model\ProductSearchRequest;

$api = new ProductsApi($client, $config);

// Upsert
$product = new ProductInput([
    'id' => 'prod-1',
    'name' => 'Running Shoes',
    'price' => 99.99,
    'categories' => ['footwear'],
]);
$api->upsertProduct($product);

// Search
$request = new ProductSearchRequest(['query' => 'blue shoes', 'limit' => 10]);
$results = $api->searchProducts($request);

// Get by ID
$product = $api->getProduct('prod-1');

// Delete
$api->deleteProduct('prod-1');
```

### Feedback

[](#feedback)

```
use Savanto\AI\Api\FeedbackApi;
use Savanto\AI\Model\FeedbackSubmission;

$api = new FeedbackApi($client, $config);

$feedback = new FeedbackSubmission([
    'thread_id' => 'thread-1',
    'message_index' => 0,
    'rating' => 5,
    'comment' => 'Very helpful!',
]);
$api->submitFeedback($feedback);
```

### Webhooks

[](#webhooks)

```
use Savanto\AI\Api\WebhooksApi;
use Savanto\AI\Model\CreateWebhookInput;

$api = new WebhooksApi($client, $config);

$webhook = new CreateWebhookInput([
    'name' => 'Inventory sync',
    'url' => 'https://example.com/hook',
    'events' => ['product.upsert'],
]);
$api->createWebhook($webhook);

// List
$webhooks = $api->listWebhooks();

// Test
$result = $api->testWebhook('webhook-1');
```

Error Handling
--------------

[](#error-handling)

```
use Savanto\AI\ApiException;

try {
    $product = $api->getProduct('nonexistent');
} catch (ApiException $e) {
    echo 'Status: ' . $e->getCode() . "\n";
    echo 'Message: ' . $e->getMessage() . "\n";
    echo 'Body: ' . $e->getResponseBody() . "\n";
}
```

API Reference
-------------

[](#api-reference)

Full endpoint documentation with request/response schemas:

**[savanto.ai/docs/api](https://savanto.ai/docs/api)**

Regeneration
------------

[](#regeneration)

The SDK is auto-generated from the OpenAPI spec. To regenerate after API changes:

```
cd cloud && npm run openapi            # extract spec to cloud/openapi.json
cd sdks/php && composer generate       # regenerate src/ via Docker
```

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance92

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

39d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/488921?v=4)[Sean Desmond](/maintainers/seandesmond)[@seandesmond](https://github.com/seandesmond)

---

Top Contributors

[![seandesmond](https://avatars.githubusercontent.com/u/488921?v=4)](https://github.com/seandesmond "seandesmond (1 commits)")

---

Tags

searchsdkopenapiaiecommercesavanto

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/savanto-ai-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/savanto-ai-sdk/health.svg)](https://phpackages.com/packages/savanto-ai-sdk)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k532.1M2.5k](/packages/aws-aws-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

232.5k](/packages/eslazarev-wildberries-sdk)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[yoti/yoti-php-sdk

Yoti SDK for quickly integrating your PHP backend with Yoti

27565.3k1](/packages/yoti-yoti-php-sdk)[jdcloud-api/jdcloud-sdk-php

JDCloud SDK for PHP

105.2k](/packages/jdcloud-api-jdcloud-sdk-php)

PHPackages © 2026

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