Large model API service cost settlement method and system based on SAAS

By providing a variety of resource packages and real-time deduction mechanisms on the SAAS platform, the problems of unpredictable user costs and complex calculation logic in the pricing method of large-model API services are solved, and the simplification and cost control of billing per person is achieved.

CN119295068AInactive Publication Date: 2025-01-10SHENZHEN AOSI NETWORK TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411803357.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-01-10
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The pricing method of existing large-model API services is based on the length of TOKEN, which leads to unpredictable user usage costs and complex calculation logic, making it difficult for users to control the final usage costs.

Method used

Provide a large-model API service fee settlement method based on SAAS. By providing a variety of resource packages on the SAAS service platform, users choose to purchase and generate orders, deduct fees in real time based on the number of API calls, and through resource package management module and notification module Perform margin checks and notifications to ensure that users are aware of usage.

Benefits of technology

The billing logic is simplified, and users only need to pay based on the actual number of uses, avoiding the uncertain costs caused by TOKEN billing and improving cost control capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295068A_ABST
    Figure CN119295068A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a large model API service cost settlement method and system based on an SAAS, and the method and system are applied to an SAAS service platform, and the SAAS service platform provides a plurality of resource packages for a user to select and purchase according to the large model service function and the computing power consumed by the service. The method comprises the following steps: after a user selects and purchases a certain resource bundle, generating and recording a corresponding resource bundle order for the user; after a request, sent by a user through an HTTP / HTTPS protocol, for calling the large model API is received, the API calling permission and the resource packet balance are checked; and if the verification is passed, executing the operation requested by the user, and performing real-time fee deduction from the resource bundle order according to the calling times. According to the embodiment of the invention, the charging logic is greatly simplified by means of pricing according to times. A user does not need to know internal function details and price structures, and only needs to select and use the service package according to own requirements. Meanwhile, charging according to times can better reflect the actual use condition of the user, and the problem that charging according to TOKEN brings uncertain cost to the user in the past is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of artificial intelligence technology, and specifically to a SAAS-based large-model API service fee settlement method and system. Background Art

[0002] With the development of artificial intelligence technology and AI big model level, a large number of software companies provide big model services to users through SAAS+API, and the main pricing method is to calculate costs and prices based on the length of TOKEN. In the fields of big models, natural language processing and machine learning, TOKEN refers to the smallest unit obtained after the text is segmented and encoded. When the big model processes natural language text, the text is generally segmented into words or subwords, and then these words or subwords are converted into numerical values ​​that the model can understand for representation. This process is called "tokenization". Each word or subword is represented as a unique integer after conversion, which is the TOKEN. Therefore, in large pre-trained language models, TOKEN represents the smallest unit in the text, which is used to input and process text data after encoding. By converting text into a TOKEN sequence, the model can better understand the semantic and grammatical structure of the text, thereby achieving good performance in various natural language processing tasks.

[0003] However, when using TOKEN to calculate the price of paid services, the user's usage cost is heavily dependent on the length of the data content of the user input and the output of the large model processing. In addition, there is uncertainty about the length of the user input and the output of the large model, resulting in the end user's usage cost being unable to be effectively controlled.

[0004] The current market practice of using tokens to price large model API services has the following limitations:

[0005] 1) User usage costs are unpredictable: Due to the uncertainty of user input and the length of large model output content, the cost consumed by each user calling the service cannot be accurately predicted. Users can only know their single usage cost after using it;

[0006] 2) The cost calculation logic is complex and the cost of use is high: Since the cost of use is calculated based on TOKEN, the cost calculation logic becomes extremely complex, and users need to learn to understand and master its calculation logic. Summary of the invention

[0007] To this end, an embodiment of the present invention provides a SAAS-based large model API service fee settlement method and system to solve the technical problems of unpredictable user usage costs and complex fee calculation logic in the existing technology of pricing large model API services through tokens.

[0008] In order to achieve the above purpose, the embodiment of the present invention provides the following technical solutions:

[0009] According to a first aspect of an embodiment of the present invention, a SAAS-based large model API service fee settlement method is provided, the method is applied to a SAAS service platform, the SAAS service platform provides a variety of resource packages for users to choose to purchase according to the large model service functions and the computing power consumed by the service; the method includes:

[0010] After the user selects and purchases a resource package, the SAAS service platform generates and records the corresponding resource package order for the user;

[0011] After receiving the request to call the big model API sent by the user through the HTTP / HTTPS protocol, check the API call permission and resource package balance: determine whether the big model to be called matches the big model included in the resource package purchased by the user, and whether there are remaining usage times for the resource package;

