Skip to main content

Admin Pricing — Python 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 partner_id (the admin's partner id, available from admin.auth.info()).

Available Operations​

MethodDescription
list_provider_models()List the platform model catalog (paginated, filterable)
save_provider_model()Create or update a platform model
set_provider_model_listed()List or unlist a platform model
update_provider_model_price()Set a platform model's price configuration
list_price_factors()List pricing factors and units
list_user_model_prices()List a customer's per-model prices
save_user_model_price()Create or override a customer's model price
set_user_model_listed()List or unlist a model for a customer
set_discount()Apply a percentage discount to a customer's models

list_provider_models​

List the platform model catalog, paginated and filterable. partner_id is required by the backend.

Example Usage​

partner_id = admin.auth.info()["partnerId"]

page = admin.pricing.list_provider_models(partner_id=partner_id, page_num=1, page_size=20)
print(f"total: {page['total']}")
for m in page["list"]:
print(m["id"], m["modelId"], m["provider"], m["resaleStatus"])

Filter by model type:

page = admin.pricing.list_provider_models(partner_id=partner_id, model_type="LLM")

Parameters​

ParameterTypeRequiredDefaultDescription
partner_idintYes--Admin's partner id (from auth.info())
model_typestrNo--Filter by model type
providerstrNo--Filter by provider
statusAnyNo--Filter by status
page_numintNo--Page number, starting from 1
page_sizeintNo--Items per page

Additional backend-supported filters may be passed as extra keyword arguments.

Response​

Returns a page dict 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 partner_id
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession expired and refresh failed

save_provider_model​

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
entry = admin.pricing.list_provider_models(partner_id=partner_id, page_size=1)["list"][0]
body = {k: v for k, v in entry.items() if v is not None}
body["sortNum"] = 5
ok = admin.pricing.save_provider_model(body)
print(ok) # True

Parameters​

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

Response​

Returns bool — True on success.

Errors​

CodeExceptionWhen
1001ValidationErrorMalformed or incomplete body
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession expired and refresh failed

set_provider_model_listed​

List or unlist a platform model. resale_status is the platform listing-status code.

Example Usage​

ok = admin.pricing.set_provider_model_listed(id=1490, resale_status=1)
print(ok) # True

Parameters​

ParameterTypeRequiredDefaultDescription
idintYes--Model id
resale_statusintYes--Listing-status code

Response​

Returns bool — True on success.

Errors​

CodeExceptionWhen
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession expired and refresh failed

update_provider_model_price​

Set a platform model's price configuration. The request body is passed through unchanged.

Example Usage​

ok = admin.pricing.update_provider_model_price({"id": 1490, "priceExtend": {...}})
print(ok) # True

Parameters​

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

Response​

Returns bool — True on success.

Errors​

CodeExceptionWhen
1001ValidationErrorMalformed price payload
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession expired and refresh failed

list_price_factors​

List pricing factors and units. When model_type is provided, results are scoped to that type.

Example Usage​

factors = admin.pricing.list_price_factors()
for f in factors:
print(f)

# Scoped to a model type
llm_factors = admin.pricing.list_price_factors(model_type="LLM")

Parameters​

ParameterTypeRequiredDefaultDescription
model_typestrNo--Scope factors to a model type

Response​

Returns a list of pricing-factor entries.

Errors​

CodeExceptionWhen
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession expired and refresh failed

list_user_model_prices​

List a customer's per-model prices, paginated. partner_id is required by the backend.

Example Usage​

page = admin.pricing.list_user_model_prices(
partner_id=partner_id, user_id=42, page_num=1, page_size=20,
)
for row in page["list"]:
print(row)

Parameters​

ParameterTypeRequiredDefaultDescription
partner_idintYes--Admin's partner id (from auth.info())
user_idintNo--Target customer id
model_namestrNo--Filter by model name
page_numintNo--Page number, starting from 1
page_sizeintNo--Items per page

Response​

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

Errors​

CodeExceptionWhen
1001ValidationErrorMissing partner_id
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession expired and refresh failed

save_user_model_price​

Create or override a customer's model price. The request body is passed through unchanged.

Example Usage​

ok = admin.pricing.save_user_model_price({
"userId": 42,
"partnerId": partner_id,
"modelId": 1490,
})
print(ok) # True

Parameters​

ParameterTypeRequiredDefaultDescription
bodydictYes--Per-customer price payload

Response​

Returns bool — True on success.

Errors​

CodeExceptionWhen
1001ValidationErrorMalformed body
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession expired and refresh failed

set_user_model_listed​

List or unlist a model for a specific customer. resale_status is the listing-status code.

Example Usage​

ok = admin.pricing.set_user_model_listed(id=880, resale_status=1)
print(ok) # True

Parameters​

ParameterTypeRequiredDefaultDescription
idintYes--User-model price id
resale_statusintYes--Listing-status code

Response​

Returns bool — True on success.

Errors​

CodeExceptionWhen
2007PermissionErrorAdmin lacks Pricing Management permission
3001AuthenticationErrorSession expired and refresh failed

set_discount​

Apply a percentage discount to a customer's models. discount is a string — "10" means 10% off.

Example Usage​

ok = admin.pricing.set_discount(
partner_id=partner_id,
user_id=42,
discount="10",
model_ids=[1490, 1491],
)
print(ok) # True

Parameters​

ParameterTypeRequiredDefaultDescription
partner_idintNo--Target partner id
user_idintNo--Target customer id
discountstrYes--Percentage string, e.g. "10" = 10% off
model_idslistYes--Model ids to apply the discount to

Response​

Returns bool — True on success.

Errors​

CodeExceptionWhen
1001ValidationErrorEmpty model_ids 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