Admin Pricing — TypeScript SDK
Model pricing: the platform model catalog, per-customer prices, listing status, discounts, and pricing factors.
Overview
The admin Pricing resource manages how models are exposed and priced. It covers two layers:
- Platform catalog — the models an admin can list/unlist and price for the whole tenant.
- Per-customer prices — model prices and listing status scoped to a single end-customer, plus percentage discounts.
Accessed via admin.pricing.
Several read methods require partnerId (the admin's partner id, available from admin.auth.info()).
Available Operations
| Method | Description |
|---|---|
listProviderModels() | List the platform model catalog (paginated, filterable) |
saveProviderModel() | Create or update a platform model |
setProviderModelListed() | List or unlist a platform model |
updateProviderModelPrice() | Set a platform model's price configuration |
listPriceFactors() | List pricing factors and units |
listUserModelPrices() | List a customer's per-model prices |
saveUserModelPrice() | Create or override a customer's model price |
setUserModelListed() | List or unlist a model for a customer |
setDiscount() | Apply a percentage discount to a customer's models |
listProviderModels
List the platform model catalog, paginated and filterable. partnerId is required by the backend.
Example Usage
const { partnerId } = await admin.auth.info();
const page = await admin.pricing.listProviderModels({ partnerId, pageNum: 1, pageSize: 20 });
console.log(`total: ${page.total}`);
for (const m of page.list) {
console.log(m.id, m.modelId, m.provider, m.resaleStatus);
}
Filter by model type:
const page = await admin.pricing.listProviderModels({ partnerId, modelType: 'LLM' });
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| partnerId | number | Yes | -- | Admin's partner id (from auth.info()) |
| modelType | string | No | -- | Filter by model type |
| pageNum | number | No | -- | Page number, starting from 1 |
| pageSize | number | No | -- | Items per page |
Additional backend-supported filters may be passed through unchanged.
Response
Returns a page object with total, list, totalPages, currentPage, pageSize. Each item exposes id, modelId, modelType, provider, providerName, endpoint, resaleStatus, sortNum, priceExtend, and related catalog fields.
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Missing partnerId |
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session expired and refresh failed |
saveProviderModel
Create or update a platform model. The request body is passed through unchanged; when it carries an id, the matching model is updated.
Example Usage
// Update the sort order of an existing catalog entry, preserving other fields
const [entry] = (await admin.pricing.listProviderModels({ partnerId, pageSize: 1 })).list;
const ok = await admin.pricing.saveProviderModel({ ...entry, sortNum: 5 });
console.log(ok); // true
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| body | object | Yes | -- | Model catalog payload; include id to update an existing entry |
Response
Returns boolean — true on success.
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Malformed or incomplete body |
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session expired and refresh failed |
setProviderModelListed
List or unlist a platform model. resaleStatus is the platform listing-status code.
Example Usage
const ok = await admin.pricing.setProviderModelListed(1490, 1);
console.log(ok); // true
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | number | Yes | -- | Model id (positional argument) |
| resaleStatus | number | Yes | -- | Listing-status code (positional argument) |
Response
Returns boolean — true on success.
Errors
| Code | Exception | When |
|---|---|---|
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session expired and refresh failed |
updateProviderModelPrice
Set a platform model's price configuration. The request body is passed through unchanged.
Example Usage
const ok = await admin.pricing.updateProviderModelPrice({ id: 1490, priceExtend: { /* ... */ } });
console.log(ok); // true
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| body | object | Yes | -- | Price-configuration payload for the target model |
Response
Returns boolean — true on success.
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Malformed price payload |
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session expired and refresh failed |
listPriceFactors
List pricing factors and units. When modelType is provided, results are scoped to that type.
Example Usage
const factors = await admin.pricing.listPriceFactors();
console.log(factors);
// Scoped to a model type
const llmFactors = await admin.pricing.listPriceFactors('LLM');
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| modelType | string | No | -- | Scope factors to a model type (positional argument) |
Response
Returns an array of pricing-factor entries.
Errors
| Code | Exception | When |
|---|---|---|
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session expired and refresh failed |
listUserModelPrices
List a customer's per-model prices, paginated. partnerId is required by the backend.
Example Usage
const page = await admin.pricing.listUserModelPrices({
partnerId, userId: 42, pageNum: 1, pageSize: 20,
});
for (const row of page.list) {
console.log(row);
}
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| partnerId | number | Yes | -- | Admin's partner id (from auth.info()) |
| userId | number | No | -- | Target customer id |
| pageNum | number | No | -- | Page number, starting from 1 |
| pageSize | number | No | -- | Items per page |
Response
Returns a page object with total, list, totalPages, currentPage, pageSize.
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Missing partnerId |
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session expired and refresh failed |
saveUserModelPrice
Create or override a customer's model price. The request body is passed through unchanged.
Example Usage
const ok = await admin.pricing.saveUserModelPrice({
userId: 42,
partnerId,
modelId: 1490,
});
console.log(ok); // true
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| body | object | Yes | -- | Per-customer price payload |
Response
Returns boolean — true on success.
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Malformed body |
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session expired and refresh failed |
setUserModelListed
List or unlist a model for a specific customer. resaleStatus is the listing-status code.
Example Usage
const ok = await admin.pricing.setUserModelListed(880, 1);
console.log(ok); // true
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | number | Yes | -- | User-model price id (positional argument) |
| resaleStatus | number | Yes | -- | Listing-status code (positional argument) |
Response
Returns boolean — true on success.
Errors
| Code | Exception | When |
|---|---|---|
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session expired and refresh failed |
setDiscount
Apply a percentage discount to a customer's models. discount is a string — "10" means 10% off.
Example Usage
const ok = await admin.pricing.setDiscount({
partnerId,
userId: 42,
discount: '10',
modelIds: [1490, 1491],
});
console.log(ok); // true
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| partnerId | number | No | -- | Target partner id |
| userId | number | No | -- | Target customer id |
| discount | string | Yes | -- | Percentage string, e.g. "10" = 10% off |
| modelIds | number[] | Yes | -- | Model ids to apply the discount to |
Response
Returns boolean — true on success.
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Empty modelIds or invalid discount |
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session expired and refresh failed |
| Server 4xx | WltError | A target model is not listed or has no standard price configured |