[0012] If the verification is passed, the SAAS service platform calls the corresponding big model API to perform the operation requested by the user, and deducts the fee from the resource package order under the user's name in real time according to the number of calls to the big model API;

[0013] If the test fails, a corresponding prompt message is generated and returned to the user.

[0014] Furthermore, the method further comprises:

[0015] Each resource package provided by the SAAS service platform corresponds to a computing power and contains at least one usable big model. There are differentiated pricing for a single call to a big model under various resource packages. The SAAS service platform calls the corresponding big model API to call the default big model of the resource package purchased by the user, or the big model pre-selected by the user from multiple big models included in the resource package purchased.

[0016] Furthermore, the user's resource package order will be charged in real time according to the number of calls to the large model API, including:

[0017] Get the number of calls to the large model API;

[0018] Get the remaining amount of resource packages from the valid resource package orders;

[0019] Determine whether the number of calls is greater than the remaining amount of the resource package;

[0020] If the number of calls is greater than the remaining amount of the resource package, the user's resource package is insufficient, and an email and SMS are sent to the user to inform him that the remaining amount of the computing power service resource package is insufficient;

[0021] If the number of calls is less than or equal to the resource package balance, the fee will be deducted from the valid resource package order under the user's name in real time according to the number of calls.

[0022] Furthermore, the user's resource package order will be charged in real time according to the number of calls to the large model API, including:

[0023] Determine whether the remaining amount of the resource package is 0;

[0024] If the remaining balance of the resource package is 0, the user's computing power service resource package has been consumed, and an email and text message are sent to the user to inform him that the computing power service resource package has been used up and needs to be purchased again.

[0025] Furthermore, the method of sending emails and text messages to users is that the SAAS service platform performs asynchronous processing through a message queue.

[0026] Furthermore, after receiving a request to call the large model API sent by the user via the HTTP / HTTPS protocol, the API call authority and resource package balance are checked, which also includes:

[0027] Get user account information;

[0028] Detecting whether there is a valid resource package from the user account information;

[0029] If there is a valid resource package in the user account information, the fee will be deducted in real time according to the number of calls, and API services will be provided to the user;

[0030] If there is no valid resource package in the user account information, the user is informed that there is no valid resource package under his name.

[0031] Furthermore, the method further comprises:

[0032] When the user's API call is completed, obtain the resource package change information;

[0033] Obtaining the remaining amount of resource packages using the resource package change information;

[0034] Determine whether the remaining amount of the resource package is less than a preset threshold;

[0035] If the resource package surplus is greater than or equal to a preset threshold, the resource package surplus is sufficient;

[0036] If the remaining amount of the resource package is less than the preset threshold, then the remaining amount of the user's resource package is insufficient, and the user is reminded to purchase it in time.

[0037] Furthermore, the method further comprises:

[0038] The request for calling the large model API contains the user's access token. The SAAS service platform performs identity authentication based on the access token. After the authentication is passed, the resource package under the user account is checked.

[0039] Furthermore, the method further includes: after the service is completed, obtaining the service fee and sending the service fee and resource package balance information to the user account.

[0040] According to a second aspect of an embodiment of the present invention, a SAAS-based large model API service fee settlement system is provided, the system comprising:

[0041] Application service unit and middleware / database service unit, specifically including:

[0042] The application service unit includes:

[0043] Resource package management module, used to provide internal resource package management capabilities;

[0044] The order / valid resource package module is used to provide external service purchase functions;

[0045] Large model API service module, used to provide large model API services to the outside world;

[0046] Notification module, used to provide external notification capabilities;

[0047] The middleware / database service unit includes:

[0048] Resource package packages, used to store and provide valid resource package packages;

[0049] Order data, used to create / manage valid resource orders and store valid resource packages.

[0050] The embodiments of the present invention have the following advantages:

[0051] The embodiment of the present invention is applied to a SAAS service platform, and the SAAS service platform provides a variety of resource packages for users to choose and purchase according to the large model service function and the computing power consumed by the service; the method includes: after the user selects and purchases a certain resource package, the SAAS service platform generates and records the corresponding resource package order for the user; after receiving the request for calling the large model API sent by the user through the HTTP / HTTPS protocol, the API call authority and the resource package balance are checked: whether the large model to be called matches the large model contained in the resource package purchased by the user, and whether the resource package has a remaining number of uses; if the check is passed, the SAAS service platform calls the corresponding large model API, executes the operation requested by the user, and deducts the fee in real time from the resource package order under the user's name according to the number of calls to the large model API; if the check fails, the corresponding prompt information is generated and returned to the user. The embodiment of the present invention packages the SAAS large model API service according to the function to form different service packages. The user only needs to select the service package to be used and pay according to the actual number of uses to use the service function provided by the SAAS large model API. This pay-per-use method greatly simplifies the billing logic. Users do not need to understand the internal function details and price structure, they only need to choose and use the service package according to their needs. At the same time, pay-per-use can better reflect the actual usage of users, avoiding the problem of uncertain costs for users caused by previous TOKEN billing. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.

