TypeScript
GateCtr + OpenAI Node.js SDK
Drop-in replacement for the official OpenAI Node.js client
1
Install
No additional packages required. Use your existing OpenAI Node.js SDK installation.
2
Configure
Before
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello" }],
});After GateCtr
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: "https://api.gatectr.com/v1",
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello" }],
});3
Test
Make a test call and check the GateCtr dashboard for token savings and cost data.
What GateCtr does under the hood for OpenAI Node.js SDK
When you route OpenAI Node.js SDK calls through GateCtr, every request is automatically compressed (up to 40% fewer tokens), scored for complexity (to select the optimal model), and checked against your budget cap before reaching the LLM provider. You get full observability β tokens, cost, latency β in the GateCtr dashboard.
Compatible models
Start saving with OpenAI Node.js SDK β free
No credit card required. Up and running in 5 minutes.
Start free