My App

LangRelay API

Translation infrastructure for platforms. Translate text, HTML, or structured JSON with managed translation memory, glossaries, and usage tracking.

What is LangRelay?

LangRelay is translation infrastructure that platforms embed into their products. Instead of building a translation pipeline from scratch, you send content to LangRelay and get back high-quality, consistent translations.

What you get:

  • Context-aware LLM translations (not rule-based MT)
  • Translation memory — repeated content is free (no LLM call)
  • Glossary enforcement — consistent terminology across all translations
  • Manual overrides — human corrections take priority
  • Per-project usage tracking — bill your own customers

Quick Start

Install the SDK:

npm install @langrelay/sdk

Translate in 5 lines:

import { LangRelay } from '@langrelay/sdk'

const lr = new LangRelay({ apiKey: 'lr_...' })

const project = await lr.projects.create({
  name: 'My App',
  sourceLanguage: 'en',
  languages: ['fr'],
})

const result = await lr.translate({
  projectId: project.id,
  content: { greeting: 'Hello world' },
  targetLanguage: 'fr',
})
// result.content → { greeting: 'Bonjour le monde' }

Three Content Formats

Plain text

const result = await lr.translate({
  projectId: 'proj_abc',
  text: 'Hello world',
  targetLanguage: 'fr',
})
// result.translatedText → 'Bonjour le monde'

Batch text

const result = await lr.translate({
  projectId: 'proj_abc',
  text: ['Hello', 'Goodbye', 'Thank you'],
  targetLanguage: 'de',
})
// result.translations → [{ sourceText: 'Hello', translatedText: 'Hallo' }, ...]

Structured JSON

Send any JSON shape — get the same shape back with all strings translated:

const result = await lr.translate({
  projectId: 'proj_abc',
  content: {
    title: 'Getting Started',
    steps: [
      { label: 'Install', text: 'Run npm install' },
      { label: 'Configure', text: 'Add your API key' },
    ],
  },
  targetLanguage: 'fr',
})
// result.content → same shape, all strings in French

Keys like id, url, href, src, email, slug are skipped by default. Override with translateKeys.

Authentication

All requests require an API key in the x-api-key header:

curl -X POST https://api.langrelay.com/v1/translate \
  -H "x-api-key: lr_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"projectId": "proj_abc", "text": "Hello", "targetLanguage": "fr"}'

Create API keys in the LangRelay dashboard.

Next Steps

On this page