adachsoft / model-pricing-source-zai
Z.ai model pricing source for model-pricing-lib
Package info
gitlab.com/a.adach/model-pricing-source-zai
pkg:composer/adachsoft/model-pricing-source-zai
Requires
- php: ^8.3
- adachsoft/model-pricing-contracts: ^0.4
- psr/http-client: ^1.0
- psr/http-factory: ^1.1
Requires (Dev)
- adachsoft/model-pricing-lib: ^0.1.0
- adachsoft/php-code-style: ^0.7.3
- friendsofphp/php-cs-fixer: ^3.95
- guzzlehttp/psr7: ^2.7
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^12.5
- rector/rector: ^2.8
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-17 20:32:25 UTC
README
A provider adapter for retrieving model pricing from Z.ai's official Markdown pricing page and converting supported token-pricing tables into validated price sheets for adachsoft/model-pricing-lib.
Features
- Fetches pricing data using PSR-18 HTTP clients and PSR-17 request factories.
- Parses supported input, cached-input, and output token prices.
- Produces validated price sheets compatible with the model pricing contracts.
- Reports fetch, parsing, and validation failures as
PriceSourceException.
Requirements
- PHP 8.3 or later.
- A PSR-18 HTTP client and a PSR-17 request factory supplied by your application.
Installation
Install this library alongside a PSR-18 client and PSR-17 request factory:
composer require adachsoft/model-pricing-source-zai
Usage
Create a ZaiPriceSource with your HTTP client and request factory, then call fetchPriceSheets() with the timestamp to associate with the fetched data. See usage examples.
The adapter reads the official Z.ai Markdown pricing page by default. Its URL can be overridden when constructing ZaiPricingPageFetcher, which is useful for testing or controlled deployments.