Choose Your Installation Method
RegPilot can be integrated into your application in multiple ways depending on your use case and technical stack.
REST API Direct HTTP requests - works with any language
SDK Integration Official SDKs for Node.js, Python, and more
Framework Integration Pre-built integrations for Next.js, React, etc.
Self-Hosted Deploy RegPilot on your own infrastructure
REST API
The simplest way to get started is using the REST API directly. No installation required!
Prerequisites
RegPilot account (sign up here )
API key from your project dashboard
Make Your First Request
curl -X POST https://regpilot.dev/api/ai/chat \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
SDK Integration
For a more integrated experience, use our official SDKs with built-in TypeScript support.
Node.js / TypeScript
Install the package
npm install @regpilot/sdk
# or
yarn add @regpilot/sdk
# or
pnpm add @regpilot/sdk
Initialize the client
import { RegPilot } from '@regpilot/sdk' ;
const regpilot = new RegPilot ({
apiKey: process . env . REGPILOT_API_KEY ,
environment: 'production' , // or 'development'
});
Make a request
const response = await regpilot . chat . create ({
messages: [
{ role: 'user' , content: 'Hello from SDK!' }
],
governorEnabled: true , // Enable compliance validation
});
console . log ( response . content );
console . log ( 'Risk Score:' , response . riskScore );
Python
Initialize the client
from regpilot import RegPilot
client = RegPilot(
api_key = os.environ[ "REGPILOT_API_KEY" ],
environment = "production"
)
Make a request
response = client.chat.create(
messages = [
{ "role" : "user" , "content" : "Hello from Python SDK!" }
],
governor_enabled = True
)
print (response.content)
print ( f "Risk Score: { response.risk_score } " )
Framework Integration
Next.js Integration
Install dependencies
npm install @regpilot/nextjs
Create API route
Create app/api/chat/route.ts: import { RegPilotHandler } from '@regpilot/nextjs' ;
export const POST = RegPilotHandler ({
apiKey: process . env . REGPILOT_API_KEY ! ,
governorEnabled: true ,
});
Use in your components
'use client' ;
import { useRegPilot } from '@regpilot/nextjs/client' ;
export default function Chat () {
const { messages , sendMessage , isLoading } = useRegPilot ();
return (
< div >
{ messages . map (( msg , i ) => (
< div key = { i } > {msg. content } </ div >
))}
< button onClick = {() => sendMessage ( 'Hello!' )} >
Send
</ button >
</ div >
);
}
React Integration
Install dependencies
npm install @regpilot/react
Wrap your app with provider
import { RegPilotProvider } from '@regpilot/react' ;
function App () {
return (
< RegPilotProvider apiKey = { process . env . REACT_APP_REGPILOT_API_KEY } >
< YourComponents />
</ RegPilotProvider >
);
}
Use the hook in components
import { useRegPilot } from '@regpilot/react' ;
function ChatComponent () {
const { chat , isLoading , error } = useRegPilot ();
const handleSubmit = async ( message : string ) => {
const response = await chat . send ( message );
console . log ( response );
};
return (
// Your UI
);
}
Environment Variables
Set up your environment variables for secure API key management:
.env.local (Next.js)
.env (Node.js)
.env (Python)
# Public (client-side safe)
NEXT_PUBLIC_REGPILOT_PROJECT_ID = your_project_id
# Private (server-side only)
REGPILOT_API_KEY = sk_your_api_key_here
REGPILOT_ENVIRONMENT = production
REGPILOT_API_KEY = sk_your_api_key_here
REGPILOT_PROJECT_ID = your_project_id
REGPILOT_ENVIRONMENT = production
REGPILOT_API_KEY = sk_your_api_key_here
REGPILOT_PROJECT_ID = your_project_id
REGPILOT_ENVIRONMENT = production
Security Best Practice : Never commit your API keys to version control. Always use environment variables and add .env files to your .gitignore.
Configuration Options
Configure RegPilot to match your requirements:
const regpilot = new RegPilot ({
// Required
apiKey: process . env . REGPILOT_API_KEY ,
// Optional
environment: 'production' , // 'production' | 'development'
timeout: 30000 , // Request timeout in milliseconds
retries: 3 , // Number of retry attempts
baseURL: 'https://regpilot.dev/api' , // Custom base URL
// Governor settings
governor: {
enabled: true ,
strictMode: false ,
autoApproveThreshold: 50 ,
},
// Logging
logging: {
level: 'info' , // 'debug' | 'info' | 'warn' | 'error'
pretty: true , // Pretty print logs in development
},
});
Verify Installation
Test your installation with a simple health check:
import { RegPilot } from '@regpilot/sdk' ;
const client = new RegPilot ({
apiKey: process . env . REGPILOT_API_KEY ! ,
});
// Test connection
const health = await client . health . check ();
console . log ( '✅ RegPilot is connected:' , health . status );
Next Steps
Authentication Learn about API authentication and security
Make Your First Request Follow our quickstart guide
API Reference Explore the complete API documentation
Integration Guides Framework-specific integration guides
Troubleshooting
Installation fails with npm
If you encounter issues installing the SDK:
Clear npm cache: npm cache clean --force
Delete node_modules and package-lock.json
Run npm install again
Try with a different package manager (yarn or pnpm)
Ensure you’re importing from the correct package: // ✅ Correct
import { RegPilot } from '@regpilot/sdk' ;
// ❌ Incorrect
import { RegPilot } from 'regpilot-sdk' ;
Make sure you have the latest type definitions: npm install --save-dev @types/node
And ensure your tsconfig.json includes: {
"compilerOptions" : {
"esModuleInterop" : true ,
"moduleResolution" : "node"
}
}