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
| Method | Description |
|---|---|
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| partner_id | int | Yes | -- | Admin's partner id (from auth.info()) |
| model_type | str | No | -- | Filter by model type |
| provider | str | No | -- | Filter by provider |
| status | Any | No | -- | Filter by status |
| page_num | int | No | -- | Page number, starting from 1 |
| page_size | int | No | -- | 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
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Missing partner_id |
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| body | dict | Yes | -- | Model catalog payload; include id to update an existing entry |
Response
Returns bool — 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 |
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | int | Yes | -- | Model id |
| resale_status | int | Yes | -- | Listing-status code |
Response
Returns bool — True on success.
Errors
| Code | Exception | When |
|---|---|---|
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| body | dict | Yes | -- | Price-configuration payload for the target model |
Response
Returns bool — 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 |
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| model_type | str | No | -- | Scope factors to a model type |
Response
Returns a list of pricing-factor entries.
Errors
| Code | Exception | When |
|---|---|---|
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| partner_id | int | Yes | -- | Admin's partner id (from auth.info()) |
| user_id | int | No | -- | Target customer id |
| model_name | str | No | -- | Filter by model name |
| page_num | int | No | -- | Page number, starting from 1 |
| page_size | int | No | -- | Items per page |
Response
Returns a page dict with total, list, totalPages, currentPage, pageSize.
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Missing partner_id |
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| body | dict | Yes | -- | Per-customer price payload |
Response
Returns bool — 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 |
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | int | Yes | -- | User-model price id |
| resale_status | int | Yes | -- | Listing-status code |
Response
Returns bool — True on success.
Errors
| Code | Exception | When |
|---|---|---|
2007 | PermissionError | Admin lacks Pricing Management permission |
3001 | AuthenticationError | Session 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| partner_id | int | No | -- | Target partner id |
| user_id | int | No | -- | Target customer id |
| discount | str | Yes | -- | Percentage string, e.g. "10" = 10% off |
| model_ids | list | Yes | -- | Model ids to apply the discount to |
Response
Returns bool — True on success.
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Empty model_ids 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 |