[0053] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.

[0054] Figure 1 A schematic diagram of the logical structure of a SAAS-based large-model API service fee settlement system provided in an embodiment of the present invention;

[0055] Figure 2A flowchart of a SAAS-based large-model API service fee settlement method provided in an embodiment of the present invention;

[0056] Figure 3 A schematic diagram of an application service of a SAAS-based large model API service fee settlement method provided by an embodiment of the present invention;

[0057] Figure 4 A schematic diagram of an example of resource package and API call price design in a SAAS-based large-model API service fee settlement method provided in an embodiment of the present invention;

[0058] Figure 5 A schematic diagram of data flow in a SAAS-based large-model API service fee settlement method provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0059] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0060] With the development of artificial intelligence technology and AI big model level, a large number of software companies provide big model services to users through SAAS+API, and the main pricing method is to calculate costs and prices based on the length of TOKEN. In the fields of big models, natural language processing and machine learning, TOKEN refers to the smallest unit obtained after the text is segmented and encoded. When the big model processes natural language text, the text is generally segmented into words or subwords, and then these words or subwords are converted into numerical values ​​that the model can understand for representation. This process is called "tokenization". Each word or subword is represented as a unique integer after conversion, which is the TOKEN. Therefore, in large pre-trained language models, TOKEN represents the smallest unit in the text, which is used to input and process text data after encoding. By converting text into a TOKEN sequence, the model can better understand the semantic and grammatical structure of the text, thereby achieving good performance in various natural language processing tasks.

[0061] However, when using TOKEN to calculate the price of paid services, the user's usage cost is heavily dependent on the length of the data content of the user input and the output of the large model processing. In addition, there is uncertainty about the length of the user input and the output of the large model, resulting in the end user's usage cost being unable to be effectively controlled.

[0062] In order to solve the technical problems of unpredictable user usage costs and complex fee calculation logic in the above-mentioned method of pricing large model API services through tokens.

[0063] refer to Figure 1 and Figure 3 The embodiment of the present invention discloses a SAAS-based large model API service fee settlement system, which includes an application service unit 100 and a middleware / database service unit 200, specifically including: the application service unit 100 includes: a resource package management module 101, which is used to provide resource package management capabilities internally; an order / valid resource package module 102, which is used to provide service purchase functions externally; a large model API service module 103, which is used to provide large model API services externally; a notification module 104, which is used to provide notification capabilities externally.

[0064] The middleware / database service unit 200 includes: a resource package storage module 201 for storing and providing valid resource package packages; an order data storage module 202 for creating / managing valid resource orders and storing valid resource packages, see Figure 1 and Figure 3 .

[0065] By providing a pay-per-use method for service packages, the pricing method of SAAS large model API services is simplified, reducing the complexity of service pricing and user usage costs.

[0066] Corresponding to the SAAS-based large model API service fee settlement system disclosed above, the embodiment of the present invention also discloses a SAAS-based large model API service fee settlement method. The following describes in detail the SAAS-based large model API service fee settlement method disclosed in the embodiment of the present invention in combination with the SAAS-based large model API service fee settlement system described above.

[0067] refer to Figures 2 to 5 The present invention discloses a SAAS-based big model API service fee settlement method, which is applied to a SAAS service platform. The SAAS service platform provides a variety of resource packages for users to choose and purchase according to the big model service functions and the computing power consumed by the services; the method includes: after the user selects and purchases a certain resource package, the SAAS service platform generates and records the corresponding resource package order for the user; after receiving a request for calling a big model API sent by the user through the HTTP / HTTPS protocol, the API calling authority and the resource package balance are checked: whether the big model to be called matches the big model contained in the resource package purchased by the user, and whether the resource package has remaining usage times.

[0068] If the inspection passes, the SAAS service platform calls the corresponding big model API, executes the operation requested by the user, and deducts the fee from the resource package order under the user's name in real time according to the number of times the big model API is called; if the inspection fails, a corresponding prompt message is generated and returned to the user.

[0069] There are two situations in which the inspection fails. The first is that the large model that needs to be called does not match the large model included in the resource package purchased by the user. In this case, a prompt message is generated saying "The selected large model does not match the available large model in the resource package. You need to reselect the large model or change the resource package."

