🎯
Multi-Provider
Single interface for OpenAI, OpenRouter, Replicate, AWS Bedrock, and custom OpenAI-compatible providers.
Intelligent model selection, type-safe context management, and comprehensive provider support.
import { AI } from '@aeye/ai';
import { OpenAIProvider } from '@aeye/openai';
import z from 'zod';
const openai = new OpenAIProvider({ apiKey: process.env.OPENAI_API_KEY! });
const ai = AI.with().providers({ openai }).create();
// Define a tool
const getWeather = ai.tool({
name: 'getWeather',
description: 'Get weather for a city',
schema: z.object({ city: z.string() }),
call: async ({ city }) => ({ temp: 72, condition: 'sunny' }),
});
// Create a prompt that uses the tool
const advisor = ai.prompt({
name: 'advisor',
description: 'Travel advisor',
content: 'Check the weather in {{city}} and suggest what to wear.',
input: (input: { city: string }) => input,
tools: [getWeather],
schema: z.object({ suggestion: z.string() }),
});
const result = await advisor.get('result', { city: 'Paris' });
console.log(result?.suggestion);| Package | Description |
|---|---|
@aeye/core | Core primitives: Tool, Prompt, Agent, and shared types |
@aeye/ai | Main AI library with model selection, APIs, and hooks |
@aeye/openai | OpenAI provider (chat, images, speech, transcription, embeddings) |
@aeye/openrouter | OpenRouter multi-provider gateway |
@aeye/replicate | Replicate open-source model provider |
@aeye/aws | AWS Bedrock provider (Converse API) |
@aeye/models | Auto-generated model registry with pricing and capabilities |