Charging method, communication device and readable storage medium

By obtaining the results and session unit numbers related to AI service requests, generating billing request messages and performing real-time billing, the problem of lack of flexibility in AI service billing methods is solved, and the effect of smoothly enjoying AI services and reducing management costs is achieved.

CN120602247APending Publication Date: 2025-09-05MIGU CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510768766.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

Existing AI service billing methods lack flexibility and cannot guarantee the smooth enjoyment of AI services.

Method used

By responding to the user's AI service request, obtaining the AI ​​service result and session unit number related to the AI ​​service request, generating a billing request message, and sending it to the billing platform to implement real-time billing, the billing platform bills the user according to the session unit number.

Benefits of technology

It achieves flexibility in AI service billing, ensures that users can enjoy AI services smoothly, reduces management costs, and simplifies bill management operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120602247A_ABST
    Figure CN120602247A_ABST
Patent Text Reader

Abstract

The invention discloses a charging method, communication equipment and a readable storage medium, and belongs to the technical field of artificial intelligence. The charging method in the embodiment of the invention comprises the following steps: in response to an artificial intelligence (AI) service request of a user, acquiring an AI service result related to the AI service request and the number of session units consumed by the AI service result; generating a charging request message, wherein the charging request message comprises the session unit number; and sending the charging request message to a charging platform, and charging the user by the charging platform according to the number of the session units. Therefore, real-time charging can be realized, and the flexibility of AI service charging is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence technology, and specifically relates to a billing method, communication equipment and readable storage medium. Background Art

[0002] In related technologies, artificial intelligence (AI) services (such as text generation and image processing) are typically billed using a prepaid model, where users pre-purchase a fixed package of session units (i.e., tokens). When the number of session units consumed by the AI ​​service requested by the user exceeds the number of session units in the package, the AI ​​service is interrupted and restarted after the user manually purchases the package. This shows that current AI service billing methods lack flexibility and cannot guarantee the smooth enjoyment of AI services. Summary of the Invention

[0003] The purpose of the embodiments of the present application is to provide a billing method, a communication device, and a readable storage medium to solve the problem of lack of flexibility in current AI service billing methods.

[0004] In order to solve the above technical problems, this application is implemented as follows:

[0005] In a first aspect, a billing method is provided, comprising:

[0006] In response to an AI service request from a user, obtaining an AI service result related to the AI ​​service request and a number of session units consumed by the AI ​​service result;

[0007] generating a charging request message, wherein the charging request message includes the number of session units;

[0008] The billing request message is sent to a billing platform, and the billing platform bills the user according to the number of session units.

[0009] In a second aspect, a billing method is provided, including:

[0010] Receive a billing request message sent by the client, where the billing request message includes the number of session units consumed by the AI ​​service result, where the AI ​​service result is related to the AI ​​service request initiated by the user;

[0011] The user is charged according to the number of session units.

[0012] In a third aspect, a billing device is provided, comprising:

[0013] An acquisition module, configured to, in response to a user's AI service request, acquire an AI service result related to the AI ​​service request and a number of session units consumed by the AI ​​service result;

[0014] A generating module, configured to generate a billing request message, wherein the billing request message includes the number of session units;

[0015] The sending module is used to send the billing request message to the billing platform, and the billing platform bills the user according to the number of session units.

[0016] In a fourth aspect, a billing device is provided, comprising:

[0017] a receiving module, configured to receive a billing request message sent by a client, wherein the billing request message includes the number of session units consumed by an AI service result, wherein the AI ​​service result is related to the AI ​​service request initiated by the user;

[0018] The billing module is used to bill the user according to the number of session units.

[0019] In a fifth aspect, a communication device is provided, comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect or the steps of the method described in the second aspect.

[0020] In a sixth aspect, a readable storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect or the steps of the method described in the second aspect are implemented.

[0021] In a seventh aspect, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the steps of the method described in the first aspect or the steps of the method described in the second aspect.

