Getting Started
Quickstart

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

  1. Log in to your Xilos dashboard.
  2. Navigate to Settings.
  3. 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:

  1. Open your Xilos dashboard.
  2. Navigate to Query Log.
  3. 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:

  1. Navigate to Routing Rules in the sidebar.
  2. Click Create New Rule.
  3. Choose between Natural Language (AI-based) or Keyword matching.
  4. Write a trigger phrase describing the query intent.
  5. Select the target model.
  6. Test the rule with sample queries.
  7. Save and activate.

Learn more in the Create a Routing Rule guide.

Step 5: Enable Guardrails

Protect your organization by enabling security features:

  1. Navigate to Restriction Rules.
  2. Create rules to block, mask, or flag sensitive queries.
  3. Configure PII detection and prompt injection defense.

Start with the three foundational security rules outlined in Create a Restriction Rule.

What's Next?