Niah Docs
Reference

Client libraries

You can integrate today in any language. Here's the recommended approach per surface, plus what's on our roadmap.

Two surfaces, two approaches

SurfaceRecommended client
Chat completions (/v1/chat/completions, /v1/models) Any OpenAI SDK — it's wire-compatible. Just set the base URL.
REST resources (consultations, batches, webhooks, automations, usage) Plain HTTP, or a client generated from our OpenAPI spec.

Chat: reuse the OpenAI SDKs

Because the chat surface is OpenAI-compatible, point an existing SDK at Niah:

python
from openai import OpenAI
client = OpenAI(base_url="https://api.niah.si/v1", api_key="nwk_live_...")
client.chat.completions.create(model="niah-1", messages=[{"role":"user","content":"Hi"}])
javascript
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.niah.si/v1", apiKey: process.env.NIAH_API_KEY });
await client.chat.completions.create({ model: "niah-1", messages: [{ role: "user", content: "Hi" }] });

REST: the API is thin on purpose

The REST resources are ordinary JSON over HTTPS with bearer auth — no SDK is required. Here's the same "create a consultation" call in several languages.

cURL

bash
curl -X POST https://api.niah.si/v1/consultations \
  -H "Authorization: Bearer $NIAH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"Q3 planning","target_agent_count":5}'

Python

python
import os, httpx

r = httpx.post(
    "https://api.niah.si/v1/consultations",
    headers={"Authorization": f"Bearer {os.environ['NIAH_API_KEY']}"},
    json={"title": "Q3 planning", "target_agent_count": 5},
)
r.raise_for_status()
print(r.json()["data"]["id"])

Ruby

ruby
require "net/http"; require "json"

uri = URI("https://api.niah.si/v1/consultations")
req = Net::HTTP::Post.new(uri, {
  "Authorization" => "Bearer #{ENV['NIAH_API_KEY']}",
  "Content-Type"  => "application/json"
})
req.body = { title: "Q3 planning", target_agent_count: 5 }.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
puts JSON.parse(res.body)["data"]["id"]

Elixir

elixir
Req.post!("https://api.niah.si/v1/consultations",
  auth: {:bearer, System.fetch_env!("NIAH_API_KEY")},
  json: %{title: "Q3 planning", target_agent_count: 5}
).body["data"]["id"]

Prefer a typed client? Generate one

Our OpenAPI spec is public and complete, so you can generate a fully typed client for your language in seconds and regenerate whenever the API changes.

bash
# Example: openapi-generator (supports python, ruby, go, java, typescript, …)
openapi-generator-cli generate \
  -i https://api.niah.si/v1/openapi.json \
  -g python \
  -o ./niah-client

Tools like OpenAPI Generator, Speakeasy, and Stainless all consume this spec.

Do we need official SDKs?

Yes — thin official clients now live in the API repo:

  • Pythonniah-api (sdks/python)
  • TypeScript@niah/api (sdks/typescript)
python
from niah_api import Niah
with Niah(api_key="nwk_...") as client:
    print(client.me())
typescript
import { Niah } from "@niah/api";
const niah = new Niah({ apiKey: process.env.NIAH_API_KEY! });
await niah.me();

Chat completions stay on the OpenAI SDKs (set base_url). PyPI / npm publishing follows once the packages stabilize. Want another language sooner? Tell us at niah.si/support.