Trace rawroute calls in Langfuse. Exact token accounting + OpenTelemetry traces.
Because rawroute returns unmodified official model IDs and accurate prompt, completion, and cached token counts on every response, Langfuse automatically tracks latency, cache hit rates, and per-trace cost across all 36 models via OpenTelemetry or the drop-in OpenAI wrapper.
Quick setup for Langfuse
- Configure LangfuseSpanProcessor with OpenTelemetry (Node.js) or langfuse.openai (Python).
- Point your client base URL to https://api.rawroute.dev/v1 using your rawroute API key.
- Optional: sync custom model pricing in Langfuse from https://rawroute.dev/data/models.json.
import { NodeSDK } from "@opentelemetry/sdk-node"
import { LangfuseSpanProcessor } from "@langfuse/otel"
import { generateText } from "ai"
import { rawroute } from "@rawroute/ai-sdk"
const sdk = new NodeSDK({ spanProcessors: [new LangfuseSpanProcessor()] })
sdk.start()
const { text } = await generateText({
model: rawroute("gpt-6.2-sol"),
prompt: "Classify this support ticket into JSON.",
experimental_telemetry: { isEnabled: true, functionId: "ticket-router" },
})Recommended models for Langfuse
| Model | Model ID | Official | OpenRouter +5.5% | rawroute (0%) | Providers |
|---|---|---|---|---|---|
| GPT-6.2 Sol | gpt-6.2-sol | $2.11 / $10.55 | $0.60 / $3.00 | 3 | |
| Claude Sonnet 5.5 | claude-sonnet-5-5 | $2.11 / $10.55 | $1.00 / $5.00 | 4 | |
| Gemini 4 Argon | gemini-4-argon | $2.11 / $10.55 | $1.00 / $5.00 | 4 | |
| Grok 4.7 | grok-4.7 | $2.11 / $6.33 | $1.00 / $3.00 | 3 |
When NOT to use rawroute
- — rawroute already records per-key usage logs and USD billing in your dashboard; add Langfuse when you also want prompt versioning, evals, and full agent trace trees.
FAQ
Can Langfuse pull rawroute live USD prices automatically?
Yes. Fetch https://rawroute.dev/pricing.json or /data/models.json (unauthenticated, CC BY 4.0) to keep Langfuse cost definitions matched 1:1.