Skip to content

Repository files navigation

NinjaChat SDK

Official TypeScript and Python clients for the NinjaChat API: one API for chat, responses, images, video, routing, usage, request traces, and webhooks.

Important

NinjaChat API keys are server-side secrets. Never embed an nj_sk_ key in browser, mobile, desktop, or other distributed client code; route those requests through a backend you control and load keys from a secret manager or environment variable.

TypeScript

npm install @ninjachat/sdk
import { NinjaChat } from "@ninjachat/sdk";

const ninja = new NinjaChat({ apiKey: process.env.NINJACHAT_API_KEY! });
const response = await ninja.responses.create({
  model: "ninja/auto",
  input: "Explain this API in one sentence.",
});

console.log(response.output_text);

Python

pip install ninjachat
import os
from ninjachat import NinjaChat

ninja = NinjaChat(api_key=os.environ["NINJACHAT_API_KEY"])
response = ninja.responses.create(
    model="ninja/auto",
    input="Explain this API in one sentence.",
)

print(response["output_text"])

The clients default to https://www.ninjachat.ai/api/v1 and include typed errors, streaming helpers, retries that honor Retry-After, and idempotency keys for billing-safe retries.

Already using the OpenAI SDK? Keep it and change only base_url and the API key. The native NinjaChat SDK adds first-class routing, media, account usage, request traces, and webhook helpers.

Repository layout

Create an API key in the developer console, browse the documentation, or read the language-specific package guides.

Releases

TypeScript and Python packages share one version. An annotated vX.Y.Z tag runs the complete package test matrix and publishes through npm and PyPI Trusted Publishing; the repository stores no registry write tokens.

Maintainers should follow the complete release guide.

Security

Please report vulnerabilities privately through GitHub Security Advisories. Do not open public issues for security reports.

License

MIT © Helium Technologies, Inc.

About

Official TypeScript and Python SDKs for the NinjaChat API

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages