Qingpu User Settings API
This module provides a theme-private PostgreSQL settings bucket for the qingpu theme. It stores per-user workbench preferences in a single qingpu_settings table instead of scattering new global keys into APayShop's settings table.
Setup
- Configure
QINGPU_DATABASE_URLor reuseDATABASE_URL. - Execute the SQL file at
app/themes/qingpu/database/settings.sql. - Use
/api/qingpu/settingsto read and write shared Qingpu settings.
Storage Rules
- Settings are isolated by
user_id. - The root JSON document lives in
qingpu_settings.settings. - Listing model preferences are currently stored under
listing.modelSettings. - Future listing, collect, publish, or workflow preferences should continue to expand the same JSON bucket instead of creating one-off tables.
1. Get Qingpu Base Settings
- Endpoint:
/api/qingpu/settings - Method:
GET - Authentication: Required (User Session or Bearer tenant key)
This general endpoint enforces authentication and tenant isolation, but does not require the Listing feature grant. The legacy /api/qingpu/listing/settings endpoint remains available for older clients and still belongs to the Listing permission scope.
Success Response
{
"code": 0,
"persisted": true,
"data": {
"generalModelApiKey": "sk-live-xxxx",
"generalModelBaseUrl": "https://api.openai.com/v1",
"generalModelName": "gpt-4.1-mini",
"imageModelName": "gpt-image-1",
"imageGenSize": "1008x1344",
"imageGenQuality": "medium",
"imageProviderProfiles": [
{
"id": "imgp_demo",
"name": "HD Portrait",
"model": "gpt-image-1",
"size": "1024x1536",
"quality": "high"
}
],
"activeImageProfileId": "imgp_demo",
"videoModelName": "veo-3-fast",
"videoGenQuality": "medium",
"translationModelName": "gpt-4.1-mini",
"offerIdPrefix": "QP",
"exchangeRate": 12.5,
"commissionRate": 0.15,
"freightCny": 5,
"domesticFeeCny": 2,
"profitRate": 0.2,
"oldPriceMarkupRate": 0.3,
"frontDiscountRate": 0.23076923076923075,
"priceRoundRule": "to9",
"storageFeeRub": 0,
"storageMonths": 1,
"adBudgetRub": 0,
"adRate": 0,
"otherRate": 0.03,
"returnRate": 0.05,
"translationGlossary": [
{ "source": "storage box", "target": "коробка для хранения" },
{ "source": "thickened", "target": "утолщенный" }
]
}
}
persisted=truemeans the current user has already saved a cloud copy.persisted=falsemeans the API is returning server defaults because no cloud record exists yet.oldPriceMarkupRateis the old-price markup over the selling price and defaults to0.3, so a selling price of100produces an old price of130.frontDiscountRateis a derived compatibility field for the shared engine and should not be edited by clients.
2. Save Qingpu Base Settings
- Endpoint:
/api/qingpu/settings - Method:
POST - Authentication: Required (User Session or Bearer tenant key)
Request Body
{
"generalModelApiKey": "sk-live-xxxx",
"generalModelBaseUrl": "https://api.openai.com/v1",
"generalModelName": "gpt-4.1-mini",
"imageModelName": "gpt-image-1",
"imageGenSize": "1008x1344",
"imageGenQuality": "high",
"imageProviderProfiles": [
{
"id": "imgp_demo",
"name": "HD Portrait",
"model": "gpt-image-1",
"size": "1024x1536",
"quality": "high"
}
],
"activeImageProfileId": "imgp_demo",
"videoModelName": "veo-3-fast",
"videoGenQuality": "medium",
"translationModelName": "gpt-4.1-mini",
"offerIdPrefix": "QP",
"exchangeRate": 12.5,
"commissionRate": 0.15,
"freightCny": 5,
"domesticFeeCny": 2,
"profitRate": 0.2,
"oldPriceMarkupRate": 0.3,
"priceRoundRule": "to9",
"storageFeeRub": 0,
"storageMonths": 1,
"adBudgetRub": 0,
"adRate": 0,
"otherRate": 0.03,
"returnRate": 0.05,
"translationGlossary": [
{ "source": "storage box", "target": "коробка для хранения" },
{ "source": "thickened", "target": "утолщенный" }
]
}
Success Response
{
"code": 0,
"message": "Listing model settings saved successfully",
"data": {
"generalModelApiKey": "sk-live-xxxx",
"generalModelBaseUrl": "https://api.openai.com/v1",
"generalModelName": "gpt-4.1-mini",
"imageModelName": "gpt-image-1",
"imageGenSize": "1008x1344",
"imageGenQuality": "high",
"imageProviderProfiles": [
{
"id": "imgp_demo",
"name": "HD Portrait",
"model": "gpt-image-1",
"size": "1024x1536",
"quality": "high"
}
],
"activeImageProfileId": "imgp_demo",
"videoModelName": "veo-3-fast",
"videoGenQuality": "medium",
"translationModelName": "gpt-4.1-mini",
"offerIdPrefix": "QP",
"exchangeRate": 12.5,
"commissionRate": 0.15,
"freightCny": 5,
"domesticFeeCny": 2,
"profitRate": 0.2,
"oldPriceMarkupRate": 0.3,
"frontDiscountRate": 0.23076923076923075,
"priceRoundRule": "to9",
"storageFeeRub": 0,
"storageMonths": 1,
"adBudgetRub": 0,
"adRate": 0,
"otherRate": 0.03,
"returnRate": 0.05,
"translationGlossary": [
{ "source": "storage box", "target": "коробка для хранения" },
{ "source": "thickened", "target": "утолщенный" }
]
}
}
Notes
imageGenSizesupports:auto,1008x1344,1024x1536,768x1024,1024x1024,1536x1024imageGenQualityandvideoGenQualitysupport:auto,low,medium,highimageProviderProfilesis optional and stores reusable image presets;activeImageProfileIdpoints to the current presetofferIdPrefix,exchangeRate,commissionRate, and related numeric fields store the default pricing inputs shared by Dash and the web settings pagetranslationGlossarystores user-managed fixed terminology and stays separate from the local runtimetranslationMemorycache- Empty model names are allowed and mean "fall back to the general model or future workflow defaults"