Getting Started
Quick Start Guide
Get up and running with Bastio in 5 minutes.
Quick Start Guide
Get Bastio's AI security up and running in just 5 minutes. This guide will walk you through the essential steps to secure your first AI application.
Prerequisites
- An AI application using OpenAI, Anthropic, or other supported providers
- API access to your chosen AI provider
- Node.js, Python, or any HTTP client for integration
Step 1: Create Your Bastio Account
- Sign up at bastio.com
- Create an organization for your team
- Verify your email and complete onboarding
Step 2: Generate API Keys
- Navigate to Dashboard > API Keys
- Click Generate New Key
- Copy and securely store your API key
- Configure key permissions and rate limits
# Your new API key will look like this:
bastio_sk_1234567890abcdef...Step 3: Update Your Application
Replace your direct AI provider calls with Bastio endpoints:
Python Example
# Before (direct to OpenAI)
import openai
client = openai.OpenAI(api_key="sk-...")
# After (through Bastio)
import openai
client = openai.OpenAI(
    api_key="bastio_sk_your_key_here",
    base_url="https://api.bastio.com/v1"
)
# Non-streaming - usage remains exactly the same!
response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
# Streaming - just add stream=True
stream = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Tell me a story"}],
    stream=True
)
for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)JavaScript Example
// Before
import OpenAI from 'openai';
const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY
});
// After
import OpenAI from 'openai';
const client = new OpenAI({
  apiKey: process.env.BASTIO_API_KEY,
  baseURL: 'https://api.bastio.com/v1'
});
// Non-streaming
const response = await client.chat.completions.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Hello!' }]
});
console.log(response.choices[0].message.content);
// Streaming
const stream = await client.chat.completions.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Tell me a story' }],
  stream: true
});
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content || '');
}cURL Example
curl -X POST https://api.bastio.com/v1/chat/completions \
  -H "Authorization: Bearer bastio_sk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'Step 4: Configure Security Policies
- Go to Dashboard > Security
- Set your threat detection level:
- Low: Minimal blocking, focus on monitoring
- Medium: Balanced security (recommended)
- High: Maximum protection, may block more requests
 
- Enable specific protections:
- ✅ PII Detection - Automatically detect personal information
- ✅ Jailbreak Prevention - Block prompt injection attempts
- ✅ Bot Detection - Identify and block automated traffic
- ✅ Threat Lists - Block known malicious IPs
 
Step 5: Test Your Integration
Send a test request to verify everything works:
curl -X POST https://api.bastio.com/v1/chat/completions \
  -H "Authorization: Bearer bastio_sk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4",
    "messages": [{"role": "user", "content": "Test message"}]
  }'You should receive a normal AI response, plus additional security headers:
X-Bastio-Threat-Score: 0.1
X-Bastio-Processing-Time: 45
X-Bastio-Request-Id: req_abc123Step 6: Monitor Your Traffic
- 
Visit Dashboard > Analytics to see: - Request volume and response times
- Threat detection events
- Geographic distribution of requests
- Most active users and applications
 
- 
Check Dashboard > Security > Events for: - Blocked threats
- PII detection alerts
- Suspicious activity patterns
 
Next Steps
🎉 Congratulations! Your AI application is now secured with Bastio.
Recommended next actions:
- 📚 Read the complete Integration Guide for advanced configuration
- 🔒 Review Security Features to understand available protections
- 🛠️ Explore the API Reference for detailed endpoint documentation
- ⚙️ Set up Webhooks for real-time security alerts
- 👥 Invite team members and configure role-based access
Getting Help
- 💬 Support: Contact us through the dashboard
- 📖 Documentation: Browse our complete guides
- 🐛 Issues: Report bugs or request features
- 💡 Best Practices: Check our security recommendations
Ready to dive deeper? Start with our comprehensive Integration Guide.