PHPackages                             aisdk/huggingface - 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. aisdk/huggingface

ActiveLibrary

aisdk/huggingface
=================

Official HuggingFace provider for the PHP AI SDK.

v0.8.1(yesterday)01↑2900%MITPHP ^8.3

Since Jul 22Compare

[ Source](https://github.com/phpaisdk/huggingface)[ Packagist](https://packagist.org/packages/aisdk/huggingface)[ Docs](https://github.com/phpaisdk/huggingface)[ Fund](https://opencollective.com/phpaisdk)[ RSS](/packages/aisdk-huggingface/feed)WikiDiscussions Synced today

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

aisdk/huggingface
=================

[](#aisdkhuggingface)

[![GitHub Workflow Status](https://camo.githubusercontent.com/eaa808cf23a143f217c30c86b9277b833a88a0bd8e9419166132d9a27e757491/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706870616973646b2f68756767696e67666163652f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d5465737473)](https://github.com/phpaisdk/huggingface/actions)[![Latest Version](https://camo.githubusercontent.com/b85fc55b460642cf6a990ca3b3c92e0e8a4a1758cf70b93b2da91bb2d78c8d26/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616973646b2f68756767696e6766616365)](https://packagist.org/packages/aisdk/huggingface)[![License](https://camo.githubusercontent.com/9b1e762ab3509ce322659f63002594042cdb9394ff67771922ed7856ca020ea7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616973646b2f68756767696e6766616365)](https://packagist.org/packages/aisdk/huggingface)

---

Official Hugging Face provider for the PHP AI SDK. Uses Hugging Face Inference Providers' OpenAI-compatible router.

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

[](#installation)

```
composer require aisdk/huggingface
```

Basic Usage
-----------

[](#basic-usage)

```
use AiSdk\Generate;
use AiSdk\HuggingFace;

HuggingFace::create(['apiKey' => $_ENV['HF_TOKEN']]);

$result = Generate::text('Explain this code briefly.')
    ->model(HuggingFace::model('openai/gpt-oss-120b:fastest'))
    ->run();
```

Configuration
-------------

[](#configuration)

VariableDescriptionDefault`HF_TOKEN`Hugging Face access tokenRequired`HUGGINGFACE_BASE_URL`Base URL for API requests`https://router.huggingface.co/v1`Supported Capabilities
----------------------

[](#supported-capabilities)

CapabilitySupportText generation and streamingNative OpenAI-compatible routerTool calling, structured output, reasoning, image inputPassed through for supported routed modelsThe OpenAI-compatible router package is chat-only. Use a Hugging Face native client for other task types. Use `providerOptions('huggingface', ['raw' => [...]])` for native router fields.

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

[](#documentation)

- [Hugging Face Inference Providers documentation](https://huggingface.co/docs/inference-providers/en/index)
- [PHP AI SDK documentation](https://phpaisdk.com/docs/huggingface)

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

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 ~0 days

Total

2

Last Release

1d ago

### Community

Maintainers

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

---

Tags

aihuggingfaceglmopenai-compatibleaisdk

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/aisdk-huggingface/health.svg)

```
[![Health](https://phpackages.com/badges/aisdk-huggingface/health.svg)](https://phpackages.com/packages/aisdk-huggingface)
```

PHPackages © 2026

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