API Reference

HalluTrace AI API

Integrate hallucination detection into your LLM applications. Send traces via SDK or REST API — we handle evaluation automatically.

Base URL: https://api.hallutraceai.com

Quick Start

1. Get API Key

Sign up, create a project, and copy your sk_live_ key.

2. Install SDK

pip install hallutraceai or npm install hallutraceai

3. Send Traces

Call ht.trace() — we evaluate for hallucination automatically.

Install
pip install hallutraceai
quickstart.py
from hallutraceai import HalluTrace

ht = HalluTrace(api_key="sk_live_your_key")

# Single trace
ht.trace(
    session_id="chat-123",
    type="agent",
    input="What is the capital of France?",
    output="The capital of France is Paris.",
    system_prompt="You are a geography assistant.",
    model_name="gpt-4",
)

# Batch trace
ht.trace_batch([
    {
        "session_id": "chat-456",
        "messages": [
            {
                "message_id": "msg-1",
                "type": "agent",
                "input": "Hello",
                "output": "Hi there! How can I help?",
                "model_name": "gpt-4",
            },
            {
                "message_id": "msg-2",
                "type": "tool",
                "input": "search: weather",
                "output": '{"temp": 72, "condition": "sunny"}',
            },
        ],
    }
])

Authentication

All trace endpoints authenticate via API key in the X-API-Key header. Dashboard endpoints use JWT Bearer tokens.

API Key Authentication
# SDK (automatic)
ht = HalluTrace(api_key="sk_live_...")

# REST API (manual)
curl -H "X-API-Key: sk_live_..." https://api.hallutraceai.com/v1/traces

Keep your API key secret. Do not expose it in client-side code. Use environment variables or a backend proxy.

API Endpoints

Traces

Sessions

Evaluations

Projects

Export

Full interactive API documentation with request/response schemas:

Open Swagger UI

Message Types

agent

LLM responses — these are evaluated for hallucination. The system checks if the output aligns with the system prompt. Score: 0 (perfect) to 100 (hallucinated).

tool

Tool/function call results — these are logged but not evaluated. Useful for tracking RAG retrieval, API calls, or any tool output in the conversation chain.

Pricing

Free

10M tokens/month

1 team member

$0.08

per 1M tokens

1 team member

MAX-T

$895/mo · 15% off tokens

Unlimited team · JSON export · Custom eval prompts

All plans include Zero Storage mode. Paid plans include bring-your-own-model (80% discount). Tokens counted for: input, output, system prompt, and RAG context.

Ready to get started?

Create a free account and start detecting hallucinations in minutes.