langfuse-model-upsert
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLangfuse Model Upsert
Langfuse 模型新增或更新
Create or update model pricing information.
创建或更新模型定价信息。
Setup
前置设置
Set the following environment variables before use:
| Variable | Required | Description |
|---|---|---|
| Yes | Langfuse public key |
| Yes | Langfuse secret key |
| No | Langfuse host URL (default: |
使用前请设置以下环境变量:
| 变量名 | 是否必填 | 说明 |
|---|---|---|
| 是 | Langfuse公钥 |
| 是 | Langfuse密钥 |
| 否 | Langfuse主机地址(默认值: |
When to Use
适用场景
- Setting model pricing
- Adding a new model
- Updating pricing
- 设置模型定价
- 添加新模型
- 更新定价
Commands
命令说明
1. Set Model Pricing
1. 设置模型定价
bash
npx tsx scripts/langfuse-model-upsert.ts "<model-name>" --input <input-price> --output <output-price>bash
npx tsx scripts/langfuse-model-upsert.ts "<model-name>" --input <input-price> --output <output-price>2. With Custom Match Pattern
2. 自定义匹配规则
bash
npx tsx scripts/langfuse-model-upsert.ts "<model-name>" --input <input-price> --output <output-price> --pattern "<regex>"bash
npx tsx scripts/langfuse-model-upsert.ts "<model-name>" --input <input-price> --output <output-price> --pattern "<regex>"Examples
使用示例
bash
undefinedbash
undefinedSet pricing for Groq qwen3-32b
为Groq qwen3-32b设置定价
npx tsx scripts/langfuse-model-upsert.ts "qwen/qwen3-32b" --input 0.29 --output 0.59
npx tsx scripts/langfuse-model-upsert.ts "qwen/qwen3-32b" --input 0.29 --output 0.59
Set pricing for Fireworks deepseek-v3 (with pattern)
为Fireworks deepseek-v3设置定价(带匹配规则)
npx tsx scripts/langfuse-model-upsert.ts "deepseek-v3" --input 0.20 --output 0.60 --pattern ".deepseek-v3."
undefinednpx tsx scripts/langfuse-model-upsert.ts "deepseek-v3" --input 0.20 --output 0.60 --pattern ".deepseek-v3."
undefinedOutput Example
输出示例
Updating existing model: qwen/qwen3-32b
Current: input=$0.20, output=$0.40
Deleted old model definition
Model updated successfully!
Model Name: qwen/qwen3-32b
Input Price: $0.29/1M tokens
Output Price: $0.59/1M tokensUpdating existing model: qwen/qwen3-32b
Current: input=$0.20, output=$0.40
Deleted old model definition
Model updated successfully!
Model Name: qwen/qwen3-32b
Input Price: $0.29/1M tokens
Output Price: $0.59/1M tokensParameters
参数说明
| Parameter | Description |
|---|---|
| Model identifier (required) |
| Cost per 1M input tokens (USD) |
| Cost per 1M output tokens (USD) |
| Regex pattern for model name matching (default: exact match) |
| 参数 | 说明 |
|---|---|
| 模型标识符(必填) |
| 每百万输入Token的成本(美元) |
| 每百万输出Token的成本(美元) |
| 模型名称匹配的正则表达式(默认:精确匹配) |
Notes
注意事项
- Prices are in USD per 1M tokens
- Existing models are deleted and re-created (update)
- If no pattern is specified, the model name is used as an exact match
- 价格单位为美元每百万Token
- 现有模型会先删除再重新创建(即更新操作)
- 若未指定匹配规则,则使用模型名称进行精确匹配