[0022] The solution of the embodiment of the present application, by responding to the user's AI service request, obtaining the AI ​​service result related to the AI ​​service request and the number of session units consumed by the AI ​​service result, generating a billing request message, the billing request message including the number of session units, and sending the billing request message to the billing platform, can enable the billing platform to bill the user based on the number of session units, thereby achieving real-time billing, improving the flexibility of AI service billing, and thus ensuring the demand for smooth enjoyment of AI services. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 This is a flowchart of a billing method provided in an embodiment of the present application;

[0024] Figure 2 This is a flow chart of another billing method provided in an embodiment of the present application;

[0025] Figure 3 This is a schematic diagram of the structure of a billing device provided in an embodiment of the present application;

[0026] Figure 4 This is a structural diagram of another billing device provided in an embodiment of the present application;

[0027] Figure 5 It is a structural diagram of a communication device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0029] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.

[0030] The following describes in detail the billing method, communication device, and readable storage medium provided in the embodiments of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0031] See Figure 1 , Figure 1 This is a flowchart of a billing method provided by an embodiment of the present application, which is applied to a client, such as a mobile phone, tablet computer, wearable device, vehicle-mounted user equipment, etc. Figure 1 As shown, the method includes the following steps:

[0032] Step 11: In response to the user's AI service request, obtain the AI ​​service result related to the AI ​​service request and the number of session units consumed by the AI ​​service result.

[0033] In the embodiments of the present application, AI services may be selected for text generation, image processing, etc. AI services may be provided through models of different types / versions. For example, the models used to provide AI services may be DeepSeek, DeepSeek-Pro, DeepSeek-Extreme Edition, ChatGPT, etc., without limitation.

[0034] The AI ​​service request is specifically entered by the user on the client. Accordingly, the client receives the AI ​​service request entered by the user. When entering the AI ​​service request, the user can also select the desired model type so that the corresponding model type can provide the AI ​​service. For example, a user enters the AI ​​service request "Generate market analysis report" on the client and selects the model type "DeepSeek-Pro".

[0035] The conversation unit can also be called a token, semantic unit, etc., which represents the basic unit in the model conversation and can be used for matching, responding and understanding the model conversation to provide more personalized, smooth and accurate AI services.

[0036] The number of session units consumed by AI service results is generally based on the actual AI service. For example, the more complex the AI ​​service provided by the model, the more session units are required; conversely, the simpler the AI ​​service provided by the model, the fewer session units are required.

[0037] Step 12: Generate a charging request message, where the charging request message includes the number of session units.

[0038] In the embodiment of the present application, the billing request message may be in Json format or other formats as long as the billing platform can recognize it.

[0039] In addition to the session unit number (such as token_used), the charging request message may also include a user identifier, an AI service request identifier, a timestamp, etc. The user identifier (such as user_id) is used to identify the user corresponding to the charging request message, the AI ​​service request identifier (such as request_id) is used to identify the corresponding AI service request, and the timestamp (such as timestamp) is used to determine the time corresponding to the AI ​​service request.

[0040] Step 13: Send the billing request message to the billing platform, and the billing platform bills the user according to the number of session units.

[0041] To ensure security, the billing request message can be encrypted before being sent to the billing platform. For example, the billing request message can be encrypted using a symmetric encryption algorithm (such as the SM4 algorithm), and then the encrypted message can be sent to the billing platform via a dedicated Hypertext Transfer Protocol Secure (HTTPS) channel. For encryption keys, each client can be assigned a unique key pair, and the encryption keys can be rotated regularly, such as daily, to avoid the impact of encryption key leaks.

[0042] To implement billing for AI services, a pre-set billing formula can be set on the billing platform, for example, a fee of 1 yuan per 1,000 tokens. This way, after obtaining the number of session units consumed by the AI ​​service results, the billing platform can calculate the fee for this AI service based on this number of session units and the pre-set billing formula.

[0043] In some embodiments, after obtaining the fee for this AI service, the billing platform can deduct the fee from the corresponding user's account, thereby achieving the effect of real-time deduction.

