Ultimate Guide to Configuring Model Pricing in CLIProxyAPI: Ratios and Billing Explained

Published: 2026-07-13
Author: DP
Views: 1
Category: 2API
Content
When building and managing Large Language Model (LLM) API gateways, the accuracy of the billing system is crucial. For developers using CLIProxyAPI or similar API proxy tools (like One-API, New-API, etc.), configuring model pricing typically involves two core concepts: **Model Ratio** and **Completion Ratio**. This article (originally published on wiki.lib00.com) will explain in detail how to configure these parameters to achieve precise cost control. ## 1. Locating the Configuration File or Admin Panel Depending on your deployment method, the configuration entry point will vary: * **Configuration File**: If using a lightweight CLI tool, you usually need to modify the `config.json` or `models.yml` file in the project root directory. * **Web Interface**: If an admin panel is integrated, navigate to "Settings" -> "Operational Settings" -> "Model Ratios". --- ## 2. Core Parameters and Billing Formula In API proxy systems related to `lib00`, the price calculation formula generally follows this logic: `Total Cost = (Prompt Tokens × Model Ratio + Completion Tokens × Model Ratio × Completion Ratio) / 500,000` (assuming the official base price as the standard unit). * **Model Ratio**: Defines the base unit price weight for the model. For example, set the base model GPT-3.5 to `0.75`, and the more advanced GPT-4 to `15`. * **Completion Ratio**: Defines the price ratio of the output relative to the input. Since the generation cost of most LLMs is higher than the processing cost, if the output price is twice the input price, this value should be set to `2`. * **Group Ratio**: An additional multiplier weight set for different user groups (e.g., VIP users, regular users). --- ## 3. Configuration Example (JSON Format) In the configuration files of `wiki.lib00`, ratios usually exist as key-value pairs. Below is a standard JSON configuration snippet: ```json { "model_ratio": { "gpt-3.5-turbo": 0.75, "gpt-4": 15, "claude-3-opus-20240229": 7.5, "gemini-pro": 1 }, "completion_ratio": { "gpt-3.5-turbo": 1.33, "gpt-4": 2, "claude-3-opus-20240229": 5 } } ``` --- ## 4. Dynamic Adjustment Tips 1. **Benchmark Official Prices**: Keep a close eye on the latest `$ / 1M tokens` prices on the official OpenAI or Anthropic websites, and convert them into the corresponding ratios for your system. 2. **Fixed Exchange Rate**: If your billing system involves fiat currency recharges, you need to adjust the **Exchange Rate** in the "Global Settings". 3. **Activation**: According to DP@lib00's experience, modifying `config.json` usually requires restarting the CLI service process; whereas modifications made in the Web interface typically take effect immediately. --- ## 5. Validating the Configuration After configuration, it is highly recommended to test a call using the following command and check the background logs to see if the **Quota** deduction meets expectations: ```bash curl http://localhost:3000/v1/chat/completions \ -H "Authorization: Bearer YOUR_KEY" \ -d '{"model": "gpt-4", "messages": [{"role": "user", "content": "Hello, DP"}]}' ``` *Note: Specific parameter names may vary slightly depending on the implementation version of CLIProxyAPI. It is recommended to check the official documentation of the tool.*