Langfuse Model Upsert
Create or update model pricing information.
Setup
Set the following environment variables before use:
| Variable | Required | Description |
|---|---|---|
LANGFUSE_PUBLIC_KEY | Yes | Langfuse public key |
LANGFUSE_SECRET_KEY | Yes | Langfuse secret key |
LANGFUSE_HOST or LANGFUSE_BASE_URL | No | Langfuse host URL (default: https://us.cloud.langfuse.com) |
When to Use
- Setting model pricing
- Adding a new model
- Updating pricing
Commands
1. Set Model Pricing
npx tsx scripts/langfuse-model-upsert.ts "<model-name>" --input <input-price> --output <output-price>
2. With Custom Match Pattern
npx tsx scripts/langfuse-model-upsert.ts "<model-name>" --input <input-price> --output <output-price> --pattern "<regex>"
Examples
# Set pricing for Groq qwen3-32b
npx tsx scripts/langfuse-model-upsert.ts "qwen/qwen3-32b" --input 0.29 --output 0.59
# Set pricing for Fireworks deepseek-v3 (with pattern)
npx tsx scripts/langfuse-model-upsert.ts "deepseek-v3" --input 0.20 --output 0.60 --pattern ".*deepseek-v3.*"
Output 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 tokens
Parameters
| Parameter | Description |
|---|---|
<model-name> | Model identifier (required) |
--input | Cost per 1M input tokens (USD) |
--output | Cost per 1M output tokens (USD) |
--pattern | Regex pattern for model name matching (default: exact match) |
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