[0044] In some embodiments, the billing platform can be a carrier billing platform. This allows AI service billing to be integrated with carrier packages, with model token quotas used as new communication package resource elements and multi-dimensionally bound to traffic and calls. This allows the billing platform to uniformly manage both communication bills and AI service bills, simplifying management operations and reducing management costs.

[0045] The solution of the embodiment of the present application, by responding to the user's AI service request, obtaining the AI ​​service result related to the AI ​​service request and the number of session units consumed by the AI ​​service result, generating a billing request message, the billing request message including the number of session units, and sending the billing request message to the billing platform, can enable the billing platform to bill the user based on the number of session units, thereby achieving real-time billing, improving the flexibility of AI service billing, and thus ensuring the demand for smooth enjoyment of AI services.

[0046] Optionally, in addition to the number of session units, the billing request message may also include at least one of the following: the time period in which the AI ​​service request occurs, and the model type corresponding to the AI ​​service request; wherein the time period is used to assist the billing platform in billing the user, and the model type is used to assist the billing platform in billing the user. That is, after receiving the billing request message, the billing platform bills the user based on the number of session units and the time period and / or the corresponding model type in which the AI ​​service request occurs. In this way, the billing strategy can be dynamically adjusted based on the time period and model type in which the user actually uses the model service, thereby making the billing strategy more flexible while guiding users to use the model service in off-peak hours, thereby reducing the overall system load.

[0047] For example, if users actually use the model service during peak hours, the base price of the AI ​​service can be increased by, for example, 20%. If users actually use the model service during normal hours, the base price of the AI ​​service can remain unchanged. If users actually use the model service during off-peak hours, the base price of the AI ​​service can be reduced by, for example, 10%.

[0048] For another example, different prices can be set for different types of models, so that the completed AI service is billed based on the model type selected by the user.

[0049] It should be noted that the billing request in the embodiment of the present application can be processed in a non-blocking manner, that is, asynchronously with the user's AI service request, so as to avoid affecting the main thread performance.

[0050] In an embodiment of the present application, in order to achieve efficient billing, a billing middleware, such as a lightweight software development kit (SDK), can be deployed on the client, and an encrypted channel with the billing platform can be established through the billing middleware to achieve real-time billing and deductions.

[0051] Optionally, the generating of the billing request message may include: generating the billing request message by a billing middleware.

[0052] The sending of the billing request message to the billing platform includes sending the billing request message to the billing platform via a billing middleware, for example, the billing middleware is an SDK configured with an encryption key, an address of the billing platform, and the like.

[0053] In this way, with the help of the billing middleware deployed in the client, a transmission channel can be established between the client and the billing platform, thereby meeting the need to transmit the billing request message to the billing platform.

[0054] In some embodiments, if a client fails to send a billing request message to the billing platform, such as due to a network outage, the client will locally record the unsynchronized number of consumed session units and retransmit them in batches upon the next network connection. Furthermore, the billing platform's reconciliation module can periodically verify the consistency of local and cloud data to correct any discrepancies.

[0055] In an embodiment of the present application, the server may select an appropriate computing node to provide AI services. The process of obtaining the AI ​​service results related to the AI ​​service request and the number of session units consumed by the AI ​​service results may include:

[0056] Sending an AI service request to the server, which routes the AI ​​service request to a target computing node and uses the target computing node to obtain the AI ​​service result; the target computing node can be understood as a suitable model node for executing the AI ​​service;

[0057] Receive the AI ​​service result and the number of session units consumed by the AI ​​service result returned by the server.

[0058] In some embodiments, the server can decide whether to enable a load balancing strategy based on factors such as the current user level and system load. For example, if the current user level is high and / or the system load is high, a load balancing strategy can be enabled to route the user's AI service request to a computing node with less load.

[0059] Optionally, the target computing node is selected based on the user's level and / or system load, so that the user's AI service request can be routed to the appropriate computing node.