[0070] The second situation is that the resource package purchased by the user has no remaining usage times, then a prompt message "Insufficient resource package remaining, need to purchase resource package again" is generated.

[0071] When service providers put models on the SAAS service platform, they estimate the costs of the functions provided by different large models and the computing power they require, preset computing resource packages for them, convert the computing power, and design and provide a cost calculation method for each call.

[0072] Users determine the large model to be used according to their desired business scenarios, select the service resource package containing the corresponding model, and choose the specific specifications for purchase. After the purchase is completed, the platform will generate and record a resource package order for the user, and a valid resource package will be generated under the user's name.

[0073] refer to Figure 4 Furthermore, the method also includes: each resource package provided by the SAAS service platform corresponds to a computing power and contains at least one usable big model, and there are differentiated pricing for single calls to big models under various resource packages; the SAAS service platform calls the corresponding big model API, which is the default big model of the resource package purchased by the user, or the big model pre-selected by the user from multiple big models contained in the purchased resource package.

[0074] like Figure 4 As shown, for example, there are five resource packages AE, supporting different computing power, each resource package can use at least one large model, wherein each large model API call fee of each resource package is different. And each resource package supports different purchase specifications.

[0075] Based on the differences in the functions of the large model services provided and the differences in the computing power consumed by the services, the services are provided in the form of resource packages. Users purchase resource packages, and the services are charged based on the number of times users call the API, thereby simplifying the billing method.

[0076] Furthermore, the user's resource package order will be charged in real time according to the number of calls to the large model API, including:

[0077] Get the number of calls to the large model API;

[0078] Get the remaining amount of resource packages from the valid resource package orders;

[0079] Determine whether the number of calls is greater than the remaining amount of the resource package;

[0080] If the number of calls is greater than the remaining amount of the resource package, the user's resource package is insufficient, and an email and SMS are sent to the user to inform him that the remaining amount of the computing power service resource package is insufficient;

[0081] If the number of calls is less than or equal to the resource package balance, the fee will be deducted from the valid resource package order under the user's name in real time according to the number of calls.

[0082] Furthermore, the user's resource package order will be charged in real time according to the number of calls to the large model API, including:

[0083] Determine whether the remaining amount of the resource package is 0;

[0084] If the remaining balance of the resource package is 0, the user's computing power service resource package has been consumed, and an email and text message are sent to the user to inform him that the computing power service resource package has been used up and needs to be purchased again.

[0085] Furthermore, the method of sending emails and text messages to users is that the SAAS service platform performs asynchronous processing through a message queue.

[0086] Furthermore, after receiving a request for calling a large model API sent by a user through the HTTP / HTTPS protocol, checking the API calling authority and resource package balance also includes: obtaining user account information; detecting whether there is a valid resource package from the user account information; if there is a valid resource package in the user account information, real-time deductions are made according to the number of calls to provide API services to the user; if there is no valid resource package in the user account information, the user is informed that there is no valid resource package under his name.

[0087] Furthermore, the method also includes: after the user's API call is completed, obtaining resource package change information; using the resource package change information to obtain the resource package balance; judging whether the resource package balance is less than a preset threshold; if the resource package balance is greater than or equal to the preset threshold, the resource package balance is sufficient; if the resource package balance is less than the preset threshold, the user's resource package balance is insufficient at this time, and the user is reminded to purchase in time.

[0088] Furthermore, the method further comprises: the request for calling the large model API includes the user's access token, the SAAS service platform performs identity authentication according to the access token, and after the authentication is passed, checks the resource package under the user account.

[0089] Furthermore, the method further includes: after the service is completed, obtaining the service fee and sending the service fee and resource package balance information to the user account.

[0090] Through the above design, the SAAS big model API service is packaged according to the function to form different service packages. Users only need to select the service package they need to use and pay according to the actual number of times they use it to use the service functions provided by the SAAS big model API. This pay-per-use method greatly simplifies the billing logic. Users do not need to understand the internal function details and price structure, they only need to select and use the service package according to their own needs. At the same time, pay-per-use can better reflect the actual usage of users, avoiding the problem of uncertain costs for users caused by previous TOKEN billing.

[0091] The preset threshold value may be set by the user or may be a platform default value.

[0092] The embodiments of the present invention have the following advantages:

[0093] 1) In terms of capabilities, the service package eliminates a lot of token length calculation logic in the SAAS large model API when providing services;

[0094] 2) From a technical perspective, by using a pay-per-use method, authentication is performed when the user calls the API to determine whether the model used by the user matches the model included in the purchased computing power service package and whether there are any remaining usage times in the service package. This simplifies the pricing method and reduces the user's understanding cost.

