Skip to main content

Before you begin

  1. Sign up for a free account at uselayer.ai/signup
  2. Get your API key from the Dashboard
  3. Create your first gate with your desired model configuration

Install the SDK

npm install @layer-ai/sdk

Make your first request

import { Layer } from '@layer-ai/sdk';

const layer = new Layer({
  apiKey: process.env.LAYER_API_KEY
});

const response = await layer.chat({
  gateId: 'your-gate-id',
  data: {
    messages: [
      { role: 'user', content: 'Explain quantum computing in simple terms' }
    ]
  }
});

console.log(response.content);

What’s Next?

Integration Guides

Learn about all SDK methods for chat, images, audio, and video

Gates & Routing

Understand how gates provide smart routing and fallbacks

Dashboard Guide

Deep dive into creating and configuring gates

Cost Tracking

Monitor and optimize your AI spending