Quickstart
Get up and running with Caesura in minutes. This guide will help you install the SDK and make your first injected language model call.
1. Choose your SDK
Caesura operates as a middleware that wraps your existing LLM client. Choose the SDK that matches your current stack:
- Vercel AI SDK:
@caesura-io/ai-sdk - Official OpenAI SDK:
@caesura-io/openai
2. Install the SDK
In this example, we'll use the Vercel AI SDK integration. Install the Caesura package alongside ai (and your preferred provider, such as @ai-sdk/anthropic):
npm install @caesura-io/ai-sdk ai @ai-sdk/anthropic
3. Set your Environment Variables
Caesura uses API keys for authentication. See Environments & Access to understand which base URL to use.
export CAESURA_API_KEY="caesura_..."
4. Make your first call
Wrap your existing model instance with caesuraMiddleware. Caesura will observe the conversation, analyze it, and inject recommendations before the next call to the provider.
import { wrapLanguageModel, generateText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { caesuraMiddleware } from '@caesura-io/ai-sdk';
// 1. Wrap your model with the Caesura middleware
const model = wrapLanguageModel({
model: anthropic('claude-sonnet-4-6'),
middleware: caesuraMiddleware({
baseUrl: 'https://dev.caesura.io',
// apiKey is auto-read from the CAESURA_API_KEY environment variable
}),
});
// 2. Provide the conversation history
const conversation = [
{ role: 'user', content: 'I need help preparing for the next meeting.' }
];
const sessionId = "unique-conversation-123";
// 3. Generate text. Caesura analyzes the conversation asynchronously
// and will inject insights into future turns.
const result = await generateText({
model,
messages: conversation,
// Pass a conversationId so Caesura can track the context
providerOptions: { caesura: { conversationId: sessionId } },
});
console.log(result.text);
Next Steps
- Learn more about Authentication.
- Explore the SDK details for advanced usage and credit metering.
- Check out the Examples to see fully functional applications.