Search

CN-121981725-A - Multi-model dynamic switching and usage charging system and charging method

CN121981725ACN 121981725 ACN121981725 ACN 121981725ACN-121981725-A

Abstract

The invention relates to a multi-model dynamic switching and consumption charging system and a charging method, comprising a model registration center, a BYOK management module, a quota charging engine, a model loader and a unified API adaptation layer, wherein the model registration center is used for managing model configuration of a plurality of AI providers, the BYOK management module is used for encrypting and storing API keys carried by users and using the API keys carried by the users, the quota charging engine is used for carrying out independent quota management on different types of user requirements based on a rolling period, the model loader is used for dynamically acquiring the model configuration according to BYOK priority, the unified API adaptation layer is used for converting request and/or response formats of different model providers, and the user requirements comprise text requirements and picture requirements. The invention can realize safe storage and preferential use of the self-carried secret key (BYOK) of the user, fair charging of a rolling charging period, independent management of Token and image quota, unified registration and dynamic switching of a multi-provider model, layered subscription and quota real-time monitoring.

Inventors

  • Qian Haowei

Assignees

  • 曜澜智能信息科技(上海)有限公司

Dates

Publication Date
20260505
Application Date
20260123

Claims (10)

  1. 1. A multi-model dynamic switching and consumption charging system is characterized by comprising the following components; a model registry for managing model configurations of a plurality of AI providers; BYOK the management module is used for encrypting and storing the self-contained API key of the user and using the self-contained API key of the user; the quota charging engine is used for performing independent quota management on different types of user demands based on the rolling period; The model loader is used for dynamically acquiring model configuration according to BYOK priorities; A unified API adaptation layer for converting request and/or response formats of different model providers; The user requirements include text requirements and picture requirements.
  2. 2. The system for multi-model dynamic switching and usage billing according to claim 1, wherein the encryption storage in BYOK management module comprises encrypted storage of user API key using Fernet symmetric encryption algorithm; the encryption key in the encryption storage process is injected through the environment variable, and the decryption of the encryption key is only executed when the API is actually called.
  3. 3. The multi-model dynamic switching and consumption charging system according to claim 1, wherein the quota in the independent quota management at least comprises a Token quota and an image quota, and the Token quota and the image quota are calculated independently of each other and are not affected by each other.
  4. 4. The system of claim 1, wherein the rolling cycle is calculated by taking the upgrade time or registration time of the user package as a starting point, calculating the number of days from the starting point to the current time, dividing the number of days by a preset number of days, and obtaining the number of completed cycles by taking the whole down, wherein the starting point of the current cycle is the initial starting point + the number of completed cycles is the preset number of days.
  5. 5. The system of claim 1, wherein BYOK is configured to check whether the user configures the custom API key of the target model, then determine whether the user configures the target model, load the target model configured by the user when the user configures the target model, and load the default configuration of the target model when the user does not configure the target model.
  6. 6. The system of claim 1, wherein the unified API adapter layer comprises OpenAI compatible format adapters, anthropic format adapters, gemini format adapters, volcanic engine adapters, and a plurality of expansion interfaces for expanding the connection format adapters.
  7. 7. The multi-model dynamic switching and usage billing system of claim 2 wherein the Fernet symmetric encryption algorithm comprises AES-128-CBC and HMAC-SHA256.
  8. 8. A charging method, which is applied to the multi-model dynamic switching and consumption charging system as claimed in claims 1-7, and is characterized by comprising the following steps, The method comprises the steps of receiving a model calling request of a user, obtaining model configuration according to BYOK priority, calling by using a user key if the model is in a BYOK mode, not counting platform quota, calling after checking independent quota if the model is in a platform mode, recording the usage, and automatically resetting the quota based on a rolling preset period.
  9. 9. The method of claim 8, further comprising the step of providing API key pre-verification, wherein the API key pre-verification comprises the steps of calling a model list () to verify when an input format or a called model is OpenAI compatible, sending a test message to verify when the input format or the called model is Anthropic, verifying signature validity when the input format or the called model is volcanic, and returning a list of available models for confirmation by a user when the input format can be simultaneously adapted to a plurality of models.
  10. 10. The method for charging according to claim 8, further comprising performing parameter adjustment, loading/unloading, price adjustment and score management on the model through a model registry.