[0060] In some embodiments, when considering the user level factor, if the user levels include gold, silver, and bronze, the routing strategy may be: routing the AI ​​service request of the gold user to the computing power node with the least load, routing the AI ​​service request of the silver user to the computing power node with the second highest load, and routing the AI ​​service request of the bronze user to the computing power node with the highest load.

[0061] In some embodiments, to enhance the user experience, after routing a user's AI service request to an appropriate computing node, the server can estimate the waiting time for the user and return this information to the client. The client then displays this waiting time, i.e., pushes this information to the user, for example, with the message "During peak hours, the estimated waiting time is xx seconds." This allows users to understand the approximate time it will take to receive AI service results, improving the user experience.

[0062] Optionally, before sending the AI ​​service request to the server, the billing method in the embodiment of the present application may further include:

[0063] Estimating the number of session units required to produce the AI ​​service result;

[0064] Determine whether the locally cached session unit balance is greater than the number of session units required to generate the AI ​​service result. This locally cached session unit balance is based on the user account's session unit balance and can be synchronized based on the user account's session unit balance. For example, the locally cached session unit balance can be synchronized every 30 seconds, reducing query pressure on the billing platform.

[0065] The sending of the AI ​​service request to the server includes sending the AI ​​service request to the server when the balance of the session units in the local cache is greater than the number of session units to be consumed by the AI ​​service result. This ensures that the deduction requirement is met.

[0066] In some embodiments, if the locally cached session unit balance is less than or equal to the number of session units required to generate the AI ​​service result, indicating that the user's account balance may be insufficient, a balance query can be triggered, sending a query request to the billing platform and displaying the query results returned by the billing platform for the user to review, allowing them to renew their account in a timely manner if their balance is insufficient. In this case, the client can also send an AI service request to the server to obtain the AI ​​service result, and the corresponding fee can be paid later.

[0067] See Figure 2 , Figure 2 This is a flowchart of a billing method provided in an embodiment of the present application, which is applied to a billing platform, such as Figure 2 As shown, the method includes the following steps:

[0068] Step 21: Receive a billing request message sent by the client, where the billing request message includes the number of session units consumed by the AI ​​service result, where the AI ​​service result is related to the AI ​​service request initiated by the user;

[0069] Step 22: The user is charged according to the number of session units.

[0070] In the embodiments of the present application, AI services may be selected for text generation, image processing, etc. AI services may be provided through models of different types / versions. Models used to provide AI services include DeepSeek, DeepSeek-Pro, DeepSeek-Extreme Edition, ChatGPT, etc., without limitation.

[0071] The AI ​​service request is specifically entered by the user on the client. Accordingly, the client receives the AI ​​service request entered by the user. When entering the AI ​​service request, the user can also select the desired model type so that the corresponding model type can provide the AI ​​service. For example, a user enters the AI ​​service request "Generate market analysis report" on the client and selects the model type "DeepSeek-Pro".

[0072] The conversation unit can also be called a token, semantic unit, etc., which represents the basic unit in the model conversation and can be used for matching, responding and understanding the model conversation to provide more personalized, smooth and accurate AI services.

[0073] The number of session units consumed by AI service results is generally based on the actual AI service. For example, the more complex the AI ​​service provided by the model, the more session units are required; conversely, the simpler the AI ​​service provided by the model, the fewer session units are required.

[0074] The billing request message may be in Json format or other formats, as long as the billing platform can recognize it.

[0075] In addition to the session unit number (such as token_used), the charging request message may also include a user identifier, an AI service request identifier, a timestamp, etc. The user identifier (such as user_id) is used to identify the user corresponding to the charging request message, the AI ​​service request identifier (such as request_id) is used to identify the corresponding AI service request, and the timestamp (such as timestamp) is used to determine the time corresponding to the AI ​​service request.

[0076] To implement billing for AI services, a pre-set billing formula can be set on the billing platform, for example, a fee of 1 yuan per 1,000 tokens. This way, after obtaining the number of session units consumed by the AI ​​service results, the billing platform can calculate the fee for this AI service based on this number of session units and the pre-set billing formula.

