The official Node.js / TypeScript client for SoxAI — a unified AI API gateway giving you access to 200+ AI models from 40+ providers through a single OpenAI-compatible API.
npm install soxai
# or
yarn add soxai
# or
pnpm add soxai
# or
bun add soxaiimport { SoxAI } from "soxai";
const client = new SoxAI({ apiKey: "sox-your-key" });
const response = await client.chat.completions.create({
model: "claude-sonnet-4-6", // or gpt-4o, gemini-2.5-flash, deepseek-chat, ...
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);- One API key for OpenAI, Anthropic, Google, DeepSeek, Meta, and 35+ more providers
- Automatic failover — if one provider goes down, requests route to another
- Team management — per-developer API keys with spending limits
- Compatible with Claude Code, Codex CLI — just set
ANTHROPIC_BASE_URL - Free $5 credit to start, no credit card required
import { SoxAI } from "soxai";
const client = new SoxAI();
const stream = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Write a haiku about APIs." }],
stream: true,
});
for await (const chunk of stream) {
const content = chunk.choices[0]?.delta?.content;
if (content) process.stdout.write(content);
}import { SoxAI } from "soxai";
const client = new SoxAI();
async function agentStep(prompt: string, model: string) {
const r = await client.chat.completions.create({
model,
messages: [{ role: "user", content: prompt }],
});
return r.choices[0].message.content ?? "";
}
// Cheap model for classification
const intent = await agentStep("Classify: ...", "gpt-4o-mini");
// Capable model for reasoning
const analysis = await agentStep("Analyze: ...", "claude-sonnet-4-6");
// Budget model for summarization
const summary = await agentStep(`Summarize: ${analysis}`, "deepseek-chat");export SOXAI_API_KEY="sox-your-key"import { SoxAI } from "soxai";
const client = new SoxAI(); // reads from SOXAI_API_KEYAlready using the OpenAI SDK? Just change baseURL:
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sox-your-key",
baseURL: "https://api.soxai.io/v1",
});
// Everything else stays the sameMIT