Not yet available. Native Langfuse integration is on the roadmap. The information below describes the intended setup.
Langfuse is an open-source LLM observability platform that logs traces, measures quality, and tracks cost over time. OpenDunes plans to export request traces to Langfuse natively, so every completion appears automatically in your Langfuse dashboard with full prompt, response, and DA cost data.
Once the integration ships:
- Automatic tracing — every
POST /v1/chat/completions request creates a Langfuse trace with no SDK changes in your code
- Cost tracking in DA — token counts and Algerian Dinar costs appear alongside each trace
- Evaluation — run LLM-as-judge evaluators on sampled traces, track scores over time
- Session grouping — group related turns into sessions for multi-turn conversation analysis
Until native export is available, instrument your OpenDunes calls with the Langfuse SDK directly:
import os
from openai import OpenAI
from langfuse import Langfuse
from langfuse.decorators import observe, langfuse_context
langfuse = Langfuse(
public_key=os.environ["LANGFUSE_PUBLIC_KEY"],
secret_key=os.environ["LANGFUSE_SECRET_KEY"],
host=os.environ.get("LANGFUSE_HOST", "https://cloud.langfuse.com"),
)
client = OpenAI(
base_url="https://opendunes.com/api/v1",
api_key=os.environ["OPENDUNES_API_KEY"],
)
@observe(as_type="generation")
def ask(prompt: str, model: str = "anthropic/claude-sonnet-5") -> str:
langfuse_context.update_current_observation(
model=model,
input=prompt,
)
resp = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": prompt}],
)
text = resp.choices[0].message.content
langfuse_context.update_current_observation(
output=text,
usage={
"input": resp.usage.prompt_tokens,
"output": resp.usage.completion_tokens,
},
)
return text
result = ask("What are the official languages of Algeria?")
print(result)
langfuse.flush()
import OpenAI from "openai";
import { Langfuse } from "langfuse";
const langfuse = new Langfuse({
publicKey: process.env.LANGFUSE_PUBLIC_KEY!,
secretKey: process.env.LANGFUSE_SECRET_KEY!,
});
const client = new OpenAI({
baseURL: "https://opendunes.com/api/v1",
apiKey: process.env.OPENDUNES_API_KEY,
});
const trace = langfuse.trace({ name: "chat" });
const generation = trace.generation({
name: "completion",
model: "google/gemini-2.5-pro",
input: [{ role: "user", content: "What is Tamazight?" }],
});
const resp = await client.chat.completions.create({
model: "google/gemini-2.5-pro",
messages: [{ role: "user", content: "What is Tamazight?" }],
});
generation.end({
output: resp.choices[0].message.content,
usage: {
input: resp.usage?.prompt_tokens,
output: resp.usage?.completion_tokens,
},
});
await langfuse.flushAsync();
Langfuse can be self-hosted on your own infrastructure. Set LANGFUSE_HOST to your instance URL. This is useful for data residency requirements under Algeria's Law 18-07.
Watch the OpenDunes changelog for updates on native Langfuse support.