i18n-email

Installation

Add i18n-email to your project.

Install the package

npm install i18n-email

react >= 18 is required as a peer dependency. If it is not already in your project:

npm install react

Choose a translation backend

Option A: OpenAI directly (default)

i18n-email uses the OpenAI API for translation by default. You need an API key from platform.openai.com.

Add it to your environment:

OPENAI_API_KEY=sk-...

Option B: Vercel AI SDK

You can use any AI SDK provider instead — OpenAI, Anthropic, Google, Mistral, and more. Install the ai package and your preferred provider:

npm install ai @ai-sdk/openai

No API key is needed in createI18nEmail when using an AI SDK model — the provider handles authentication via its own environment variables.

Option C: TanStack AI

You can use any TanStack AI adapter instead. Install your provider's adapter package:

npm install @tanstack/ai

Other providers: @tanstack/ai-anthropic, etc. No API key is needed in createI18nEmail — authentication is handled by the adapter itself.

TypeScript

The package ships with full TypeScript types. No additional @types/* packages are needed.

If you are using JSX (React Email components), make sure @types/react is installed and your tsconfig.json has:

{
  "compilerOptions": {
    "jsx": "react-jsx"
  }
}

On this page