DEV Community

Vignesh Reddy
Vignesh Reddy

Posted on

I published pip install ajah-sdk and npm install ajah-sdk — here's what they do

After two weeks of building Ajah — an
open-source self-hosted LLM observability
gateway — today I hit a milestone that
actually matters for developer adoption.

pip install ajah-sdk
npm install ajah-sdk

Both are live. Both work. Here's what
they do and why I built them.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
THE PROBLEM THEY SOLVE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Ajah is a gateway proxy that sits between
your app and any LLM provider. It scores
every response for hallucination risk,
verifies RAG outputs, detects narrative
drift across sessions, attributes costs
per feature, and masks PII before storage.

Before the SDKs, using Ajah required:

  • Cloning the repo
  • Configuring Docker
  • Manually setting headers on every request

Now it's one import.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PYTHON SDK
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

pip install ajah-sdk

from ajah import AjahClient

client = AjahClient(
gateway_url="http://localhost:8080",
api_key="your-groq-key",
feature_name="my-app",
user_id="user-123",
)

response = client.chat(
model="llama-3.3-70b-versatile",
messages=[{"role": "user",
"content": "Hello"}],
)

Every call through the SDK automatically
injects the Ajah observability headers:

X-Feature-Name, X-User-ID, X-Session-ID,
X-Agent-Step

These headers drive the entire Ajah
pipeline — cost attribution, quality
scoring, PII detection, session tracing.

Session tracking for multi-turn agents:

with client.session() as session:
plan = session.chat(
model="llama-3.3-70b-versatile",
messages=[{"role": "user",
"content": "Plan research"}],
step_name="step-1-planner",
)
research = session.chat(
model="llama-3.3-70b-versatile",
messages=[{"role": "user",
"content": "Execute plan"}],
step_name="step-2-researcher",
)
print(f"View session: {session.dashboard_url}")

AjahSession automatically increments step
numbers, maintains the session ID across
turns, and gives you a direct URL to the
visual step tree in the Ajah dashboard.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NODE.JS SDK (TYPESCRIPT)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

npm install ajah-sdk

import { AjahClient } from 'ajah-sdk'

const client = new AjahClient({
gatewayUrl: 'http://localhost:8080',
apiKey: process.env.GROQ_API_KEY!,
featureName: 'my-app',
userId: 'user-123',
})

const response = await client.chat({
model: 'llama-3.3-70b-versatile',
messages: [{ role: 'user',
content: 'Hello' }],
})

Full TypeScript types included.
AjahSession works the same way:

const session = client.session()

const r1 = await session.chat({
model: 'llama-3.3-70b-versatile',
messages: [...],
stepName: 'step-1-planner',
})

console.log(session.dashboardUrl)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHAT RUNS BEHIND THE SDK
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Every call through the SDK goes through
the Ajah gateway which runs:

Hallucination scoring — sentence
transformers evaluate every response
for factual grounding. Async. Zero
latency added.

Claim density detection — flags responses
that make many specific claims on
low-context prompts.

Linguistic hedge detection — flags
overconfident responses on complex
medical, legal, or financial questions.

Narrative drift detection — compares
claims across session turns. Flags
when a model reverses position.

Cost attribution — USD cost per call,
tracked by feature and model.

PII masking — emails, phones, SSNs,
credit cards masked before storage.

RAG verification — if you pass source
documents, responses are verified
against them. Contradictions flagged.

Prometheus metrics — all signals exposed
at /metrics for Grafana integration.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SELF-HOSTED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The SDK points at your own running Ajah
instance. No data goes through my servers.

git clone https://github.com/VigneshReddy-afk/ajah
cd ajah
docker-compose up -d

Then use the SDK pointing at localhost:8080.

MIT license. Free forever.

→ pip install ajah-sdk
→ npm install ajah-sdk

→ github.com/VigneshReddy-afk/ajah
→ useajah.com

python #nodejs #llm #opensource

buildinpublic #devtools #aiinfrastructure

Top comments (0)