[0095] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.

Claims

1. A SAAS-based large model API service fee settlement method, characterized in that: The method is applied to a SAAS service platform, which provides a variety of resource packages for users to choose and purchase based on the large model service functions and the computing power consumed by the services; the method includes: After the user selects and purchases a resource package, the SAAS service platform generates and records the corresponding resource package order for the user; After receiving the request to call the big model API sent by the user through the HTTP / HTTPS protocol, check the API call permission and resource package balance: determine whether the big model to be called matches the big model included in the resource package purchased by the user, and whether there are remaining usage times for the resource package; If the verification is passed, the SAAS service platform calls the corresponding big model API to perform the operation requested by the user, and deducts the fee from the resource package order under the user's name in real time according to the number of calls to the big model API; If the test fails, a corresponding prompt message is generated and returned to the user.

2. A SAAS-based large model API service fee settlement method as claimed in claim 1, characterized in that: The method further comprises: Each resource package provided by the SAAS service platform corresponds to a computing power and contains at least one usable big model. There are differentiated pricing for a single call to a big model under various resource packages. The SAAS service platform calls the corresponding big model API to call the default big model of the resource package purchased by the user, or the big model pre-selected by the user from multiple big models included in the resource package purchased.

3. A SAAS-based large model API service fee settlement method as claimed in claim 2, characterized in that: The user's resource package order will be charged in real time according to the number of calls to the large model API, including: Get the number of calls to the large model API; Get the remaining amount of resource packages from the valid resource package orders; Determine whether the number of calls is greater than the remaining amount of the resource package; If the number of calls is greater than the remaining amount of the resource package, the user's resource package is insufficient, and an email and SMS are sent to the user to inform him that the remaining amount of the computing power service resource package is insufficient; If the number of calls is less than or equal to the resource package balance, the fee will be deducted from the valid resource package order under the user's name in real time according to the number of calls.

4. A SAAS-based large model API service fee settlement method as claimed in claim 3, characterized in that: The user's resource package order will be charged in real time according to the number of calls to the large model API, including: Determine whether the remaining amount of the resource package is 0; If the remaining balance of the resource package is 0, the user's computing power service resource package has been consumed, and an email and text message are sent to the user to inform him that the computing power service resource package has been used up and needs to be purchased again.

5. A SAAS-based large model API service fee settlement method as claimed in claim 4, characterized in that: The method of sending emails and text messages to users is asynchronous processing by the SAAS service platform through the message queue.

6. A SAAS-based large model API service fee settlement method as claimed in claim 5, characterized in that: After receiving a request to call the large model API sent by the user through the HTTP / HTTPS protocol, check the API call permissions and resource package balance, including: Get user account information; Detecting whether there is a valid resource package from the user account information; If there is a valid resource package in the user account information, the fee will be deducted in real time according to the number of calls, and API services will be provided to the user; If there is no valid resource package in the user account information, the user is informed that there is no valid resource package under his name.

7. A SAAS-based large model API service fee settlement method as claimed in claim 6, characterized in that: The method further comprises: When the user's API call is completed, obtain the resource package change information; Obtaining the remaining amount of resource packages using the resource package change information; Determine whether the remaining amount of the resource package is less than a preset threshold; If the resource package surplus is greater than or equal to a preset threshold, the resource package surplus is sufficient; If the remaining amount of the resource package is less than the preset threshold, then the remaining amount of the user's resource package is insufficient, and the user is reminded to purchase it in time.

8. A SAAS-based large model API service fee settlement method as claimed in claim 7, characterized in that: The method further comprises: The request for calling the large model API contains the user's access token. The SAAS service platform performs identity authentication based on the access token. After the authentication is passed, the resource package under the user account is checked.

9. A SAAS-based large model API service fee settlement method as claimed in claim 6, characterized in that: The method further includes: after the service is completed, obtaining the service fee and sending the service fee and resource package balance information to the user account.

10. A large model API service fee settlement system based on SAAS, characterized in that: The system includes: an application service unit and a middleware / database service unit, specifically including: The application service unit includes: Resource package management module, used to provide internal resource package management capabilities; The order / valid resource package module is used to provide external service purchase functions; Large model API service module, used to provide large model API services to the outside world; Notification module, used to provide external notification capabilities; The middleware / database service unit includes: Resource package packages, used to store and provide valid resource package packages; Order data, used to create / manage valid resource orders and store valid resource packages.

Citation Information

Patent Citations

  • Data service operation platform

    CN113595789A

  • Large model API aggregation calling method, device and system

    CN118916026A

  • Method and server for agent service applied to widget

    WO2011060689A1