[0077] The solution of the embodiment of the present application receives a billing request message sent by a client, wherein the billing request message includes the number of session units consumed by the AI ​​service result, wherein the AI ​​service result is related to the AI ​​service request initiated by the user, and the user is billed according to the number of session units. This can achieve real-time billing, thereby improving the flexibility of AI service billing and ensuring the demand for smooth enjoyment of AI services.

[0078] In some embodiments, the billing platform can be a carrier billing platform. This allows AI service billing to be integrated with carrier packages, with model token quotas used as new communication package resource elements and multi-dimensionally bound to traffic and calls. This allows the billing platform to uniformly manage both communication bills and AI service bills, simplifying management operations and reducing management costs.

[0079] Optionally, in addition to the number of session units, the billing request message may further include at least one of the following: the time period of the AI ​​service request and the model type corresponding to the AI ​​service request; and billing the user based on the number of session units may include:

[0080] The user is charged based on the number of session units and at least one of the following: the time period in which the AI ​​service request occurs and the model type corresponding to the AI ​​service request.

[0081] In this way, the billing strategy can be dynamically adjusted according to the time period and model type when the user actually uses the model service, making the billing strategy more flexible while guiding users to use the model during off-peak hours and reducing the overall system load.

[0082] For example, if users actually use the model service during peak hours, the base price of the AI ​​service can be increased by, for example, 20%. If users actually use the model service during normal hours, the base price of the AI ​​service can remain unchanged. If users actually use the model service during off-peak hours, the base price of the AI ​​service can be reduced by, for example, 10%.

[0083] For another example, different prices can be set for different types of models, so that the completed AI service is billed based on the model type selected by the user.

[0084] The present application is described below with reference to specific embodiments.

[0085] The specific embodiment of this application discloses a system that integrates model token billing and operator package, which uses model token quotas as new communication package resource elements and forms a multi-dimensional binding relationship with traffic and calls. Based on the token second-level billing capability of the lightweight SDK, it realizes unified deduction of balances across services, namely communication and AI services, thereby achieving the effect of unifying communication and AI consumption bills and reducing user management costs.

[0086] The above system mainly consists of five parts: user terminal (built-in mobile client / Web terminal), billing middleware deployed on the user terminal (such as lightweight SDK), operator billing platform (such as BOSS system), server (deployed AI service cluster, such as DeepSeek-Full Blood, DeepSeek-Extreme Edition, etc.), dynamic pricing engine (ie algorithm module).

[0087] Based on the above system, the core process steps mainly include: user initiates AI service request → SDK captures token consumption → encrypted transmission to the billing platform → dynamic pricing engine calculates fees → real-time deduction and updates user account balance → feedback results to the user terminal.

[0088] The specific process of the solution in the specific embodiment of this application may include the following steps:

[0089] Step 1: The user selects a package and initializes the SDK.

[0090] Specifically, when ordering a carrier package, users select a converged package in the carrier's client, such as "5G+AI Office Package: 50GB of data + 1 million tokens / month." The carrier's system writes the package information (such as token quota and expiration date) into the user's account and binds it to communication resources (such as data usage and call duration).

[0091] For package association rules, you can choose: After exceeding the basic token package, the fee is 0.5 yuan per thousand tokens.

[0092] New fields can be added to the user account database, such as ai_token_balance and ai_model_permissions. The ai_token_balance indicates the token quota, and the ai_model_permissions indicates whether there are available tokens.

[0093] The client integrates a lightweight SDK and automatically loads the following configurations at startup:

[0094] (1) Encryption key (such as SM4 algorithm key pair), used to encrypt the billing request message;

[0095] (2) API address of the billing platform, used to send the billing request message to the corresponding billing platform according to the address;

[0096] (3) Locally cached token balance, used for offline pre-verification.

[0097] It's important to note that a lightweight SDK, with a size of less than 200KB, relies solely on basic cryptographic libraries (such as OpenSSL's SM4). Because the SDK supports tens of millions of concurrent transactions, the billing platform can scale horizontally to millions of transactions per second (TPS), thereby improving its performance.

