mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-27 13:03:19 +08:00
docs: restructure user manual for i18n and add EN/JA translations
Reorganize docs/user-manual/ from flat structure to language subdirectories (zh/, en/, ja/) with shared assets/. Move existing Chinese docs into zh/, fix image paths, add multilingual navigation README, and translate all 23 markdown files (~4500 lines each) to English and Japanese.
This commit is contained in:
291
docs/user-manual/en/4-proxy/4.4-usage.md
Normal file
291
docs/user-manual/en/4-proxy/4.4-usage.md
Normal file
@@ -0,0 +1,291 @@
|
||||
# 4.4 Usage Statistics
|
||||
|
||||
## Overview
|
||||
|
||||
The usage statistics feature records and analyzes API request data, helping you:
|
||||
|
||||
- Understand API usage patterns
|
||||
- Estimate cost expenditure
|
||||
- Analyze usage patterns
|
||||
- Troubleshoot issues
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Using the usage statistics feature requires:
|
||||
|
||||
1. Proxy service started
|
||||
2. App takeover enabled
|
||||
3. Log recording enabled
|
||||
|
||||
## Open Usage Statistics
|
||||
|
||||
Settings > Usage Tab
|
||||
|
||||
## Statistics Overview
|
||||
|
||||
### Summary Cards
|
||||
|
||||
Key metrics displayed at the top of the page:
|
||||
|
||||
| Metric | Description |
|
||||
|--------|-------------|
|
||||
| Total Requests | Total number of requests in the time period |
|
||||
| Total Tokens | Total input + output tokens |
|
||||
| Estimated Cost | Cost calculated based on pricing configuration |
|
||||
| Success Rate | Percentage of successful requests |
|
||||
|
||||
### Time Range
|
||||
|
||||
Select the time range for statistics:
|
||||
|
||||
| Option | Range |
|
||||
|--------|-------|
|
||||
| Today | From 00:00 today to now |
|
||||
| Last 7 Days | Past 7 days |
|
||||
| Last 30 Days | Past 30 days |
|
||||
|
||||

|
||||
|
||||
## Trend Charts
|
||||
|
||||
### Request Trend
|
||||
|
||||
Line chart showing the trend of request counts:
|
||||
|
||||
- X-axis: Time
|
||||
- Y-axis: Request count
|
||||
- Viewable by hour/day
|
||||
- Supports zoom and drag
|
||||
|
||||
### Token Trend
|
||||
|
||||
Shows token usage trends:
|
||||
|
||||
- Input Tokens (blue) - Prompt content sent by the user
|
||||
- Output Tokens (green) - Response content generated by AI
|
||||
- Cache Creation Tokens (orange) - Tokens consumed when first creating cache
|
||||
- Cache Hit Tokens (purple) - Tokens saved by reusing cache
|
||||
- Cost (red dashed line, right Y-axis) - Estimated cost
|
||||
|
||||
> **Cache Token explanation**: Anthropic API supports Prompt Caching. Creating cache incurs a higher fee (typically 1.25x input price), but subsequent cache hits only charge 0.1x, significantly reducing costs for repeated requests.
|
||||
|
||||
### Time Granularity
|
||||
|
||||
- **Today**: Displayed by hour (24 data points)
|
||||
- **7 Days/30 Days**: Displayed by day
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
## Detailed Data
|
||||
|
||||
Three data tabs at the bottom of the page:
|
||||
|
||||
### Request Logs
|
||||
|
||||
Detailed record of each request:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| Time | Request time |
|
||||
| Provider | Provider name used |
|
||||
| Model | Requested model (billing model) |
|
||||
| Input Tokens | Number of input tokens |
|
||||
| Output Tokens | Number of output tokens |
|
||||
| Cache Read | Cache hit token count |
|
||||
| Cache Creation | Cache creation token count |
|
||||
| Total Cost | Estimated cost (USD) |
|
||||
| Timing Info | Request duration, time to first token, streaming/non-streaming |
|
||||
| Status | HTTP status code |
|
||||
|
||||
#### Timing Information
|
||||
|
||||
The timing info column displays multiple badges:
|
||||
|
||||
| Badge | Description | Color Rules |
|
||||
|-------|-------------|-------------|
|
||||
| Total Duration | Total request time (seconds) | <=5s green, <=120s orange, >120s red |
|
||||
| First Token | Time to first token in streaming requests | <=5s green, <=120s orange, >120s red |
|
||||
| Stream/Non-stream | Request type | Streaming blue, non-streaming purple |
|
||||
|
||||
#### View Details
|
||||
|
||||
Click a request row to view detailed information:
|
||||
|
||||
- Complete request parameters
|
||||
- Response content summary
|
||||
- Error messages (if failed)
|
||||
|
||||
#### Filter Logs
|
||||
|
||||
Supports filtering by the following criteria:
|
||||
|
||||
| Filter | Options |
|
||||
|--------|---------|
|
||||
| App Type | All / Claude / Codex / Gemini |
|
||||
| Status Code | All / 200 / 400 / 401 / 429 / 500 |
|
||||
| Provider | Text search |
|
||||
| Model | Text search |
|
||||
| Time Range | Start time - End time (datetime picker) |
|
||||
|
||||
Action buttons:
|
||||
- **Search**: Apply filter criteria
|
||||
- **Reset**: Restore defaults (past 24 hours)
|
||||
- **Refresh**: Reload data
|
||||
|
||||

