---
title: "Qingpu User Settings"
canonical_url: "https://ainode.run/docs/qingpu-settings"
type: "doc"
locale: "en"
description: "Theme-private general user settings bucket for Qingpu"
---

# Qingpu User Settings
> Theme-private general user settings bucket for Qingpu

# 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

1. Configure `QINGPU_DATABASE_URL` or reuse `DATABASE_URL`.
2. Execute the SQL file at `app/themes/qingpu/database/settings.sql`.
3. Use `/api/qingpu/settings` to 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

```json
{
  "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=true` means the current user has already saved a cloud copy.
- `persisted=false` means the API is returning server defaults because no cloud record exists yet.
- `oldPriceMarkupRate` is the old-price markup over the selling price and defaults to `0.3`, so a selling price of `100` produces an old price of `130`. `frontDiscountRate` is 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

```json
{
  "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

```json
{
  "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

- `imageGenSize` supports: `auto`, `1008x1344`, `1024x1536`, `768x1024`, `1024x1024`, `1536x1024`
- `imageGenQuality` and `videoGenQuality` support: `auto`, `low`, `medium`, `high`
- `imageProviderProfiles` is optional and stores reusable image presets; `activeImageProfileId` points to the current preset
- `offerIdPrefix`, `exchangeRate`, `commissionRate`, and related numeric fields store the default pricing inputs shared by Dash and the web settings page
- `translationGlossary` stores user-managed fixed terminology and stays separate from the local runtime `translationMemory` cache
- Empty model names are allowed and mean "fall back to the general model or future workflow defaults"