[0098] Step 2: The user initiates an AI service request.

[0099] Specifically, the user enters an AI service request (or AI instruction) on the client, such as "generate a market analysis report", and selects a model type (such as DeepSeek-Pro).

[0100] After a user initiates an AI service request, the SDK intercepts the AI ​​service request and performs the following operations:

[0101] S1: Call the local Natural Language Processing (NLP) module to estimate the number of tokens consumed by this request, for example, 1200 tokens;

[0102] S2: Check whether the local cached token balance is sufficient, that is, whether the local cached token balance is greater than the estimated number of tokens to be consumed;

[0103] -If sufficient, the AI ​​service request is sent to the AI ​​server.

[0104] -If the balance is insufficient, a real-time balance query will be triggered, such as initiating a query request to the billing platform through an encrypted channel, and displaying the query results returned by the billing platform for the user to view, so that the user can renew the balance in time when the balance is insufficient.

[0105] The above locally cached token balance can be synchronized every 30 seconds, thereby reducing the query pressure on the billing platform.

[0106] After receiving an AI service request, the AI ​​server decides whether to enable a load balancing strategy based on factors such as the current user level and system load. For example, if the current user level is high and / or the system load is high, the load balancing strategy is enabled to route the user's AI service request to the appropriate computing node, estimate the waiting time for the user, and notify the user of the estimated waiting time.

[0107] For example, if user levels include gold, silver, and bronze, the routing strategy can be: route AI service requests from gold users to the computing power node with the least load, route AI service requests from silver users to the computing power node with the second highest load, and route AI service requests from bronze users to the computing power node with the highest load.

[0108] Step 3: Real-time token billing and deduction.

[0109] After the AI ​​service completes the calculation, it returns the AI ​​service result and the number of tokens consumed to the client. For example, if 1150 tokens are actually consumed, no charge is required and the number of tokens consumed is reduced directly if the token balance is sufficient.

[0110] The SDK captures the actual number of tokens consumed and generates a billing request message in the following format:

[0111] {

[0112] "user_id":"138XXXXX000",(user ID)

[0113] "request_id":"REQ2023100XXXX0001", (AI service request identifier)

[0114] "token_used": 1150, (the actual number of tokens consumed)

[0115] "model_type":"deepseek-pro",(model type)

[0116] "timestamp":"2023-10-01T12:00:05Z" (timestamp)

[0117] }

[0118] Optionally, the structure of the above message may include a 4-byte header (identifying the message type), a 16-byte encryption key, encrypted business data, and a 32-byte signature (such as using SM3 hash).

[0119] After the SDK generates the billing request message, it encrypts it using the SM4 algorithm and sends it to the carrier's billing platform via a dedicated HTTPS channel. Each client is assigned a unique key pair for message encryption, and the encryption key is rotated regularly, for example, every 24 hours.

[0120] It should be noted that the billing request message can be processed in a non-blocking manner, that is, asynchronously with the user's AI service request, so as to avoid affecting the main thread performance.

[0121] After receiving the encrypted billing request message, the carrier's billing platform decrypts it and performs the following operations: It invokes the dynamic pricing engine and performs billing based on the actual number of tokens consumed (1150), the timestamp (12:00, peak time), and the model type (deepseek-pro). This allows for dynamic adjustment of billing strategies, making them more flexible while also guiding users to use their data at off-peak times, reducing overall system load.

[0122] For example, the specific billing process is as follows:

[0123] base_price=1.0#Base price: 1 yuan / 1,000 tokens;

[0124] peak_multiplier=1.2#peak premium 20%;

[0125] model_multiplier=1.5 #Pro model price increase by 50%;

[0126] final_price=base_price*peak_multiplier*model_multiplier=1.8 yuan / thousand Tokens.

[0127] The cost of this request is: 1150 Tokens * 1.8 yuan / 1,000 Tokens = 2.07 yuan.

[0128] Afterwards, 2.07 yuan is deducted from the user's communication package balance, achieving real-time deduction. If the user's account is billed independently for AI services, the token quota is deducted. This ensures end-to-end real-time performance, with the time from user AI service request to payment completion less than 500ms, ensuring smooth AI service experience.