|
||||
|
||||
### Provider Statistics
|
||||
|
||||
Statistics grouped by provider:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| Provider | Provider name |
|
||||
| Requests | Total requests for this provider |
|
||||
| Successes | Number of successful requests |
|
||||
| Failures | Number of failed requests |
|
||||
| Success Rate | Success percentage |
|
||||
| Total Tokens | Total token usage |
|
||||
| Estimated Cost | Cost for this provider |
|
||||
|
||||

|
||||
|
||||
### Model Statistics
|
||||
|
||||
Statistics grouped by model:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| Model | Model name |
|
||||
| Requests | Total requests for this model |
|
||||
| Input Tokens | Total input tokens |
|
||||
| Output Tokens | Total output tokens |
|
||||
| Avg Latency | Average response time |
|
||||
| Estimated Cost | Cost for this model |
|
||||
|
||||

|
||||
|
||||
## Pricing Configuration
|
||||
|
||||
### Open Pricing Configuration
|
||||
|
||||
Settings > Advanced > Pricing Configuration
|
||||
|
||||
### Configure Model Prices
|
||||
|
||||
Set prices for each model (per million tokens):
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| Model ID | Model identifier (e.g., claude-3-sonnet) |
|
||||
| Display Name | Custom display name |
|
||||
| Input Price | Price per million input tokens |
|
||||
| Output Price | Price per million output tokens |
|
||||
| Cache Read Price | Price per million cache hit tokens |
|
||||
| Cache Creation Price | Price per million cache creation tokens |
|
||||
|
||||
### Operations
|
||||
|
||||
- **Add**: Click the "Add" button to add model pricing
|
||||
- **Edit**: Click the edit icon at the end of the row to modify
|
||||
- **Delete**: Click the delete icon at the end of the row to remove
|
||||
|
||||

