This example project showcases how to use @mozaik-ai/core to send unified requests when interacting with both OpenAI and Anthropic models.
- Node.js 18+
npm installCreate a .env in the project root and add any provider API keys you plan to use (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY). The examples load env vars via dotenv.
- Quick start (runs the Anthropic simple prompt example):
npm run dev- Build and run the compiled
index.ts:
npm run build
node dist/index.js- Run any example directly (without building) using
tsx:
npx tsx anthropic/simple-prompt.ts
npx tsx anthropic/vision.ts
npx tsx anthropic/multi-turn-conversation.ts
npx tsx anthropic/complex-reasoning.ts
npx tsx openai/simple-task.ts
npx tsx structured-output/anthropic-example.ts
npx tsx structured-output/openai-example.ts
npx tsx tools/write-file.ts
npx tsx parallel/parallel-agents.ts
npx tsx fallback/fallback-strategies.tsanthropic/— Anthropic-specific examplesopenai/— OpenAI-specific examplesparallel/— Parallel execution examples using Promise.all()structured-output/— Structured output examplestools/— Tool-calling examplesfallback/— Fallback strategy examples using multiple providers