Custom Node.js Agents + Govyn — Govern Any Node.js Agent
Node.js agents built with the OpenAI SDK, Vercel AI SDK, or plain fetch calls have no built-in cost controls. In production, a misbehaving agent can make thousands of API calls before you detect the issue — and there's no way to enforce budgets or audit trails at the runtime level.
How it works
Step-by-step setup
Start the Govyn proxy
npx govyn start --config govyn.yaml Point the OpenAI SDK at Govyn
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'http://localhost:4111/v1',
apiKey: 'gvn_agent_node_01',
});
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }],
}); Or use fetch directly
const response = await fetch('http://localhost:4111/v1/chat/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer gvn_agent_node_01',
},
body: JSON.stringify({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }],
}),
}); Example policy
Define governance rules for your Node.js agents in a simple YAML file.
agents:
node_01:
budget:
daily: $5.00
monthly: $100.00
models:
allow: [gpt-4o, gpt-4o-mini]
rate_limit:
requests_per_minute: 40
logging:
replay: true
log_headers: false Why use Govyn with Node.js?
Get started in 5 minutes
Add governance to your Node.js agents with a single config change. No code rewrites.
Read the docsFrequently asked questions
Does Govyn support streaming responses in Node.js?
Can I use Govyn with the Vercel AI SDK?
Does Govyn work with serverless Node.js functions?
Related integrations
Add governance to any Python AI agent. Works with requests, httpx, and the OpenAI SDK. Budget limits, policy enforcement, full replay.
Add budget limits, policy enforcement, and full replay to LangChain agents using OpenAI. Five-minute setup, zero code changes.
Add governance to OpenAI Agents SDK. Enforce budgets, model policies, and audit trails for every agent run. Five-minute setup.
Explore more
SDK wrappers are door locks. Proxies are walls. A deep technical comparison of both governance architectures for AI agents in production.
POLICY TEMPLATESet daily and monthly spending limits for AI agents. Prevent runaway costs with hard budget caps enforced at the proxy level.
POLICY TEMPLATEDetect and redact personally identifiable information in AI agent requests and responses. GDPR-friendly PII protection at the proxy level.
COMPARISONCompare Govyn and LiteLLM for AI agent governance. See how a governance-first proxy differs from a multi-provider routing gateway.