Description

Multi-model dynamic switching and usage charging system and charging method Technical Field The invention relates to the technical field of artificial intelligence, in particular to a multi-model dynamic switching and usage charging system. Background With the rapid development of Large Language Model (LLM) technology, LLM-based Agent systems have gained widespread attention in enterprise applications. At present, the multi-agent cooperation system mainly comprises the following technical schemes: (1) Single model binding problem The conventional AI service platform usually only supports a single model provider, and a user cannot select an optimal model according to task characteristics, and cannot use an API quota purchased by the user. (2) Unfairness of natural month charging Traditional SaaS platforms employ natural monthly billing (1 day per month-end of month), resulting in a complete monthly quota not being available to subscribed users in the month. For example, the user subscribes to the professional edition 12 months and 15 days, resets quota at the end of month, and only 16 days of use time is actually counted as complete month fee (3) API key secure storage problem The user needs to store the API secret key safely, the plaintext storage has leakage risk, and the traditional encryption scheme is difficult to manage in a multi-tenant environment. (4) Quota management rough questions Existing systems typically merge text Token and image generation quota calculations, resulting in users that may only need text dialog but be blocked by image quota exhaustion, failing to set differentiated quota for different resource types (5) Multiple vendor unified access problem Different AI providers have different API formats, authentication modes, error code definitions, and integration costs are high. Disclosure of Invention The invention aims to overcome the defects of the prior art, provides a multi-model dynamic switching and consumption charging system, and aims to solve the defects of confusion and low safety in the prior art. The invention relates to a multimode dynamic switching and consumption charging system, which comprises; a model registry for managing model configurations of a plurality of AI providers; BYOK the management module is used for encrypting and storing the self-contained API key of the user and using the self-contained API key of the user; the quota charging engine is used for performing independent quota management on different types of user demands based on the rolling period; The model loader is used for dynamically acquiring model configuration according to BYOK priorities; A unified API adaptation layer for converting request and/or response formats of different model providers; The user requirements include text requirements and picture requirements. Further, the encryption storage in the BYOK management module includes encrypting and storing the user API key by adopting Fernet symmetric encryption algorithm; the encryption key in the encryption storage process is injected through the environment variable, and the decryption of the encryption key is only executed when the API is actually called. Further, the quota in the independent quota management at least comprises a Token quota and an image quota, and the Token quota and the image quota are calculated independently and are not affected by each other. Further, the method for calculating the scrolling period includes the steps of taking the upgrading time or the registration time of a user package as a starting point, calculating the number of days from the starting point to the current time, rounding down and dividing the number of days by a preset number of days to obtain the number of completed periods, and enabling the starting point=the initial starting point+the number of completed periods to be multiplied by the preset number of days. Further, the BYOK priority logic is to first check whether the user configures the custom API key of the target model, then determine whether the user performs custom configuration on the target model, load the target model configured by the user when the user performs custom configuration, and load the default configuration of the target model when the user does not perform custom configuration. Further, the unified API-adapting layer comprises OpenAI compatible format adapters, anthropic format adapters, gemini format adapters, volcanic engine adapters and a plurality of expansion interfaces, wherein the expansion interfaces are used for expanding the connection format adapters. Further, the Fernet symmetric encryption algorithm includes AES-128-CBC and HMAC-SHA256. A charging method is applied to the multi-model dynamic switching and usage charging system, and comprises the following steps, The method comprises the steps of receiving a model calling request of a user, obtaining model configuration according to BYOK priority, calling by using a user key if the model is in a BYOK mode, not