TokenGoblin compares any two time periods, classifies the incident, ranks hypotheses by confidence, and tells you exactly which deploy SHA caused it.
Classifies incidents as context_bloat, behavioral_drift, traffic_spike, and more. Ranks hypotheses with confidence % and severity.
Detects deploy SHA from GitHub Actions, GitLab CI, and more. Correlates anomalies to specific deploys with precise timing.
Wrap each step with goblin.step(). Trace IDs, prompt hashes, and deploy SHA are automatic. No other code changes.
Human-readable reports for engineers or structured JSON for dashboards and automation. Your choice of output.
No prompts leave your infrastructure. Only token counts, hashes, and metadata ever reach the API.
Works with OpenAI, Anthropic, Gemini, Bedrock, Azure, Together AI, Groq, and any OpenAI-compatible endpoint.
Wrap each LLM call with goblin.step(). Deploy SHA, trace IDs, and prompt hashes are captured automatically.
from tokengoblin import TokenGoblin
goblin = TokenGoblin(
api_key="tgproj_...",
workflow_name="support_reply",
user_id_provider=lambda: request.user.id,
tenant_id_provider=lambda: request.tenant.id,
)
with goblin.step("summarize_context") as step:
# Your LLM call here
step.record_usage(
input_tokens=7600,
output_tokens=420,
cost_usd="0.00443",
)
curl -H "Authorization: Bearer tgproj_..." \
"https://api.tokengoblin.gobblsoftware.com/v1/forensic-report?period=last-7d&format=json"
{
"classification": "context_bloat",
"confidence": 0.95,
"hypotheses": [
{
"rank": 1,
"description": "Input tokens exploded 60,000×",
"severity": "critical",
"recommendation": "..."
}
],
"deploy_sha": "a1b2c3d4e5f..."
}
Add the tokengoblin SDK and wrap each step of your LLM workflow with goblin.step(). Deploy SHA is captured automatically from CI.
TokenGoblin collects cost, token, and trace data. Every step gets a trace ID, prompt hash, and deploy SHA — nothing more, nothing less.
Call GET /v1/forensic-report with any timeframe to get a structured report with classification, ranked hypotheses, and evidence.
Follow concrete recommendations — add a circuit breaker, revert a config change, or investigate a specific deploy. No guessing.
Last Thursday, a routine config change doubled the cost of our RAG pipeline. Our
retrievalstep went from $0.0021/call to $0.0065/call. TokenGoblin's forensic report classified the incident ascontext_bloatwith 95% confidence and correlated the anomaly to Thursday's deploy. We reverted the chunk size config and saved $1,200/month.
One API call comparing two weeks of a support_reply workflow. Ranked hypotheses. Actionable recommendations. No guessing.
# 🔍 Forensic Cost Report
**Classification:** context_bloat — Context Bloat
## Summary
| | Period A | Period B | Delta |
|----------------|------------|------------|--------------------------|
| **Cost** | $1.2000 | $3.8400 | +$2.6400 (+220%) |
| **Error Rate** | 0.0% | 0.0% | +0.0 pp |
## Deploy Correlation
- **All anomalous events share** deploy_sha = a1b2c3d (deployed Apr 3)
- **First anomaly detected** 10 hours after deploy
## Top Hypothesis
**[CRITICAL, 95% confidence]** Input tokens per call exploded 60,000×
- Input tokens per call: 100 → 6,000,000
- **Recommendation:** Add a circuit breaker for calls exceeding 500k tokens
# 🔍 Forensic Cost Report **Classification:** context_bloat — Context Bloat ## Summary | | Period A | Period B | Delta | |----------------|------------|------------|--------------------------| | **Cost** | $1.2000 | $3.8400 | +$2.6400 (+220%) | | **Error Rate** | 0.0% | 0.0% | +0.0 pp | ## Timeline - **First anomaly detected:** 2026-04-03 14:22 UTC - **Detection window:** Mar 25 00:00 UTC – Apr 01 00:00 UTC - **Related deploy:**sha:a1b2c3d4e5f...## Attribution Summary **Deploy correlation:** - All anomalous events sharedeploy_sha = a1b2c3d(deployed Apr 3). First anomaly detected 10 hours later. **Top users by cost increase:** | user_id | Period A | Period B | Delta | |---------|----------|----------|-------| | user_789 | $0.00 | $145.20 | +$145.20 | ## Step: summarize_context **Root cause:** Input tokens per call exploded 60,000×… **### Hypotheses** 1. **[CRITICAL, 95% confidence]** Input tokens per call exploded 6E4× - Evidence: Input tokens per call: 100 → 6,000,000 - See Evidence Log: prompt_hashes, trace_ids. - **Recommendation:** Add a circuit breaker for calls exceeding 500k tokens. 2. **[MEDIUM, 60% confidence]** High calls per run (13.5) amplifies impact - Evidence: Calls per run: 0 → 13.5 - **Recommendation:** Investigate retry loops or missing caches. --- ## Remediation Priority **Remediation priority:** **HIGH** – Immediate action recommended.
Enter your email to receive a verification link. Verify and we'll send you a project API key instantly. Early users get free access during the beta.
Any model, any API. One consistent forensic report.