[0129] In addition, if the user's account balance is insufficient, a recharge reminder will be triggered and the arrears status will be recorded.

[0130] Optionally, after the deduction, the billing platform can return the deduction result (e.g., success or failure) and the updated balance to the SDK. The SDK updates the locally cached token balance and displays it on the client interface, for example: AI service used: 1150 tokens (cost 2.07 yuan); remaining tokens: 998,850 (available this month) | account balance: XX.XX yuan.

[0131] Step 3: Exception handling and reconciliation.

[0132] Optionally, if the SDK fails to send a billing request message to the billing platform, such as due to a network outage, the unsynchronized number of consumed tokens will be recorded locally and retransmitted in batches upon the next network connection. Furthermore, the billing platform's reconciliation module can periodically verify the consistency of local and cloud data to correct any discrepancies.

[0133] Optionally, users can file a chargeback complaint, which will be tracked by the system. For example, users can query the token calculation log, encrypted message, and chargeback timestamp for the AI ​​service request ID (REQ202310011200001). Reversal or compensation will be processed after manual review.

[0134] It should be noted that the billing method provided in the embodiment of the present application can be executed by a billing device or a control module in the billing device for executing the billing method. In the embodiment of the present application, the billing device provided in the embodiment of the present application is described by taking the billing method executed by the billing device as an example.

[0135] See Figure 3 , Figure 3 This is a structural diagram of a billing device provided in an embodiment of the present application, which is applied to a client, such as a mobile phone, tablet computer, wearable device, vehicle-mounted user equipment, etc. Figure 3 As shown, the charging device 30 includes:

[0136] An acquisition module 31 is configured to, in response to a user's AI service request, acquire an AI service result related to the AI ​​service request and the number of session units consumed by the AI ​​service result;

[0137] A generating module 32, configured to generate a billing request message, wherein the billing request message includes the number of session units;

[0138] The sending module 33 is configured to send the billing request message to a billing platform, and the billing platform bills the user according to the number of session units.

[0139] Optionally, the billing request message also includes at least one of the following: the time period in which the AI ​​service request is located and the model type corresponding to the AI ​​service request; wherein, the time period is used to assist the billing platform in billing the user, and the model type is used to assist the billing platform in billing the user.

[0140] Optionally, the acquisition module 31 includes:

[0141] a sending unit, configured to send the AI ​​service request to a server, which routes the AI ​​service request to a target computing node and obtains the AI ​​service result using the target computing node;

[0142] A receiving unit is configured to receive the AI ​​service result and the number of session units consumed by the AI ​​service result returned by the server.

[0143] Optionally, the target computing power node is selected based on the user's level and / or system load.

[0144] Optionally, the charging device 30 further includes:

[0145] An estimation module, configured to estimate the number of session units to be consumed by the AI ​​service result before sending the AI ​​service request to the server;

[0146] A judgment module, configured to judge whether the balance of session units in the local cache is greater than the number of session units to be consumed by the AI ​​service result;

[0147] The sending module 33 is specifically configured to send the AI ​​service request to the server when the balance of the session units in the local cache is greater than the number of session units to be consumed by the AI ​​service result.

[0148] Optionally, the generating module 32 is specifically configured to: generate the billing request message through a billing middleware;

[0149] The sending module 33 is specifically configured to send the billing request message to the billing platform via the billing middleware.

[0150] The billing device 30 of the embodiment of the present application can realize the above Figure 1 The various processes of the method embodiment shown can achieve the same technical effect, and to avoid repetition, they will not be described again here.

[0151] See Figure 4 , Figure 4 This is a schematic diagram of the structure of a billing device provided in an embodiment of the present application, which is applied to a billing platform, such as Figure 4 As shown, the charging device 40 includes:

[0152] A receiving module 41 is configured to receive a billing request message sent by a client, wherein the billing request message includes the number of session units consumed by an AI service result, wherein the AI ​​service result is related to the AI ​​service request initiated by the user;

