REST

GateCtr + Axios / fetch (REST)

Direct REST API calls with GateCtr as a drop-in base URL replacement

1

Install

No additional packages required. Use your existing Axios / fetch (REST) installation.

2

Configure

Before
const response = await fetch("https://api.openai.com/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.OPENAI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ model: "gpt-4o", messages }),
});
After GateCtr
const response = await fetch("https://api.gatectr.com/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.OPENAI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ model: "gpt-4o", messages }),
});
3

Test

Make a test call and check the GateCtr dashboard for token savings and cost data.

What GateCtr does under the hood for Axios / fetch (REST)

When you route Axios / fetch (REST) 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.

Start saving with Axios / fetch (REST) β€” free

No credit card required. Up and running in 5 minutes.

Start free