--- name: langfuse description: Langfuse - LLM observability + tracing + analytics مفتوح المصدر. يُستخدم لـ debugging الـ AI calls، تتبع التكلفة، تحسين الـ prompts، A/B testing، monitoring المحادثات. الإصدار المجاني (Langfuse Cloud Free) كافٍ لـ 50K observations/شهر. أفضل من LangSmith (مدفوع $39/شهر) والـ free tier أكبر بكثير. license: MIT ---
Langfuse — LLM Observability for OpenClaw
أقوى أداة مراقبة وتحليل LLM mفتوحة المصدر.
مقارنة سريعة
| المعيار | LangSmith | Langfuse | |---|---|---| | Free tier | محدود (5K/شهر) | 🥇 50K observations/شهر | | Pricing | $39/شهر | 🥇 Free + Pay-as-you-grow | | Self-host | ❌ | 🥇 ✅ Docker | | LangChain | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | | Direct OpenAI/Anthropic | ⭐⭐⭐ | 🥇 ⭐⭐⭐⭐⭐ | | Cost tracking | ✅ | ✅ | | Prompt management | ⭐⭐⭐⭐ | 🥇 ⭐⭐⭐⭐⭐ | | Datasets + Evals | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
Use Cases
- 🔍 Debug kل LLM call (Claude/GPT/Gemini/Mistral/DeepSeek/Kimi)
- 💰 تتبع التكلفة بدقة (per project/user/feature)
- 📊 تحليل سرعة الردود وlatency
- 🎯 A/B test الـ prompts والـ models
- ❌ Catch errors وأخطاء الـ JSON parsing
- 📝 Prompt management (versioning + collaboration)
Environment
bash
LANGFUSE_PUBLIC_KEY=pk-lf-xxx
LANGFUSE_SECRET_KEY=sk-lf-xxx
LANGFUSE_HOST=https://cloud.langfuse.com # or self-hosted
Setup (3 دقائق)
1. سجل على https://cloud.langfuse.com (مجاني) 2. أنشئ Project (مثلاً "OpenClaw") 3. Settings → API Keys → Create new keys 4. أرسل الـ keys
Commands
bash
Test connection
python3 langfuse_tool.py statusTrace any LLM call
python3 langfuse_tool.py trace --model "gpt-4" --input "hello" --output "hi"Get session traces
python3 langfuse_tool.py sessions --limit 10Get cost summary
python3 langfuse_tool.py costs --days 7
Auto-Instrumentation
عندما يضبط الـ keys، يمكن دمج Langfuse تلقائياً في كل LLM calls:
python
from langfuse import Langfuse
from langfuse.openai import openai # auto-traceslangfuse = Langfuse()
client = openai.OpenAI(...)
Every call automatically traced!