Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

docs(langfuse.md): add doc on pass through

Krrish Dholakia91aac0533b6c
diff --git a/docs/my-website/docs/pass_through/langfuse.md b/docs/my-website/docs/pass_through/langfuse.md
new file mode 100644
index 00000000000..8987842f709
--- /dev/null
+++ b/docs/my-website/docs/pass_through/langfuse.md
@@ -0,0 +1,132 @@
+# Langfuse Endpoints (Pass-Through)
+
+Pass-through endpoints for Langfuse - call langfuse endpoints with LiteLLM Virtual Key.
+
+Just replace `https://us.cloud.langfuse.com` with `LITELLM_PROXY_BASE_URL/langfuse` 🚀
+
+#### **Example Usage**
+```python
+from langfuse import Langfuse
+
+langfuse = Langfuse(
+ host="http://localhost:4000/langfuse", # your litellm proxy endpoint
+ public_key="anything", # no key required since this is a pass through
+ secret_key="LITELLM_VIRTUAL_KEY", # no key required since this is a pass through
+)
+
+print("sending langfuse trace request")
+trace = langfuse.trace(name="test-trace-litellm-proxy-passthrough")
+print("flushing langfuse request")
+langfuse.flush()
+
+print("flushed langfuse request")
+```
+
+Supports **ALL** Langfuse Endpoints.
+
+[**See All Langfuse Endpoints**](https://api.reference.langfuse.com/)
+
+## Quick Start
+
+Let's log a trace to Langfuse.
+
+1. Add Langfuse Public/Private keys to environment
+
+```bash
+export LANGFUSE_PUBLIC_KEY=""
+export LANGFUSE_PRIVATE_KEY=""
+```
+
+2. Start LiteLLM Proxy
+
+```bash
+litellm
+
+# RUNNING on http://0.0.0.0:4000
+```
+
+3. Test it!
+
+Let's log a trace to Langfuse!
+
+```python
+from langfuse import Langfuse
+
+langfuse = Langfuse(
+ host="http://localhost:4000/langfuse", # your litellm proxy endpoint
+ public_key="anything", # no key required since this is a pass through
+ secret_key="anything", # no key required since this is a pass through
+)
+
+print("sending langfuse trace request")
+trace = langfuse.trace(name="test-trace-litellm-proxy-passthrough")
+print("flushing langfuse request")
+langfuse.flush()
+
+print("flushed langfuse request")
+```
+
+
+## Advanced - Use with Virtual Keys
+
+Pre-requisites
+- [Setup proxy with DB](../proxy/virtual_keys.md#setup)
+
+Use this, to avoid giving developers the raw Google AI Studio key, but still letting them use Google AI Studio endpoints.
+
+### Usage
+
+1. Setup environment
+
+```bash
+export DATABASE_URL=""
+export LITELLM_MASTER_KEY=""
+export LANGFUSE_PUBLIC_KEY=""
+export LANGFUSE_PRIVATE_KEY=""
+```
+
+```bash
+litellm
+
+# RUNNING on http://0.0.0.0:4000
+```
+
+2. Generate virtual key
+
+```bash
+curl -X POST 'http://0.0.0.0:4000/key/generate' \
+-H 'Authorization: Bearer sk-1234' \
+-H 'Content-Type: application/json' \
+-d '{}'
+```
+
+Expected Response
+
+```bash
+{
+ ...
+ "key": "sk-1234ewknldferwedojwojw"
+}
+```
+
+3. Test it!
+
+
+```python
+from langfuse import Langfuse
+
+langfuse = Langfuse(
+ host="http://localhost:4000/langfuse", # your litellm proxy endpoint
+ public_key="anything", # no key required since this is a pass through
+ secret_key="sk-1234ewknldferwedojwojw", # no key required since this is a pass through
+)
+
+print("sending langfuse trace request")
+trace = langfuse.trace(name="test-trace-litellm-proxy-passthrough")
+print("flushing langfuse request")
+langfuse.flush()
+
+print("flushed langfuse request")
+```
+
+## [Advanced - Log to separate langfuse projects (by key/team)](../proxy/team_logging.md)
\ No newline at end of file
diff --git a/docs/my-website/docs/proxy/team_logging.md b/docs/my-website/docs/proxy/team_logging.md
index e36cb8f669c..ef4ebe59120 100644
--- a/docs/my-website/docs/proxy/team_logging.md
+++ b/docs/my-website/docs/proxy/team_logging.md
@@ -207,7 +207,7 @@ curl -X POST 'http://0.0.0.0:4000/key/generate' \
-H 'Content-Type: application/json' \
-d '{
"metadata": {
- "logging": {
+ "logging": [{
"callback_name": "langfuse", # 'otel', 'langfuse', 'lunary'
"callback_type": "success" # set, if required by integration - future improvement, have logging tools work for success + failure by default
"callback_vars": {
@@ -215,7 +215,7 @@ curl -X POST 'http://0.0.0.0:4000/key/generate' \
"langfuse_secret_key": "os.environ/LANGFUSE_SECRET_KEY", # [RECOMMENDED] reference key in proxy environment
"langfuse_host": "https://cloud.langfuse.com"
}
- }
+ }]
}
}'
diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js
index 6501ebd7572..1dcaf008e64 100644
--- a/docs/my-website/sidebars.js
+++ b/docs/my-website/sidebars.js
@@ -195,7 +195,8 @@ const sidebars = {
"pass_through/vertex_ai",
"pass_through/google_ai_studio",
"pass_through/cohere",
- "pass_through/bedrock"
+ "pass_through/bedrock",
+ "pass_through/langfuse"
],
},
"scheduler",