|
||||
|
||||
### Preset Prices
|
||||
|
||||
CC Switch includes preset official prices for common models (per million tokens):
|
||||
|
||||
**Claude Series (USD)**:
|
||||
|
||||
| Model | Input | Output | Cache Read | Cache Creation |
|
||||
|-------|-------|--------|------------|----------------|
|
||||
| **Claude 4.5 Series** | | | | |
|
||||
| claude-opus-4-5 | $5 | $25 | $0.50 | $6.25 |
|
||||
| claude-sonnet-4-5 | $3 | $15 | $0.30 | $3.75 |
|
||||
| claude-haiku-4-5 | $1 | $5 | $0.10 | $1.25 |
|
||||
| **Claude 4 Series** | | | | |
|
||||
| claude-opus-4 | $15 | $75 | $1.50 | $18.75 |
|
||||
| claude-opus-4-1 | $15 | $75 | $1.50 | $18.75 |
|
||||
| claude-sonnet-4 | $3 | $15 | $0.30 | $3.75 |
|
||||
| **Claude 3.5 Series** | | | | |
|
||||
| claude-3-5-sonnet | $3 | $15 | $0.30 | $3.75 |
|
||||
| claude-3-5-haiku | $0.80 | $4 | $0.08 | $1.00 |
|
||||
|
||||
**OpenAI Series / Codex (USD)**:
|
||||
|
||||
| Model | Input | Output | Cache Read |
|
||||
|-------|-------|--------|------------|
|
||||
| **GPT-5.2 Series** | | | |
|
||||
| gpt-5.2 | $1.75 | $14 | $0.175 |
|
||||
| **GPT-5.1 Series** | | | |
|
||||
| gpt-5.1 | $1.25 | $10 | $0.125 |
|
||||
| **GPT-5 Series** | | | |
|
||||
| gpt-5 | $1.25 | $10 | $0.125 |
|
||||
|
||||
> Note: Codex presets include low/medium/high variants with prices identical to the base model.
|
||||
|
||||
**Gemini Series (USD)**:
|
||||
|
||||
| Model | Input | Output | Cache Read |
|
||||
|-------|-------|--------|------------|
|
||||
| **Gemini 3 Series** | | | |
|
||||
| gemini-3-pro-preview | $2 | $12 | $0.20 |
|
||||
| gemini-3-flash-preview | $0.50 | $3 | $0.05 |
|
||||
| **Gemini 2.5 Series** | | | |
|
||||
| gemini-2.5-pro | $1.25 | $10 | $0.125 |
|
||||
| gemini-2.5-flash | $0.30 | $2.50 | $0.03 |
|
||||
|
||||
**Chinese Provider Models (CNY)**:
|
||||
|
||||
| Model | Input | Output | Cache Read |
|
||||
|-------|-------|--------|------------|
|
||||
| **DeepSeek** | | | |
|
||||
| deepseek-v3.2 | ¥2.00 | ¥3.00 | ¥0.40 |
|
||||
| deepseek-v3.1 | ¥4.00 | ¥12.00 | ¥0.80 |
|
||||
| deepseek-v3 | ¥2.00 | ¥8.00 | ¥0.40 |
|
||||
| **Kimi (Moonshot)** | | | |
|
||||
| kimi-k2-thinking | ¥4.00 | ¥16.00 | ¥1.00 |
|
||||
| kimi-k2 | ¥4.00 | ¥16.00 | ¥1.00 |
|
||||
| kimi-k2-turbo | ¥8.00 | ¥58.00 | ¥1.00 |
|
||||
| **MiniMax** | | | |
|
||||
| minimax-m2.1 | ¥2.10 | ¥8.40 | ¥0.21 |
|
||||
| minimax-m2.1-lightning | ¥2.10 | ¥16.80 | ¥0.21 |
|
||||
| **Others** | | | |
|
||||
| glm-4.7 | ¥2.00 | ¥8.00 | ¥0.40 |
|
||||
| doubao-seed-code | ¥1.20 | ¥8.00 | ¥0.24 |
|
||||
| mimo-v2-flash | Free | Free | - |
|
||||
|
||||
### Custom Prices
|
||||
|
||||
If using proxy services, prices may differ:
|
||||
|
||||
1. Click the "Edit" button
|
||||
2. Modify prices
|
||||
3. Save
|
||||
|
||||
## FAQ
|
||||
|
||||
### Statistics Data Is Empty
|
||||
|
||||
Check:
|
||||
- Is the proxy service running
|
||||
- Is app takeover enabled
|
||||
- Is log recording enabled
|
||||
- Have requests been going through the proxy
|
||||
|
||||
### Cost Estimates Are Inaccurate
|
||||
|
||||
Possible causes:
|
||||
- Pricing configuration doesn't match actual prices
|
||||
- Using a proxy service with special pricing
|
||||
|
||||
Solutions:
|
||||
- Update pricing configuration
|
||||
- Refer to the provider's actual invoices
|
||||
|
||||
### Token Count Differs from Provider
|
||||
|
||||
CC Switch uses its own method to estimate token counts, which may slightly differ from the provider's calculation. Refer to the provider's invoice for authoritative numbers.
|
||||
Reference in New Issue
Block a user