docs(cookbook): add optional langfuse prerequisites

Completes Greptile review follow-up: document langfuse install/env vars
as optional in prerequisites, clarify cost cell uses completion_cost().

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
rudi193-cmd 2026-05-21 12:01:53 -06:00
parent 93faa0b207
commit e6b3361faa

View file

@ -16,6 +16,14 @@
"pip install litellm ollama\n",
"```\n",
"\n",
"**Optional** — only if you enable the Langfuse callback in the cost-tracking section below:\n",
"\n",
"```bash\n",
"pip install langfuse\n",
"export LANGFUSE_PUBLIC_KEY=\"your-public-key\"\n",
"export LANGFUSE_SECRET_KEY=\"your-secret-key\"\n",
"```\n",
"\n",
"Deploy your GGUF model with Ollama:\n",
"```bash\n",
"# Pull directly from Hugging Face Hub (no Modelfile needed for basic use)\n",
@ -131,7 +139,7 @@
"source": [
"## Cost tracking for your local model\n",
"\n",
"LiteLLM can track usage for local models too — useful when comparing cost efficiency of your fine-tuned model vs cloud."
"LiteLLM can track usage for local models too — useful when comparing cost efficiency of your fine-tuned model vs cloud. Uses the public `completion_cost()` API (same as `LiteLLM_Completion_Cost.ipynb`). Langfuse logging is optional; see prerequisites."
]
},
{
@ -140,7 +148,8 @@
"metadata": {},
"outputs": [],
"source": [
"# litellm.success_callback = [\"langfuse\"] # uncomment if you have langfuse installed/configured\n",
"# Optional: send completions to Langfuse (requires pip install langfuse + env vars above)\n",
"# litellm.success_callback = [\"langfuse\"]\n",
"\n",
"# Set a custom cost for your local model ($/1M tokens)\n",
"litellm.register_model({\n",