[0153] The billing module 42 is configured to bill the user according to the number of session units.

[0154] Optionally, the billing request message further includes at least one of the following: the time period of the AI ​​service request, and the model type corresponding to the AI ​​service request;

[0155] The billing module 42 is specifically configured to bill the user based on the number of session units and at least one of the following: the time period in which the AI ​​service request occurs and the model type corresponding to the AI ​​service request.

[0156] The billing device 40 of the embodiment of the present application can realize the above Figure 2 The various processes of the method embodiment shown can achieve the same technical effect, and to avoid repetition, they will not be described again here.

[0157] Optional, such as Figure 5 As shown, the embodiment of the present application further provides a communication device 50, including a processor 51, a memory 52, a program or instruction stored in the memory 52 and executable on the processor 51, and the program or instruction is executed by the processor 51 to achieve the above Figure 1 or Figure 2 The various processes of the method embodiment shown can achieve the same technical effect, and to avoid repetition, they will not be described again here.

[0158] An embodiment of the present application also provides a computer program product, including computer instructions. When the computer instructions are executed by a processor, the various processes of the above-mentioned billing method embodiment can be implemented and the same technical effect can be achieved. To avoid repetition, they will not be repeated here.

[0159] An embodiment of the present application also provides a readable storage medium on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned billing method embodiment can be implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0160] Computer-readable media includes both permanent and non-permanent, removable and non-removable media, and can be implemented using any method or technology for information storage. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change RAM (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.

[0161] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0162] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0163] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a service classification device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0164] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A billing method, characterized in that: include: In response to a user's artificial intelligence (AI) service request, obtain an AI service result related to the AI ​​service request and the number of session units consumed by the AI ​​service result; generating a charging request message, wherein the charging request message includes the number of session units; The billing request message is sent to a billing platform, and the billing platform bills the user according to the number of session units.

2. The method according to claim 1, characterized in that The billing request message also includes at least one of the following: the time period in which the AI ​​service request is located and the model type corresponding to the AI ​​service request; wherein, the time period is used to assist the billing platform in billing the user, and the model type is used to assist the billing platform in billing the user.

3. The method according to claim 1, characterized in that The obtaining of the AI ​​service result related to the AI ​​service request and the number of session units consumed by the AI ​​service result includes: Sending the AI ​​service request to the server, which routes the AI ​​service request to the target computing node and obtains the AI ​​service result using the target computing node; Receive the AI ​​service result and the number of session units consumed by the AI ​​service result returned by the server.

4. The method according to claim 3, characterized in that The target computing power node is selected based on the user's level and / or system load.

5. The method according to claim 3, characterized in that Before sending the AI ​​service request to the server, the method further includes: Estimating the number of session units required to produce the AI ​​service result; Determine whether the balance of session units in the local cache is greater than the number of session units to be consumed by the AI ​​service result; The step of sending the AI ​​service request to the server includes: When the balance of the session units in the local cache is greater than the number of session units to be consumed by the AI ​​service result, the AI ​​service request is sent to the server.

6. The method according to claim 1, characterized in that The generating of the charging request message includes: Generate the billing request message through the billing middleware; The sending of the billing request message to the billing platform includes: The billing request message is sent to the billing platform through the billing middleware.

7. A billing method, characterized in that: include: receiving a billing request message sent by the client, where the billing request message includes the number of session units consumed by the AI ​​service result, where the AI ​​service result is related to the AI ​​service request initiated by the user; The user is charged according to the number of session units.

8. The method according to claim 7, characterized in that The billing request message further includes at least one of the following: the time period of the AI ​​service request and the model type corresponding to the AI ​​service request; The charging of the user according to the number of session units includes: The user is charged based on the number of session units and at least one of the following: a time period in which the AI ​​service request occurs and a model type corresponding to the AI ​​service request.

9. A communication device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method according to any one of claims 1 to 5, or implements the steps of the method according to claim 6.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented, or the steps of the method according to claim 6 are implemented.