Otellix
May 5, 2026 ยท View on GitHub
Stop the LLM Bill Shock. Production-grade observability for Go backends โ built on OpenTelemetry.

๐ธ The Problem: "Bill Shock" is Real
Most LLM observability tools tell you what you spent after the money is gone. In production, a recursive prompt loop or a single "power user" can rack up thousands in costs before your billing alerts even trigger.
Otellix is different. It brings real-time cost enforcement to the application layer.
โก Key Features
- โ๏ธ LangChainGo Integration: Drop-in
callbacks.Handlerfor LangChainGo. Zero-config cost tracking for complex chains. - ๐ Zero-Config Attribution: Automatically capture
user_idandproject_idfrom Gin/Echo middleware. No more manual context plumbing. - ๐๏ธ Redis Budget Store: Distributed budget enforcement for high-availability production clusters.
- ๐ Go-Native & High-Performance: Built for Go 1.22+ using native streaming and OpenTelemetry.
- ๐ Standard-Compliant (OTel): 100% OTel compliant. Works with Jaeger, Honeycomb, Prometheus, and Grafana.
- ๐ Prompt Caching ROI: Track exactly how much you save with Anthropic/OpenAI prompt caching.
๐ Quick Start
go get github.com/oluwajubelo1/otellix
๐น๏ธ Try it Locally (Docker)
Want to see the full stack (Prometheus + Grafana) in action? Run our one-liner demo:
curl -sL https://raw.githubusercontent.com/oluwajubelo1/otellix/main/scripts/demo.sh | bash
1. Simple Tracing
Wrap your provider calls to get instant cost attribution and standard OTel spans.
p := openai.New()
result, err := otellix.Trace(ctx, p, params,
otellix.WithUserID("user_456"),
)
2. LangChainGo Integration
Just add the Otellix handler to your LLM configuration.
import "github.com/oluwajubelo1/otellix/integrations/langchaingo"
handler := langchaingo.NewOtellixHandler()
p, _ := openai.New(openai.WithCallback(handler))
// Automatically captures all chain events, costs, and spans.
res, err := p.GenerateContent(ctx, parts)
3. Middleware Attribution
Stop manually passing IDs. Use our middleware to discover identity from headers/sessions.
r := gin.Default()
r.Use(otellixgin.Middleware()) // Automatically populates context with User/Project IDs
๐ Standardized OTel Attributes
Otellix populates your spans with industry-standard attributes:
| Attribute | Description |
|---|---|
llm.provider | The LLM provider (OpenAI, Anthropic, etc.) |
llm.usage.cache_read_tokens | Tokens served from provider cache (Savings!) |
llm.cost_usd | Real-time USD cost of the call |
llm.budget.blocked | Flag if the call was blocked by guardrails |
๐๏ธ Supported Providers
- Anthropic: Claude 3.5 with full Prompt Caching metrics.
- OpenAI: GPT-4o, GPT-4o-mini with caching support.
- Google Gemini: Gemini 1.5 Pro & Flash.
- Ollama: Local models with zero-dependency streaming.
๐ Deep Dives
- Architecture โ How Otellix fits into the OTel ecosystem.
- Budget Guardrails โ Redis & InMemory stores.
- Integrations โ LangChainGo setup.
- Middleware & Identity โ Zero-config attribution.
- Prompt Caching โ ROI analysis and tracking.
๐ค Contributing
We love stars and contributions! Please see CONTRIBUTING.md. Licensed under MIT.