Authentication

Updated

The Chaos AI SDK supports two environments: Production and Staging. By default, you should use production credentials for stable, reliable access.

Environments

EnvironmentURLUse Case
Productionhttps://ai.chaoslabs.coDefault, stable API
Staginghttps://ai-staging.chaoslabs.coExperimental features

Production (Default)

Production is the default environment. It provides stable, reliable access to the Chaos AI API.

.env
# Production credentials (default)
CHAOS_API_KEY=ck-your-production-api-key
production-setup.ts
import { Chaos } from '@chaoslabs/ai-sdk';
 
const chaos = new Chaos({
  apiKey: process.env.CHAOS_API_KEY!,
  // No baseUrl needed - defaults to production
});

Staging (Experimental)

Staging is our experimentation environment. It has the latest features and improvements, but may also be more prone to errors or breaking changes.

Only use staging if Chaos Labs specifically directs you to test new features. For normal usage, stick with production.
.env
# Staging credentials (experimental)
CHAOS_API_KEY=ck-your-staging-api-key
CHAOS_BASE_URL=https://ai-staging.chaoslabs.co
staging-setup.ts
import { Chaos } from '@chaoslabs/ai-sdk';
 
const chaos = new Chaos({
  apiKey: process.env.CHAOS_API_KEY!,
  baseUrl: process.env.CHAOS_BASE_URL || 'https://ai-staging.chaoslabs.co',
});

When to Use Each Environment

ScenarioEnvironment
Building production applicationsProduction
Normal development and testingProduction
Testing new features at Chaos Labs' directionStaging
Evaluating upcoming API changesStaging
[@portabletext/react] Unknown block type "callout", specify a component for it in the `components.types` prop

Getting Credentials

Contact support@chaoslabs.co to request API credentials. Specify whether you need access to production, staging, or both environments.

Was this helpful?