Quickstart
Connect your first AI agent to Xilos in under 5 minutes using the OpenAI-compatible API.
Prerequisites
- A Xilos account (sign up at xilos.ai (opens in a new tab))
- An API key from your Xilos dashboard
- Any OpenAI-compatible client (Python SDK, JavaScript SDK, cURL, LangChain, etc.)
Step 1: Get Your API Key
- Log in to your Xilos dashboard.
- Navigate to Settings.
- Copy your organization's API key.
Info: For production use, create a Virtual Key with budget limits and rate limits instead of using your master key.
Step 2: Make Your First Request
cURL
curl https://api.xilos.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_XILOS_API_KEY" \
-d '{
"model": "xilos",
"messages": [
{"role": "user", "content": "Hello, Xilos!"}
]
}'Python
from openai import OpenAI
client = OpenAI(
api_key="YOUR_XILOS_API_KEY",
base_url="https://api.xilos.ai/api/v1"
)
response = client.chat.completions.create(
model="xilos",
messages=[
{"role": "user", "content": "Hello, Xilos!"}
]
)
print(response.choices[0].message.content)JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_XILOS_API_KEY",
baseURL: "https://api.xilos.ai/api/v1",
});
const response = await client.chat.completions.create({
model: "xilos",
messages: [{ role: "user", content: "Hello, Xilos!" }],
});
console.log(response.choices[0].message.content);Step 3: Verify in the Dashboard
After sending your first query:
- Open your Xilos dashboard.
- Navigate to Query Log.
- You should see your query with:
- The routing decision (which model was selected)
- Governance actions (any restrictions or guardrails applied)
- Cost breakdown (input/output tokens, total cost)
- Compression stats (if compression is enabled)
Step 4: Add Routing Rules
By default, all queries route through your organization's default model. To route specific queries to different models:
- Navigate to Routing Rules in the sidebar.
- Click Create New Rule.
- Choose between Natural Language (AI-based) or Keyword matching.
- Write a trigger phrase describing the query intent.
- Select the target model.
- Test the rule with sample queries.
- Save and activate.
Learn more in the Create a Routing Rule guide.
Step 5: Enable Guardrails
Protect your organization by enabling security features:
- Navigate to Restriction Rules.
- Create rules to block, mask, or flag sensitive queries.
- Configure PII detection and prompt injection defense.
Start with the three foundational security rules outlined in Create a Restriction Rule.
What's Next?
- Connect a specific agent framework (Hermes, Claude Code, LangChain, etc.)
- Enable context compression to reduce token costs
- Set up webhooks for event-driven notifications
- Create a multi-model workflow
- Explore the full API reference