Switch your SDK. Keep your code.
Start with the API you already run. Keep streaming, tool calls, and JSON modes; change the endpoint and key.
client.py2 lines changed
−
base_url="https://api.openai.com/v1"+base_url="https://www.ninjachat.ai/api/v1"−api_key=os.environ["OPENAI_API_KEY"]+api_key=os.environ["NINJACHAT_API_KEY"]streamingunchangedtool callsunchangedresponse shapeunchanged
01The client stays.OpenAI-compatible.
02The catalog opens.Chat, image, video, search.
03Every request leaves a receipt.Route, cost, attempts, outcome.
Start with the API you use now.
Framework code stays boring.
Vercel AI SDK, LangChain, LlamaIndex, and LiteLLM keep working with the new endpoint and an nj_sk_ key.
Vercel AI SDK
typescript
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";
const ninjachat = createOpenAI({
baseURL: "https://www.ninjachat.ai/api/v1",
apiKey: process.env.NINJACHAT_API_KEY,
});
const { text } = await generateText({
model: ninjachat.chat("claude-opus-4.6"), // .chat() → chat/completions
prompt: "Summarize the CAP theorem in two sentences.",
});