UCloud logo UCloud logo UCloud
v2026.7.0-k8s.18
  1. UCloud/Core
  2. 1. Introduction
  3. 2. Projects
  4. 3. API Tokens
    1. 3.1. Platform API Tokens
    2. 3.2. Provider API Tokens
  5. 4. Accounting
  6. 5. Orchestration
  7. 6. Frontend
  8. UCloud/IM for Slurm-based HPC
  9. 7. Installation
  10. 8. Architecture and Networking
  11. 9. User and Project Management
  12. 10. Filesystem Integration
    1. 10.1. Inter-provider file transfers
  13. 11. Slurm Integration
    1. 11.1. Application Management
    2. 11.2. Built-in Applications
  14. 12. Reference
    1. 12.1. Configuration
    2. 12.2. CLI
  15. 13. Appendix
    1. 13.1. Built-in Application Index
  16. UCloud/IM for Kubernetes
  17. 14. Installation
  18. 15. Architecture and Networking
  19. 16. Filesystem Integration
  20. 17. Compute Jobs
    1. 17.1. Networks
    2. 17.2. Public Links
    3. 17.3. Public IPs
    4. 17.4. License Servers
    5. 17.5. SSH Servers
    6. 17.6. Job Audit Log
    7. 17.7. Virtual machines
  21. 18. AI Inference
    1. 18.1. Architecture
    2. 18.2. Chat Middleware
    3. 18.3. Chat Playground
    4. 18.4. Model Discovery and Catalog
    5. 18.5. Dynamo Deployments
    6. 18.6. Usage and Accounting
    7. 18.7. Audit
    8. 18.8. Metrics
    9. 18.9. Security
  22. 19. Integrated applications
    1. 19.1. Syncthing
    2. 19.2. Integrated terminal
    3. 19.3. Kubernetes clusters
      1. 19.3.1. Architecture
      2. 19.3.2. Stacks
      3. 19.3.3. Creating a cluster
      4. 19.3.4. Cluster dashboard
      5. 19.3.5. Networking and storage
      6. 19.3.6. Maintenance and upgrades
      7. 19.3.7. Backup and recovery
      8. 19.3.8. Reference
  23. 20. UCX applications
    1. 20.1. Hello world
    2. 20.2. Data binding
    3. 20.3. UI events
    4. 20.4. Component reference
    5. 20.5. API reference
  24. 21. Reference
    1. 21.1. Configuration
    2. 21.2. CLI
  25. Style guidelines
  26. 22. Branding and identity for UCloud
  27. 23. Documentation
  28. H: Procedures
  29. 24. H: Procedures
  30. 25. H: Introduction
  31. 26. H: Auditing
  32. 27. H: Auditing scenario
  33. 28. H: GitHub actions
  34. 29. H: Deployment
  35. 30. H: 3rd party dependencies (risk assesment)
  36. Glossary
  37. 31. Glossary
  1. Links
  2. Source Code
  3. Releases

Usage and Accounting

Inference is an accounting product with the unit Credit. The price of a model is fixed point Credits per one million tokens, in three parts: cached input, input, and output. The operator sets the price on the catalog entry, and the default for a discovered model is one Credit per million tokens. See Model Discovery and Catalog.

The Integration Module reads the token usage that the backend reports for each request. It splits the usage into the three parts, multiplies each part by the price of the model, and reports the result to the accounting system against the wallet of the caller. A user pays from the personal wallet, and a request from a project pays from the project wallet. The three parts follow the price of the model, so a model with a cached input price of zero makes a cached request cheaper.

flowchart TB
    catalog["Catalog entry<br/>Price | Credits per million tokens"]:::diagram-provider-document-text
    backend["Backend server<br/>OpenAI compatible"]:::diagram-provider-server
    middleware["Middleware<br/>Chat"]:::diagram-provider-cog-6-tooth
    database["Database<br/>Usage and charges"]:::diagram-provider-circle-stack
    reporter["Reporting loop<br/>Every 10 seconds"]:::diagram-provider-cog-6-tooth
    core["UCloud/Core<br/>Accounting"]:::diagram-external-ucloud
    wallet["Wallet<br/>Credits"]:::diagram-external-calculator

    catalog -->|"price"| middleware
    backend -->|"token usage"| middleware
    middleware -->|"charge"| database
    database -->|"pending charges"| reporter
    reporter -->|"cumulative charge"| core
    core -.->|"rejected report"| database
    core -->|"debits"| wallet

How a charge travels from the backend to the wallet of the caller. The charge is stored before it is reported, so a report that UCloud/Core rejects stays pending. It does not show the price of a single model.

Cancelled streaming requests can incur estimated charges when the backend does not report usage.

Reporting and retries

The Integration Module saves token totals and charges in its database before it reports charges to UCloud/Core. It keeps fractional remainders across requests, so small charges are not lost through rounding.

A background loop sends cumulative charges for each wallet owner. New usage wakes the loop. A timer also runs every ten seconds. The Integration Module marks a charge as reported only after UCloud/Core accepts it. Failed reports remain pending for a later retry, including after an Integration Module restart.

Previous Dynamo Deployments
Next Audit