Skip to Content
Developers
Guide

SDKs & Go CLI

Official Python SDK (vidhi), standalone TypeScript SDK (@vidhi/sdk), and Go Cobra CLI (vidhi).

Open Markdown

All three developer artifacts consume code/services/vidhi-api/openapi/v1-developer.yaml and automatically handle Bearer authentication, Idempotency-Key UUIDv4 generation on metered POST calls, 429/503 exponential backoff respecting Retry-After, and 202 Accepted async polling/SSE helpers.

Python SDK (vidhi)

Requires Python >=3.11, built on httpx and pydantic>=2.0 with both synchronous (Vidhi) and asynchronous (AsyncVidhi) clients.

import os
from vidhi import Vidhi

client = Vidhi(
    api_key=os.environ["VIDHI_API_KEY"],
    base_url="https://api.vidhi.shamik.app",
)

# Automatic keyset pagination iterator
for case in client.cases.list_iter(forum_type="tribunal", limit=20):
    print(case.id, case.court_code, case.title)
    break

# Async Tier B job with built-in SSE/poll .wait()
job = client.audit.order(
    order_text=open("impugned_order.txt").read(),
    posture="first_appeal",
)
completed = job.wait()
print(completed.result)
  • Typed Exceptions: AuthenticationError (401), InsufficientCreditsError (402), PermissionDeniedError (403), NotFoundError (404), IdempotencyConflictError (409), PrivilegeEnclaveBlockedError (422), RateLimitError (429), UpstreamUnavailableError (503).
  • Async Client: async with AsyncVidhi(...) as client: exposes identical resource namespaces (await client.cases.search(...), await job.wait()).

TypeScript SDK (@vidhi/sdk)

Zero-runtime-dependency fetch client shipping dual ESM + CJS bundles and OpenAPI-generated types (openapi-typescript). Works in Node 20+, Bun, Deno, and edge runtimes with full AbortSignal support.

import { VidhiClient } from "@vidhi/sdk";

const vidhi = new VidhiClient({
  apiKey: process.env.VIDHI_API_KEY!,
});

for await (const item of vidhi.cases.listIter({ forum_type: "tribunal", limit: 20 })) {
  console.log(item.id, item.title);
  break;
}

const job = await vidhi.audit.order({
  order_text: impugnedOrderText,
  posture: "first_appeal",
});
const finished = await job.wait();
console.log(finished.result);

Go Cobra CLI (vidhi)

Single static binary built with Cobra and lipgloss TTY tables (automatically falling back to plain JSON with --json for shell pipelines).

# Configure credentials in ~/.vidhi/config.yaml (or VIDHI_API_KEY env)
vidhi auth login --key "$VIDHI_API_KEY"
vidhi usage

# Tier A discovery, search, case inspection, citations & statutes
vidhi coverage
vidhi courts
vidhi search "insolvency moratorium section 14" --forum-type tribunal --json
vidhi case get 122965
vidhi case body 122965 --format sections
vidhi case citator 122965
vidhi resolve "(1973) 4 SCC 225" --mode disambiguate
vidhi statute section IPC 420 --include transition,citing_cases

# Tier B SOTA engines (--wait streams SSE/polls 202 async jobs)
vidhi verify --file brief.txt --json
vidhi audit --file order.txt --posture first_appeal --wait
vidhi counter --citation "(1973) 4 SCC 225"
vidhi notice --file notice.txt --receipt-date 2026-11-20
vidhi contract --file msa.txt --governing-state Maharashtra --party-role Vendor
vidhi redact --file draft.txt --mode redact
vidhi translate --text "The appeal is dismissed." --to hi-IN
vidhi jobs watch <job_id>

On this page