Maxim AI streamlines AI application development and deployment by applying traditional software best practices to non-deterministic AI workflows. Our evaluation and observability tools help teams maintain quality, reliability, and speed throughout the AI application lifecycle. Maxim integrates with the AI SDK to provide:
Automatic Observability – Adds tracing, logging, and metadata to AI SDK calls with a simple wrapper.
Unified Model Wrapping – Supports OpenAI, Anthropic, and Google etc. models uniformly.
Custom Metadata & Tagging – Enables attaching trace names, tags, and session IDs to track usage.
Streaming & Structured Output Support – Handles streaming responses and structured outputs seamlessly.
import { Maxim } from '@maximai/maxim-js';async function initializeMaxim() { const apiKey = process.env.MAXIM_API_KEY || ''; if (!apiKey) { throw new Error( 'MAXIM_API_KEY is not defined in the environment variables', ); } const maxim = new Maxim({ apiKey }); const logger = await maxim.logger({ id: process.env.MAXIM_LOG_REPO_ID || '', }); if (!logger) { throw new Error('Logger is not available'); } return { maxim, logger };}
import { openai } from '@ai-sdk/openai';import { wrapMaximAISDKModel } from '@maximai/maxim-js/vercel-ai-sdk';const model = wrapMaximAISDKModel(openai('gpt-4'), logger);
import { generateText } from 'ai';import { openai } from '@ai-sdk/openai';import { wrapMaximAISDKModel } from '@maximai/maxim-js/vercel-ai-sdk';const model = wrapMaximAISDKModel(openai('gpt-4'), logger);// Generate text with automatic loggingconst response = await generateText({ model: model, prompt: 'Write a haiku about recursion in programming.', temperature: 0.8, system: 'You are a helpful assistant.',});console.log('Response:', response.text);
import { streamText } from 'ai';const { textStream } = await streamText({ model: model, prompt: 'Write a short story about space exploration', system: 'You are a creative writer',});for await (const textPart of textStream) { process.stdout.write(textPart);}