Skip to main content

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​

MethodDescription
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​

ParameterTypeRequiredDefaultDescription
partnerIdnumberYes--Admin's partner id (from auth.info())
modelTypestringNo--Filter by model type
pageNumnumberNo--Page number, starting from 1
pageSizenumberNo--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​

CodeExceptionWhen
1001ValidationErrorMissing partnerId
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession 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​

ParameterTypeRequiredDefaultDescription
bodyobjectYes--Model catalog payload; include id to update an existing entry

Response​

Returns boolean — true on success.

Errors​

CodeExceptionWhen
1001ValidationErrorMalformed or incomplete body
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession 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​

ParameterTypeRequiredDefaultDescription
idnumberYes--Model id (positional argument)
resaleStatusnumberYes--Listing-status code (positional argument)

Response​

Returns boolean — true on success.

Errors​

CodeExceptionWhen
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession 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​

ParameterTypeRequiredDefaultDescription
bodyobjectYes--Price-configuration payload for the target model

Response​

Returns boolean — true on success.

Errors​

CodeExceptionWhen
1001ValidationErrorMalformed price payload
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession 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​

ParameterTypeRequiredDefaultDescription
modelTypestringNo--Scope factors to a model type (positional argument)

Response​

Returns an array of pricing-factor entries.

Errors​

CodeExceptionWhen
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession 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​

ParameterTypeRequiredDefaultDescription
partnerIdnumberYes--Admin's partner id (from auth.info())
userIdnumberNo--Target customer id
pageNumnumberNo--Page number, starting from 1
pageSizenumberNo--Items per page

Response​

Returns a page object with total, list, totalPages, currentPage, pageSize.

Errors​

CodeExceptionWhen
1001ValidationErrorMissing partnerId
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession 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​

ParameterTypeRequiredDefaultDescription
bodyobjectYes--Per-customer price payload

Response​

Returns boolean — true on success.

Errors​

CodeExceptionWhen
1001ValidationErrorMalformed body
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession 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​

ParameterTypeRequiredDefaultDescription
idnumberYes--User-model price id (positional argument)
resaleStatusnumberYes--Listing-status code (positional argument)

Response​

Returns boolean — true on success.

Errors​

CodeExceptionWhen
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession 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​

ParameterTypeRequiredDefaultDescription
partnerIdnumberNo--Target partner id
userIdnumberNo--Target customer id
discountstringYes--Percentage string, e.g. "10" = 10% off
modelIdsnumber[]Yes--Model ids to apply the discount to

Response​

Returns boolean — true on success.

Errors​

CodeExceptionWhen
1001ValidationErrorEmpty modelIds or invalid discount
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession expired and refresh failed
Server 4xxWltErrorA target model is not listed or has no standard price configured