Integrate XVariant in minutes. Choose what you want to test and start running experiments with just a few lines of code.
Test different models, prompts, and parameters without changing code.
Gradually roll out features and control access by user segment.
Test pricing, copy, and design changes with statistical confidence.
import openai
from uuid import uuid4
# 1. Point your OpenAI client to XVariant Gateway
client = openai.OpenAI(
api_key="xv_your_api_key_here",
base_url="https://gateway.xvariant.io/v1"
)
# 2. Add tracking headers to your requests
session_id = str(uuid4())
user_id = "user_12345"
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
extra_headers={
"X-XVariant-Session-ID": session_id,
"X-XVariant-Unit-ID": user_id
}
)
# 3. That's it! Experiments are managed from the dashboard
print(response.choices[0].message.content)
import OpenAI from 'openai';
import { v4 as uuidv4 } from 'uuid';
// 1. Point your OpenAI client to XVariant Gateway
const client = new OpenAI({
apiKey: 'xv_your_api_key_here',
baseURL: 'https://gateway.xvariant.io/v1'
});
// 2. Add tracking headers to your requests
const sessionId = uuidv4();
const userId = "user_12345";
const response = await client.chat.completions.create({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: 'Hello!' }]
}, {
headers: {
'X-XVariant-Session-ID': sessionId,
'X-XVariant-Unit-ID': userId
}
});
// 3. That's it! Experiments are managed from the dashboard
console.log(response.choices[0].message.content);