Lottle7/dsh-quota ↗★ 1

dsh-quota

提供多服务商额度、余额与消耗看板 适合需要监控和分析多模型API使用成本与路由状态的用户。

套件
dsh-quota
相容性
待驗證
Harness 依賴範圍
0.1.0-rc.6
Cordis 依賴範圍
4.0.1
版本
0.8.0
授權
MIT
最近更新
2026年8月26日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Lottle7/dsh-quota

Configuration

The Host settings namespace is dsh-quota:

dsh-quota:
  enabled: true
  refreshIntervalMs: 60000
  warningBalanceBelow: 10
  warningQuotaRemainingBelow: 0.2
  usageRetentionDays: 90

  # Use an explicit mapping when a custom route name cannot be identified.
  routeMappings:
    my-company-openrouter: openrouter

  providerEnabled:
    minimax-cn: true
    minimax-intl: true
    deepseek-official: true
    openrouter: true
    siliconflow: true
    moonshot: true
    zhipu: true
    alibaba-bailian: true
    volcengine-ark: true
    together: true
    fireworks: true

  customProviders:
    # Local accounting only: no remote request and no extra credential.
    - id: my-company-relay
      displayName: My Company Relay
      kind: local
      description: Internal model gateway
      region: Global
      brandColor: "#2563eb"
      routeAliases: [my-relay, company-llm]
      modelVendors: [deepseek, qwen]

    # Restricted public HTTPS JSON account endpoint.
    - id: acme-billing
      displayName: ACME Billing
      kind: http-json
      endpoint: https://billing.example.com/v1/account
      credentialRef: ACME_API_KEY
      auth: bearer                 # bearer | x-api-key | none
      balancePath: data.balance
      usagePath: data.usage
      limitPath: data.limit
      remainingPath: data.remaining
      currency: USD
      valueScale: 1
      routeAliases: [acme, acme-relay]

  pricing:
    default:
      inputCacheHitPerMTokCNY: 0
      inputCacheMissPerMTokCNY: 0
      outputPerMTokCNY: 0
    overrides: {}
    peakHours:
      weekdays: []
      windows: []
      timezone: Asia/Shanghai

usageRetentionDays accepts 30–3650 days and controls the Host ledger retention window. The dashboard queries the latest 30 days by default.

Custom providers

Use kind: local for a relay or private route without an account endpoint. It makes no remote request and attributes DSH Tokens and local prices to that billing provider.

Use kind: http-json to map a restricted JSON account endpoint into balance, provider usage, and a spending limit. The four mapping fields are safe dot paths: for {"data":{"balance":"42.5"}}, use balancePath: data.balance. Configure at least one path. Numeric strings are accepted, and valueScale multiplies every mapped value (for example, use 0.001 when the upstream unit is one-thousandth of the configured currency).

credentialRef names a DSH Host credential/environment reference; it is never the literal key. Store the same reference through DSH credentials or provide it to the Host environment that starts dsh web. Custom IDs can also be used in providerEnabled and routeMappings. Live Host-settings changes rebuild the registry and provider cards without changing the current Session model.

Prices and budgets are estimates/alerts only: they never block a model call or modify a provider bill. An empty peakHours.windows disables time-based discounts. Browser price and budget overrides stay in localStorage; model prices take precedence over matching Host prices and neither preference contains credentials.