[{"data":1,"prerenderedAt":167},["ShallowReactive",2],{"seo-verification":3,"blog-self-host-langfuse-on-a-vps-llm-observability-no-saas-bill-ma-en":6,"promo-bar-likely":166},{"google":4,"bing":5},"EycwPY2XMyTkVzas3n1ygeNJFGAH513qrMjfDljzsMQ","",{"key":7,"data":8},"blog-self-host-langfuse-on-a-vps-llm-observability-no-saas-bill-ma-en",{"id":9,"slug":10,"slugs":11,"title":15,"excerpt":16,"readTime":17,"views":18,"isPinned":19,"noindex":19,"publishedAt":20,"updatedAt":21,"category":22,"categories":28,"featuredImage":30,"bgImage":31,"posterImage":32,"relatedSolution":33,"intro":36,"sections":37,"ctaTitle":99,"ctaBody":100,"ctaButton":101,"ctaUrl":102,"relatedPosts":103},177,"self-host-langfuse-on-a-vps-llm-observability-no-saas-bill",{"fr":12,"en":10,"ar":13,"es":14},"self-host-langfuse-vps","استضافة-langfuse-على-vps-مراقبة-llm-بلا-فاتورة-saas","alojar-langfuse-en-un-vps","Self-Host Langfuse on a VPS: LLM Observability, No SaaS Bill","Self-host Langfuse on a VPS — trace every AI call, evaluate prompts, track LLM costs. Full guide: installation, nginx, TLS, Python\u002FJS SDK integration, troubleshooting.",11,2,false,"2026-07-12T00:00:00+00:00","2026-11-04T16:30:26+00:00",{"id":23,"name":24,"slug":25,"color":26,"icon":27},1,"Artificial Intelligence","intelligence-artificielle","bg-purple-500\u002F10 text-purple-400","ia",[29],{"id":23,"name":24,"slug":25,"color":26,"icon":27},null,"\u002Fblog\u002Fcovers\u002Fbg.svg","\u002Fblog\u002Fcovers\u002Fself-host-langfuse-vps-poster.svg",{"categorySlug":34,"appSlug":35},"artificial-intelligence","langfuse","Every LLM-powered application eventually produces a question its developers can't answer from logs alone: why did that response degrade, which prompt version performed better, and where is the money going? Langfuse (MIT, ~30 k GitHub stars, v3.212.0) is the open-source answer: a full-stack observability platform for LLM applications that you deploy on your own VPS and connect to any model provider in minutes.",[38,42,52,55,80,83,87,90,93,96],{"type":39,"title":40,"body":41},"h2","Why LLM applications need dedicated observability","Traditional APM tools (Datadog, New Relic) capture HTTP latency and error rates — but they are blind to what happens inside an LLM call. A response that arrives in 800 ms might still be factually wrong, unhelpfully vague, or three times more expensive than yesterday's because a prompt regression slipped through code review. Langfuse solves this by treating each LLM interaction as a structured trace: it records the full prompt (including system message and conversation history), the completion, the model used, the token counts, the latency breakdown per span, and any evaluation scores your team attaches. You can then filter, compare, and reproduce any trace — individually or in aggregate.",{"type":43,"title":44,"items":45},"ul","What Langfuse gives you out of the box",[46,47,48,49,50,51],"Full-stack LLM tracing: prompt, completion, latency, cost and token count — including nested spans for agent chains (LangChain, LlamaIndex, Dify).","Prompt management hub: version-control your prompts, stage variants, A\u002FB test in production, promote the winner without a code deploy.","Evaluation framework: run LLM-as-a-judge, human annotation queues, or custom scoring functions on any trace or dataset.","Cost analytics: track token spend by model, endpoint, user and session — switch providers with data, not guesswork.","Dataset management: capture production traces as golden test sets for offline evaluation and regression detection.","Native SDK for Python and TypeScript, plus automatic integration with LiteLLM, LangChain, LlamaIndex, Dify, Haystack and VercelAI.",{"type":39,"title":53,"body":54},"What Langfuse runs on (and why it needs 4 GB RAM)","Langfuse v3 ships as a six-service Docker Compose stack: `langfuse` (Next.js frontend + API), `langfuse-worker` (background jobs and evaluations), `postgres` (application state), `clickhouse` (trace analytics — columnar storage optimised for high-cardinality time-series), `redis` (queue and cache), and `minio` (S3-compatible blob storage for media attachments). ClickHouse is the reason for the 4 GB minimum: its JIT compiler and vector execution engine need headroom. On a quiet VPS the full stack idles around 1.5–2 GB; under moderate production load plan for 4 GB, with 8 GB for sustained high-throughput tracing. All six services start from a single `docker compose up -d` and are managed by AWX in the ServOrbit one-click flow.",{"type":56,"title":57,"steps":58},"steps","Deploy Langfuse on your VPS in six steps",[59,62,65,68,71,74,77],{"title":60,"body":61},"Order a VPS Power (8 GB RAM)","Langfuse needs at least 4 GB of RAM: in the catalogue the first plan that clears that bar is the VPS Power (4 vCPU, 8 GB), installed on Ubuntu 24.04 — enough to absorb persistent production traffic too. Pick a domain or subdomain you control — Langfuse's NextAuth session cookies require a proper HTTPS domain.",{"title":63,"body":64},"One-click install from the marketplace","Open your ServOrbit control panel, go to Marketplace → Artificial Intelligence → Langfuse, and click Deploy. Enter your domain when prompted. Docker Compose pulls all six images and starts them; the web UI is ready on port 3000 within 60–90 seconds (ClickHouse first-boot initialisation takes the longest).",{"title":66,"body":67},"Open the web UI and create your first project","Navigate to `https:\u002F\u002Fyour-domain.com`. Langfuse shows the signup screen on first boot. Create your admin account, then go to Settings → Projects → Create project. Copy the **Public Key** and **Secret Key** from the project settings — you'll need them in your application.",{"title":69,"body":70},"Instrument your Python or TypeScript application","In Python: `pip install langfuse`, set `LANGFUSE_HOST=https:\u002F\u002Fyour-domain.com`, `LANGFUSE_PUBLIC_KEY` and `LANGFUSE_SECRET_KEY`, then decorate your LLM calls with `@observe()` or use `langfuse.trace()`. In TypeScript: `npm install langfuse`, initialise the client with your host and keys. Traces appear in the dashboard within seconds of the first call.",{"title":72,"body":73},"Enable automatic tracing if you use LiteLLM","If LiteLLM is already in your stack (which it likely is if you use the ServOrbit AI stack), add `success_callback = [\"langfuse\"]` to `litellm_config.yaml` and set the three Langfuse env vars. Every proxied LLM call — across all downstream models — is traced automatically, with cost and token data attached.",{"title":75,"body":76},"Run your first evaluation","Go to Traces, filter for a representative sample, click 'Add to dataset'. Open Datasets → your dataset → Run evaluation, choose LLM-as-a-judge with a prompt template ('Rate the relevance of this response on a scale of 1–5'), and submit. Scores appear on every trace in the set and feed into the aggregate analytics dashboard.",{"title":78,"body":79},"Logging in for the first time","The URL opens the Langfuse screen with a \"Sign up\" link: create your account, then your organisation and your first project in the wizard.",{"type":39,"title":81,"body":82},"Post-install configuration: nginx reverse proxy, TLS and key environment variables","The ServOrbit Marketplace installation configures nginx and the TLS certificate for you. If you are setting up manually, here are the critical points.\n\n**nginx reverse proxy.** Langfuse listens on port 3000. Your nginx vhost must proxy this port and forward the headers NextAuth requires:\n\n```nginx\nserver {\n    listen 443 ssl;\n    server_name your-domain.com;\n    location \u002F {\n        proxy_pass http:\u002F\u002F127.0.0.1:3000;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n    }\n}\n```\n\nIf `X-Forwarded-Proto` is not forwarded, NextAuth generates callback URLs over `http:\u002F\u002F` and session cookies do not attach on the HTTPS response — symptom: redirect loop after login.\n\n**Key environment variables.** The Langfuse stack `.env` file has three variables you must set before the first start:\n\n- `NEXTAUTH_SECRET`: a long random string (minimum 32 characters). Without it, sessions do not persist across restarts.\n- `NEXTAUTH_URL`: the full public URL of your instance (`https:\u002F\u002Fyour-domain.com`). Must exactly match the nginx domain.\n- `LANGFUSE_INIT_ORG_ID`, `LANGFUSE_INIT_PROJECT_ID`, `LANGFUSE_INIT_PROJECT_PUBLIC_KEY`, `LANGFUSE_INIT_PROJECT_SECRET_KEY`: optional, but useful for provisioning an organisation and project on first boot without using the UI.\n\n**TLS.** ServOrbit deployments use Let's Encrypt via certbot in DNS-01 mode — no port 80 required. If you configure the certificate manually, point the `ssl_certificate` and `ssl_certificate_key` directives at the certbot-issued files and enable automatic renewal (`certbot renew --quiet` in cron).",{"type":84,"title":85,"body":86},"tip","Pair with LiteLLM for complete AI cost visibility","The ServOrbit AI stack already includes LiteLLM as an OpenAI-compatible gateway. Connect Langfuse to LiteLLM with three env vars and you get a complete picture: LiteLLM enforces rate limits and routes between providers; Langfuse records every trace with full prompt, completion, model, tokens and cost. Together they give you a private, auditable AI operations layer — no SaaS middleman, no data egress.",{"type":39,"title":88,"body":89},"SDK integration: tracing your LLM agents in Python and TypeScript","Langfuse ships two official SDKs covering the main agent frameworks.\n\n**Python — `@observe()` decorator.**\nThe most direct way to trace an agent:\n\n```python\nfrom langfuse.decorators import observe, langfuse_context\n\n@observe()\ndef run_agent(user_message: str) -> str:\n    # every nested LLM call is automatically captured\n    response = openai_client.chat.completions.create(\n        model=\"gpt-4o\",\n        messages=[{\"role\": \"user\", \"content\": user_message}]\n    )\n    return response.choices[0].message.content\n```\n\nAll nested functions decorated with `@observe()` appear as child spans within the same trace. To attach metadata (user ID, session tags):\n\n```python\nlangfuse_context.update_current_trace(\n    user_id=\"user-42\",\n    session_id=\"session-abc\",\n    tags=[\"production\", \"agent-v2\"]\n)\n```\n\n**LangChain.** The native integration activates in one line:\n\n```python\nfrom langfuse.callback import CallbackHandler\nhandler = CallbackHandler()  # reads LANGFUSE_* from env\nchain.invoke({\"input\": query}, config={\"callbacks\": [handler]})\n```\n\nEvery node in a LangGraph graph (or LangChain chain) becomes a span with its own token count and cost.\n\n**TypeScript \u002F JavaScript.**\nClient initialisation:\n\n```typescript\nimport Langfuse from \"langfuse\";\nconst lf = new Langfuse({\n  publicKey: process.env.LANGFUSE_PUBLIC_KEY!,\n  secretKey: process.env.LANGFUSE_SECRET_KEY!,\n  baseUrl: process.env.LANGFUSE_HOST,\n});\n```\n\nCreating a trace and a generation:\n\n```typescript\nconst trace = lf.trace({ name: \"agent-run\", userId: \"user-42\" });\nconst generation = trace.generation({\n  name: \"llm-call\",\n  model: \"gpt-4o\",\n  input: messages,\n});\n\u002F\u002F … LLM call …\ngeneration.end({ output: result, usage: { input: 120, output: 45 } });\nawait lf.shutdownAsync(); \u002F\u002F flush buffer before process exits\n```\n\n**Vercel AI SDK.** If you use the Vercel AI SDK, the Langfuse integration activates by adding `langfuseExporter` as a `SpanExporter` in the OpenTelemetry configuration — all generations are traced without changing your business logic.",{"type":39,"title":91,"body":92},"LLM costs showing $0.00 in Tracing v4 — what is happening and how to work around it","An active bug affects Langfuse's Tracing v4 view (tracked in \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flangfuse\u002Flangfuse\u002Fissues\u002F16077\">issue #16077\u003C\u002Fa>, 17 comments in August 2026): the **Cost ($)** column always displays $0.00 for every trace.\n\nThe root cause is structural. The v4 view reads the cost stored on the **root observation** of each trace, which is of type SPAN — a span carries no cost of its own; it only wraps child generation observations. The actual cost is distributed across child GENERATION observations, but the view does not aggregate them: it reads the root, finds zero, and displays zero.\n\nYour data is intact. Cost is correctly recorded on each generation; only the display in the main view is wrong. Three workarounds are available while the official fix is pending:\n\n**1. Analytics \u002F Metrics tab** — the aggregate view computes costs across all generations, not just the root. This is the reliable source for tracking your daily spend.\n\n**2. Filter by GENERATION type in Traces** — add the filter `observation_type = GENERATION`. Every row shows its real cost.\n\n**3. Open the trace detail panel** — the side panel shows the full breakdown by span and generation with correct costs. Useful to diagnose a specific trace.\n\nIf you observe this on your instance, confirm you are running Langfuse v3.x with Tracing v4 enabled. The issue is open and tracked by the Langfuse team.",{"type":39,"title":94,"body":95},"Troubleshooting: five common errors after installation","**1. The `langfuse` container does not start — `Error: NEXTAUTH_SECRET` missing.**\nLangfuse v3 refuses to start without this variable. Check your `.env`:\n\n```bash\ndocker compose config | grep NEXTAUTH_SECRET\n```\n\nIf the line is absent or empty, generate a value and restart:\n\n```bash\nopenssl rand -base64 32\n# paste the result into .env: NEXTAUTH_SECRET=\u003Cvalue>\ndocker compose up -d langfuse\n```\n\n**2. Database connection refused — `ECONNREFUSED postgres:5432`.**\nThis is almost always a startup timing issue: `langfuse` attempts to connect before `postgres` is ready. Make sure your `docker-compose.yml` declares `depends_on` with `condition: service_healthy` for the `postgres` service. If the problem persists, inspect the postgres logs:\n\n```bash\ndocker compose logs postgres --tail=50\n```\n\n**3. Traces are not appearing in the dashboard.**\nCheck in order: (a) are the environment variables `LANGFUSE_HOST`, `LANGFUSE_PUBLIC_KEY` and `LANGFUSE_SECRET_KEY` set in your application? (b) Does the host point to the public HTTPS URL and not to `localhost:3000`? (c) Is the Python SDK flushing its buffer before the process exits (`langfuse.flush()` or `langfuse.shutdown()`)?\n\nA quick test call from Python:\n\n```python\nfrom langfuse import Langfuse\nlf = Langfuse()\nlf.trace(name=\"test-connection\")\nlf.flush()\nprint(\"Trace sent — check the dashboard.\")\n```\n\n**4. Redirect loop after login.**\nMost common cause: `NEXTAUTH_URL` does not match the domain in use, or `X-Forwarded-Proto` is not forwarded by nginx. Verify that `NEXTAUTH_URL=https:\u002F\u002Fyour-domain.com` (no trailing slash) and that your nginx config includes `proxy_set_header X-Forwarded-Proto $scheme;`.\n\n**5. ClickHouse consuming all available RAM.**\nUnder heavy load, ClickHouse can exceed its initial allocation. Limit memory consumption by adding to your `.env`:\n\n```bash\nCLICKHOUSE_MAX_MEMORY_USAGE=2000000000\n```\n\nThis value (2 GB) is a reasonable starting point for an 8 GB VPS running only Langfuse. Adjust based on your trace volume.",{"type":39,"title":97,"body":98},"Langfuse vs Langsmith vs Helicone","Langsmith (LangChain's hosted product) and Helicone are the main SaaS alternatives. Both are excellent — and both require you to route your traces through their servers. For teams handling sensitive prompts (legal, financial, medical), or for compliance environments that prohibit third-party data egress, self-hosting is not optional. Langfuse gives you the same feature set (tracing, evals, prompt management, cost analytics) on infrastructure you control. The MIT licence also means you can read, modify and audit every line of the code your traces flow through.","Deploy Langfuse on your VPS","Get full LLM observability in one click — trace every AI request, manage your prompts and track costs, on infrastructure you control.","Deploy Langfuse","\u002Fapplications\u002Fartificial-intelligence\u002Flangfuse",[104,128,147],{"id":105,"slug":106,"slugs":107,"title":111,"excerpt":112,"readTime":113,"views":114,"isPinned":19,"noindex":19,"publishedAt":115,"updatedAt":116,"category":117,"categories":123,"featuredImage":30,"bgImage":31,"posterImage":125,"relatedSolution":126},156,"self-host-litellm-on-a-vps-your-private-llm-api-gateway",{"fr":108,"en":106,"ar":109,"es":110},"self-host-litellm-vps","استضف-litellm-ذاتيا-على-vps-بوابة-api-خاصة-لنماذج-llm","alojar-litellm-en-un-vps-pasarela-llm-privada","Self-Host LiteLLM on a VPS: Your Private LLM API Gateway","Deploy LiteLLM on a ServOrbit VPS — a self-hosted, OpenAI-compatible gateway to Ollama, Anthropic, Azure and 100+ LLM providers, with spend tracking and rate limits.",9,3,"2026-01-21T00:00:00+00:00","2026-11-09T20:55:12+00:00",{"id":118,"name":119,"slug":120,"color":121,"icon":122},7,"Self-hosting","self-hosting","bg-indigo-500\u002F10 text-indigo-400","cloud",[124],{"id":118,"name":119,"slug":120,"color":121,"icon":122},"\u002Fblog\u002Fcovers\u002Fself-host-litellm-vps-poster.svg",{"categorySlug":34,"appSlug":127},"litellm",{"id":129,"slug":130,"slugs":131,"title":135,"excerpt":136,"readTime":137,"views":138,"isPinned":19,"noindex":19,"publishedAt":139,"updatedAt":140,"category":141,"categories":142,"featuredImage":30,"bgImage":31,"posterImage":144,"relatedSolution":145},12,"how-to-host-localai-on-a-vps",{"fr":132,"en":130,"ar":133,"es":134},"heberger-localai-vps","كيفية-استضافة-localai-على-خادم-vps","como-alojar-localai-en-un-vps","How to Host LocalAI on a VPS","Deploy LocalAI on your VPS: full Docker Compose setup, GGUF models, gallery, Whisper, embeddings, API key protection, OpenAI SDK connection and troubleshooting.",8,0,"2026-06-08T00:00:00+00:00","2026-10-07T23:07:24+00:00",{"id":23,"name":24,"slug":25,"color":26,"icon":27},[143],{"id":23,"name":24,"slug":25,"color":26,"icon":27},"\u002Fblog\u002Fcovers\u002Fheberger-localai-vps-poster.svg",{"categorySlug":34,"appSlug":146},"local-ai",{"id":148,"slug":149,"slugs":150,"title":154,"excerpt":155,"readTime":156,"views":138,"isPinned":19,"noindex":19,"publishedAt":157,"updatedAt":158,"category":159,"categories":160,"featuredImage":30,"bgImage":31,"posterImage":162,"relatedSolution":163},176,"self-host-openobserve-on-a-vps-unified-logs-metrics-and-traces",{"fr":151,"en":149,"ar":152,"es":153},"self-host-openobserve-vps","استضافة-openobserve-على-vps-سجلات-ومقاييس-وتتبعات-موحدة","alojar-openobserve-en-un-vps","Self-Host OpenObserve on a VPS: Unified Logs, Metrics and Traces","Replace Elasticsearch + Grafana with OpenObserve: one Rust binary for logs, metrics, traces and dashboards at 140× lower storage cost. Full self-host guide.",6,"2026-07-10T00:00:00+00:00","2026-09-07T11:26:10+00:00",{"id":118,"name":119,"slug":120,"color":121,"icon":122},[161],{"id":118,"name":119,"slug":120,"color":121,"icon":122},"\u002Fblog\u002Fcovers\u002Fself-host-openobserve-vps-poster.svg",{"categorySlug":164,"appSlug":165},"monitoring-observability","openobserve",true,1794270489131]